Repository navigation
Conversation
On Linux, Java Sound only talks to raw ALSA cards. It does not see
PipeWire or PulseAudio, so an empty "Microphone" setting did not follow
the default source chosen there, /langmod mics listed ALSA card names,
and a card could only be opened while the sound server was not using
it (and was then held so nothing else could use it). The mod often
ended up recording from an onboard input with nothing plugged in.
On Linux the microphone now goes through OpenAL Soft, which Minecraft
already ships for its own sound and which has PipeWire and PulseAudio
backends. Capture devices need no OpenAL context, so this never
touches the game's sound. OpenAL resamples and mixes down to 16 kHz
mono itself; the resampler stays for Java Sound.
- MicCapture keeps the voice detection loop and reads from a small
MicSource: JavaSoundSource (the old code, moved) or OpenAlSource.
- core/audio/AudioBackend: Linux tries OpenAL, then Java Sound; Windows
and macOS use Java Sound only, as before. When OpenAL can't open a
device or its library is missing, the log says so and Java Sound is
tried; when nothing works, the error is the one players saw before.
No setting: nothing needed forcing, and the log says which way was
used.
- core/audio/AudioDevices: a name is still "part of the name, any
case", now also ignoring accents ("bjorn" finds "Bjørn Studio Mic Mono").
The sound server's "Monitor of ..." sources record what is playing,
not a microphone, so they are left out of the list; a monitor is
only picked when it is the only match.
- An unplugged microphone ends listening with an error instead of
waiting for audio forever.
Names saved from the old ALSA list ("PCH", "plughw:1,0") no longer match
anything on Linux, so they log a warning and use the default source.
…x for the moment) The voice that says item names played through Java Sound, which on Linux reaches a raw ALSA card: not the output chosen in PipeWire or PulseAudio, and not one the sound server is using. No Linux voice exists yet, but the playback path should be right when one comes. On Linux the voice now plays through OpenAL Soft, like the microphone, on the output device chosen in Minecraft's sound settings (the system default when it says so, or when that device is gone). Windows and macOS keep Java Sound. If OpenAL can't open an output, the log says why and Java Sound is used. Why a separate OpenAL device and a thread-local context: Minecraft makes its own context current for the whole process with alcMakeContextCurrent and calls OpenAL from its sound thread. Making another context current that way, from any thread, would move the game's sound onto it. ALC_EXT_thread_local_context makes the voice's context current on the voice thread only, and LWJGL then registers the AL functions for that thread only (AL.createCapabilities checks for a thread context); every other thread still finds Minecraft's. Using Minecraft's own sound engine was the other choice, but it plays registered sound resources, not WAV data made at runtime. All Pronouncer work already runs on one thread, so the output refuses calls from any other. - VoiceOutput, with JavaSoundOutput (the Clip code, moved) and OpenAlOutput. Volume is still Master times Voice/Speech, a new name still cuts off the last one, and the microphone pause timing is unchanged. - The device is opened with the first name said and let go 15 s after the last one and when the game closes, so the sound server does not show an idle stream. In tests the voice is silent and opens nothing. - Wav.toPcm16: OpenAL only promises 16-bit mono and stereo, so other sample formats are converted and extra channels mixed down.
README: Linux needs PipeWire or PulseAudio (reached through OpenAL, which comes with Minecraft; raw ALSA cards otherwise). "Check the microphone", the /langmod mics row and the Microphone setting say that an empty setting follows the default input and that the list shows the sound server's inputs. The speech recognition section says how the microphone is opened on each system and what the log says, and troubleshooting has a Linux entry, including what happens to a Microphone saved from the old ALSA list. Changelog: one entry under Unreleased. INSTALL.md is unchanged: it is a Windows guide (CurseForge, Windows voices) and has nothing about Linux to correct.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On Linux, recording and playback now go through PipeWire/PulseAudio (via OpenAL Soft) instead of raw ALSA cards. If OpenAL can't open a device, it falls back to Java Sound (raw ALSA cards). Playback is ready but not heard in game yet since there are no voices on Linux for the moment. Tested on Gentoo Linux with PipeWire 1.6.11.