Simple Voice Chat

Simple Voice Chat

31M Downloads

Expected speaker selection is not available on linux

Aditeya opened this issue · 33 comments

commented

Bug description
I want to choose a speaker from the options, which is 3, however it doesn't provide that option.

Steps to reproduce the issue

  1. Press v
  2. Select speaker
  3. Press previous only to find Generic [plughw:2,1]
  4. Modifying config did not solve the issue either

Expected behavior
Ability to choose option 3 and get audio output from other players.

Log files
log.txt

Versions

  • Minecraft 1.16.4
  • Fabric 0.11.3
  • SVC 1.3.11

Other mods
A list of the other mods that were installed when this problem occurred (run on multimc):

[❌] canvas-mc116-1.0.1202.jar (disabled)
[❌] connected-block-textures-0.1.2+1.16.jar (disabled)
[✔️] fabric-api-0.32.0+1.16
[✔️] fabricmod_VoxelMap-1.10.14_for_1.16.4
[❌] litematica-fabric-1.16.4-0.0.0-dev.20201103.184101.jar (disabled)
[❌] malilib-fabric-1.16.4-0.10.0-dev.21+arne.2.jar (disabled)
[✔️] modmenu-1.14.13+build.19
[✔️] okzoomer-4.0.1+1.16.2
[✔️] shulkerboxtooltip-2.3.3+1.16.4
[✔️] sodium-extra-0.2.2
[✔️] sodium-fabric-mc1.16.3-0.1.0
[✔️] voicechat-1.16.4-1.3.11

Screenshots (Optional)
Screenshots of the issue.
2021-05-22+T15-48-43
2021-05-22_15 47 28
2021-05-22_15 47 46

commented

Alright I've got it working. The problem seems to be with pulseaudio, so I installed pipwire instead and used it as a replacement for pulseaudio, alsa and jack. Then from the settings I select default speaker and it works as expected (I get audio from the other side). Only problem is if i want to select a different speaker I wouldn't be able to. I should also mention that i switched from manjaro linux to arch linux, but I don't think that has much to do with it.

so if anyone else is experiencing the same problem i'd recommend installing pipewire and selecting the default speaker from the SVC settings.

commented

I think this is an issue of the Java sound API. Can you try it with a newer java version like 11, 15 or 16?
Please also try it without any other mods installed.

commented

I just tried java 11, 15 and 16
same issue on all
no mods (except for fabric API but I don't think this counts)

commented

Alright, then there is nothing I can do... These are the audio devices that are recognized by Java. Maybe your other devices do not support 48000Hz stereo.

commented

Actually soundcard 3 was set to 96kHz, I set it to 48kHz and it didn't work as well. I should also mention that trying sound card 2 didn't work as well, however mic input works for both.

EDIT: soundcard 2 is 48Hz by default, it can't go any higher

commented

OK, then there is nothing I can do about it, unfortunately. I just display every sound device provided by the java sound API.

commented

This is on the game with no other mods. Audio [plughw:3,0] is missing

Loopback [default]
Loopback [plughw:0,0]
Loopback [plughw:0,1]
HDMI [plughw:1,3]
HDMI [plughw:1,7]
HDMI [plughw:1,8]
HDMI [plughw:1,9]
HDMI [plughw:1,10]
HDMI [plughw:1,11]
Generic [plughw:2,0]
Generic [plughw:2,1]
commented

That's odd...
voicechat-1.16.4-1.3.11x.zip

Can you please test it on this version?
I just removed the isLineSupported line.

commented

Yes I can choose Audio [plughw:3,0] now!
Testing if there is audio output will take a few hours, so ill get back asap.

commented

Alright I decided to play around the java sound API and found that it does play sounds on my system. rh.wav is the test wav file i used and Audio [plughw:3,0], version 5.10.36-2-MANJARO is my audio device (USB soundcard which is why it looks different) which should show up on the gui as Audio [plughw:3,0] (i think) but it doesn't.

This is the code and output:

package test;

import java.io.*;
import java.net.URL;
import javax.sound.sampled.*;
import javax.swing.*;

// To play sound using Clip, the process need to be alive.
// Hence, we use a Swing application.
public class Test extends JFrame {

    // Constructor
    public Test() {
        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        this.setTitle("Test Sound Clip");
        this.setSize(300, 200);
        this.setVisible(true);

        try {
            // Open an audio input stream.
            Mixer.Info[] mixerInfo = AudioSystem.getMixerInfo();
            for (Mixer.Info i : mixerInfo) {
                System.out.println(i);
            }
            
            URL url = this.getClass().getClassLoader().getResource("rh.wav");
            AudioInputStream audioIn = AudioSystem.getAudioInputStream(url);
            // Get a sound clip resource.
            Clip clip = AudioSystem.getClip(mixerInfo[12]);
            // Open audio clip and load samples from the audio input stream.
            clip.open(audioIn);
            clip.start();
            clip.drain();
        } catch (UnsupportedAudioFileException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } catch (LineUnavailableException e) {
            e.printStackTrace();
        }
    }

    public static void main(String[] args) {
        new Test();
    }
}

output:

Loopback [default], version 5.10.36-2-MANJARO
Loopback [plughw:0,0], version 5.10.36-2-MANJARO
Loopback [plughw:0,1], version 5.10.36-2-MANJARO
HDMI [plughw:1,3], version 5.10.36-2-MANJARO
HDMI [plughw:1,7], version 5.10.36-2-MANJARO
HDMI [plughw:1,8], version 5.10.36-2-MANJARO
HDMI [plughw:1,9], version 5.10.36-2-MANJARO
HDMI [plughw:1,10], version 5.10.36-2-MANJARO
HDMI [plughw:1,11], version 5.10.36-2-MANJARO
Generic [plughw:2,0], version 5.10.36-2-MANJARO
Generic [plughw:2,1], version 5.10.36-2-MANJARO
Generic [plughw:2,2], version 5.10.36-2-MANJARO
Audio [plughw:3,0], version 5.10.36-2-MANJARO
Port Loopback [hw:0], version 5.10.36-2-MANJARO
Port HDMI [hw:1], version 5.10.36-2-MANJARO
Port Generic [hw:2], version 5.10.36-2-MANJARO
Port Audio [hw:3], version 5.10.36-2-MANJARO
commented

What is the output generated by this?

Mixer.Info[] mixers = AudioSystem.getMixerInfo();
for (Mixer.Info mixerInfo : mixers) {
    Mixer mixer = AudioSystem.getMixer(mixerInfo);
    Line.Info lineInfo = new Line.Info(SourceDataLine.class);
    if (mixer.isLineSupported(lineInfo)) {
        System.out.println(mixerInfo.getName());
    }
}
commented

I think mixer.isLineSupported(lineInfo) is the problem:

image

I think this condition is redundant anyway...

commented

I got this as the output:

Loopback [default]
Loopback [plughw:0,0]
Loopback [plughw:0,1]
HDMI [plughw:1,3]
HDMI [plughw:1,7]
HDMI [plughw:1,8]
HDMI [plughw:1,9]
HDMI [plughw:1,10]
HDMI [plughw:1,11]
Generic [plughw:2,0]
Generic [plughw:2,1]
Audio [plughw:3,0]
commented

I got this as the output:

Loopback [default]
Loopback [plughw:0,0]
Loopback [plughw:0,1]
HDMI [plughw:1,3]
HDMI [plughw:1,7]
HDMI [plughw:1,8]
HDMI [plughw:1,9]
HDMI [plughw:1,10]
HDMI [plughw:1,11]
Generic [plughw:2,0]
Generic [plughw:2,1]
Audio [plughw:3,0]

Does this contain your device?

commented

yes the last one Audio [plughw:3,0]

commented

This is the exact same code used in the mod. If it is in this list it should also be available in the mod.
Which audio devices are available in the Minecraft GUI?

commented

Yeah same problem. They can hear me but I can't hear them.
Also somewhat interestingly I found extra devices in the speaker setting which don't work as well:

Port Loopback [hw:0]
Port HDMI [hw:1],
Port Generic [hw:2]
Port Audio [hw:3]
commented

Do any of your output devices work?

commented

Alright so I've tested it and I can't hear my friends even tho I can choose my sound card. They can hear me as well and the audio icon is showing up on their name tags but no audio from their side.

here is the log file log.txt

commented

Are you using a custom launcher?

commented

Yeah its MultiMC

commented

Can you try using the vanilla launcher?

commented

OK... I have no clue what the problem could be.
My guess would be that somehow your driver or sound device doesn't meet the requirements...
Do you have another audio device that you can plug in your PC?

commented

If I run the code I sent earlier, in netbeans, the device Audio [plughw:3,0] will play audio from the wav file.

commented

No, I mean the voice chat mod.
Did I understand correctly, that the right audio device shows up, but it still doesn't work?

commented

Yes, I have the right audio device selected but I still can't hear my friends audio, even in the groups section. But they can hear me.

commented

Do you hear yourself when testing your microphone?

commented

no, but I do see the voice volume level meter working.

commented

I just tried it with motherboard audio (Generic [plughw:2,0]) and same problem. Maybe you can give some code snippets of how audio is played so i can debug it? I think that even tho its being selected, java has some problem trying to play it and isn't displaying the error.

commented

Alright so in DataLines.java line 76 I found that the try catch gives this error:

java.lang.IllegalArgumentException: Line unsupported: interface SourceDataLine
	at com.sun.media.sound.DirectAudioDevice.getLine(DirectAudioDevice.java:174)
	at test.Test3.getDeviceByName(Test3.java:99)
	at test.Test3.getSpeakerByName(Test3.java:87)
	at test.Test3.getSpeaker(Test3.java:78)
	at test.Test3.<init>(Test3.java:37)
	at test.Test3.main(Test3.java:69)

I assume this is given because the Line is not supported for this audio card either because its newer or because its USB based.

commented

OK, then it is a problem of your system or Java...

commented

I'm gonna close this for now...