Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Playing audio file on macos-14 agent takes very long time than expected #11251

Open
2 of 16 tasks
sanket492 opened this issue Dec 30, 2024 · 2 comments
Open
2 of 16 tasks

Comments

@sanket492
Copy link

Description

I am using macos-14 agent for running automated tests which involves playing audio (.wav file).
The duration of audio file is 2 seconds, but audio file is played on agent takes approx. 6 to 8 mins.

I have tried 2 approaches to play the audio. (Audio file link: https://github.com/sanket492/TestAudio/blob/main/PatientComplainsOfHeadache.wav)

Approach 1: Using Java classes:

/**
 * Plays a sound in simulator
 *
 * @param audioFileName
 */
public static void playSound(String audioFileName) {
    try {
        int audioDuration = getAudioDurationInt(audioFileName);
        Clip clip = AudioSystem.getClip();
        File file = new File(System.getProperty("user.dir") + "/audioFiles/" + audioFileName);
        clip.open(AudioSystem.getAudioInputStream(file));

        clip.start();
        Thread.sleep((audioDuration+1)*1000);
        clip.stop();
        clip.close();
    } catch (Exception exc) {
        exc.printStackTrace(System.out);
    }
}

/**
 * get duration of audio file
 *
 * @param audioFileName
 * @return
 */
public static int getAudioDurationInt(String audioFileName) {
    try {
        File file = new File(System.getProperty("user.dir") + "/audioFiles/" + audioFileName);
        AudioInputStream audioInputStream = AudioSystem.getAudioInputStream(file);
        AudioFormat format = audioInputStream.getFormat();
        long frames = audioInputStream.getFrameLength();
        double durationInSeconds = (frames + 0.0) / format.getFrameRate();
        return (int) durationInSeconds;
    } catch (Exception exc) {
        exc.printStackTrace(System.out);
        return 0;
    }
}

Approach 2: Using command line utility afplay to play audio file with Java

public static void playSoundCLI(String audioFileName) throws IOException, InterruptedException {
    String filePath = System.getProperty("user.dir") + "/audioFiles/" + audioFileName;
    String command ="afplay "+filePath;
    System.out.println("Command executed is: "+command);
    Process proc = Runtime.getRuntime().exec(command);
    proc.waitFor();
}

Approach 3: Directly using pipeline task or script to run file
afplay pathToAudioFile

Platforms affected

  • Azure DevOps
  • GitHub Actions - Standard Runners
  • GitHub Actions - Larger Runners

Runner images affected

  • Ubuntu 20.04
  • Ubuntu 22.04
  • Ubuntu 24.04
  • macOS 12
  • macOS 13
  • macOS 13 Arm64
  • macOS 14
  • macOS 14 Arm64
  • macOS 15
  • macOS 15 Arm64
  • Windows Server 2019
  • Windows Server 2022
  • Windows Server 2025

Image version and build link

Version: 20241216.504
Included Software: https://github.com/actions/runner-images/blob/macos-14/20241216.504/images/macos/macos-14-Readme.md
Image Release: https://github.com/actions/runner-images/releases/tag/macos-14%2F20241216.504

Is it regression?

No

Expected behavior

Playing audio file should be completed within time, as per the audio duration of file.

Actual behavior

Playing audio file on agent takes very long time than expected.
e.g Playing a audio file of duration 2 seconds takes 6-8 minutes on macos-14 agent

Repro steps

  1. Play an audio file using any code or command line and check the time it is taking to complete.
    Note:
    I have provided java code snippets and ADO task/script that I have used in description field above.
    (Audio file link: https://github.com/sanket492/TestAudio/blob/main/PatientComplainsOfHeadache.wav)
@sanket492 sanket492 changed the title Playing audio file on agent takes very long time than expected Playing audio file on macos-14 agent takes very long time than expected Dec 30, 2024
@prasanjitsahoo
Copy link
Contributor

HI @sanket492, We will investigate the issue further and keep you updated with any progress.Thank you.

@sanket492
Copy link
Author

When tried running directly using pipeline script task

  • script: |
    afplay /Users/runner/work/1/s/qaa/audioFiles/PatientComplainsOfHeadache.wav
    displayName: Play audio file
    continueOnError: true

Getting error: Error: AudioQueueStart failed (0x10000004)

Screenshot 2025-01-02 at 7 46 42 PM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants