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

Java Audio fails under WSL2 under Windows 11 #10920

Closed
1 of 2 tasks
ghost opened this issue Dec 14, 2023 · 4 comments
Closed
1 of 2 tasks

Java Audio fails under WSL2 under Windows 11 #10920

ghost opened this issue Dec 14, 2023 · 4 comments

Comments

@ghost
Copy link

ghost commented Dec 14, 2023

Windows Version

Microsoft Windows [Version 10.0.22621.2861]

WSL Version

WSL version: 2.0.9.0

Are you using WSL 1 or WSL 2?

  • WSL 2
  • WSL 1

Kernel Version

5.15.133.1-1

Distro Version

Debian

Other Software

No response

Repro Steps

Compile sample java Audio program:

import javax.sound.sampled.*;
import java.io.*;

public class AudioRecorder {

    public static void main(String[] args) {
        try {
            AudioFormat format = new AudioFormat(44100, 16, 1, true, true);
            TargetDataLine line = AudioSystem.getTargetDataLine(format); // fails here - no sound support

        } catch (LineUnavailableException e) {
            e.printStackTrace();
        }
    }
}

Expected Behavior

Should detect sound

Actual Behavior

javax.sound.sampled.LineUnavailableException: The system does not support the specified format.

Diagnostic Logs

No response

Copy link

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!

Open similar issues:

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

@OneBlue
Copy link
Collaborator

OneBlue commented Dec 15, 2023

@johnworchester: Do you have sound if let's say you open firefox and open a video on youtube ?

@ghost
Copy link
Author

ghost commented Dec 18, 2023

Other sound works flawlessy. I also completly reinstalled the distro - to no avail

@OneBlue
Copy link
Collaborator

OneBlue commented Dec 18, 2023

Other sound works flawlessy. I also completly reinstalled the distro - to no avail

Ok in this case this issue is probably related to the above code sample or the java libraries that you're using. I'm not a java expert so unfortunately I'm not able to help root cause it.

Closing since sound works in other applications so this issue isn't caused by WSL.

@OneBlue OneBlue closed this as completed Dec 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant