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

Testing multichannel audio devices drivers #99

Open
trackme518 opened this issue Jan 9, 2024 · 3 comments
Open

Testing multichannel audio devices drivers #99

trackme518 opened this issue Jan 9, 2024 · 3 comments

Comments

@trackme518
Copy link

trackme518 commented Jan 9, 2024

Hi,
I just run a test on Windows 10, filtering only multichannel devices listed using if (MultiChannel.usePortAudio()) { All MME drivers are working properly. However all ASIO and WDM-KS drivers fail. I just hand picked some of the error messages - listed below. I am also attaching my device list for reference (with output channels count on the left). I am going to test with MacOS and linux later.

Supported MME devices

Hopefully it will help someone.

Please wait - this is ongoing testing - I previously make it work with "MOTU UltraLite-mk5 - ASIO" on different PC so these are not definitive results.

8 channel MME output on Windows

In order for MME device to able to output 8 channels in Windows you need to configure the device in Sound Control Panel - select configure and set it to 7.1 mode or whatever you want. See screenshot below:

soundControlPanelWindows

Releted question posed here: https://superuser.com/questions/1377796/windows-10-hdmi-enable-9-2-channel-audio

Route MME device into ASIO only device - Windows

To route actual sound output into ASIO device only you can use Voicemeeter app (https://vb-audio.com/Voicemeeter/) (do not forget to configure it to 7.1 inside Sound Control Panel - see above) -> 1) output from Sound library from Processing into "VoiceMeeter Input (VB-Audio Voi - MME". 2)start VoiceMeeter app - set output to ASIO4ALL (install from here - free virtual ASIO device: https://asio4all.org/ ). Inside VoiceMeeter open "Menu"->"System settings / options" and click "ASIO4ALL" name - that will open ASIO4ALL configuration menu where you can select OTHER ASIO enable device to output to.... To say it is a cumbersome is understatement but it works. This way you can route MME device into ASIO device that does NOT support MME. However, with voiceMeeter you are still limited to 8 channels MME...which from what I read online might be a Windows limitation as of 1.2024 (I am not sure about DolbyAtmos option for this.).

voicemeeterSetupMMEtoASIO

Listed / recognized devices:

audioDevices

Speakers (ravenna virtual sound card ) - windows WASAPI:

java.lang.RuntimeException: Device unavailable
Pa_StartStream: waveInStart returned = 0x0.
WASAPI: IAudioClient2 set properties: IsOffload = 0, Category = 0, Options = 0
WASAPI ERROR HRESULT: 0x88890008 : AUDCLNT_E_UNSUPPORTED_FORMAT
 [FUNCTION: CreateAudioClient FILE: D:\portaudio1907\src\hostapi\wasapi\pa_win_wasapi.c {LINE: 3294}]
WASAPI ERROR PAERROR: -9997 : Invalid sample rate
 [FUNCTION: ActivateAudioClientOutput FILE: D:\portaudio1907\src\hostapi\wasapi\pa_win_wasapi.c {LINE: 3611}]
WASAPI ERROR PAERROR: -9997 : Invalid sample rate
 [FUNCTION: OpenStream FILE: D:\portaudio1907\src\hostapi\wasapi\pa_win_wasapi.c {LINE: 3999}]
java.lang.RuntimeException: Invalid sample rate

ASIO4ALL:

Pa_StartStream: waveInStart returned = 0x0.
Pa_StartStream: waveInStart returned = 0x0.
OpenStream paDeviceUnavailable
java.lang.RuntimeException: Device unavailable

Speakers (USB Sound Device) windows - WDM-KS:

Pa_StartStream: waveInStart returned = 0x0.
OpenStream:sampleRate = 44100.000000
OpenStream:framesPerBuffer = 128
Blocking API not supported yet!
java.lang.RuntimeException: Blocking API not supported yet

However it did found ASIO devices - additional logs:

WARNING: Logging before InitGoogleLogging() is written to STDERR
I0109 23:26:02.101178 15724 dllmain.cpp:43] Logging disabled. (This shouldn't log.)
I0109 23:26:02.101178 15724 wrapper.cpp:33] SarAsioWrapper::SarAsioWrapper
I0109 23:26:02.102180 15724 wrapper.cpp:39] SarAsioWrapper::init
I0109 23:26:02.102180 15724 tinyasio.cpp:31] Querying installed ASIO drivers.
I0109 23:26:02.102180 15724 tinyasio.cpp:75] Found ASIO driver: Ableton Push with CLSID {E42E3576-B7B4-4FDE-AE6C-E5FD34F7AD40}
I0109 23:26:02.102180 15724 tinyasio.cpp:75] Found ASIO driver: ASIO4ALL v2 with CLSID {232685C6-6548-49D8-846D-4141A3EF7560}
I0109 23:26:02.102180 15724 tinyasio.cpp:75] Found ASIO driver: JackRouter with CLSID {838FE50A-C1AB-4B77-B9B6-0A40788B53F3}
I0109 23:26:02.102180 15724 tinyasio.cpp:69] Unable to get ASIO driver description, using key name instead.
I0109 23:26:02.102180 15724 tinyasio.cpp:75] Found ASIO driver: MOTU Audio ASIO with CLSID {35e63f42-c4bd-11d1-85b2-00104b2edc4d}
I0109 23:26:02.102180 15724 tinyasio.cpp:75] Found ASIO driver: Realtek ASIO with CLSID {A80362FF-CE76-4DD9-874A-704C57BF0D6A}
I0109 23:26:02.102180 15724 tinyasio.cpp:75] Found ASIO driver: Synchronous Audio Router with CLSID {0569D852-1F6A-44A7-B7B5-EFB78B66BE21}
I0109 23:26:02.102180 15724 tinyasio.cpp:75] Found ASIO driver: Voicemeeter Virtual ASIO with CLSID {9175CF07-885D-46B4-9EA1-4126D6648DE6}
I0109 23:26:02.102180 15724 tinyasio.cpp:80] Done querying ASIO drivers. Status: 259
I0109 23:26:02.127202 15724 wrapper.cpp:55] SarAsioWrapper::getDriverName
I0109 23:26:02.127202 15724 wrapper.cpp:61] SarAsioWrapper::getDriverVersion
I0109 23:26:02.127202 15724 wrapper.cpp:105] SarAsioWrapper::getChannels
I0109 23:26:02.127202 15724 wrapper.cpp:138] SarAsioWrapper::getBufferSize
I0109 23:26:02.127202 15724 wrapper.cpp:209] SarAsioWrapper::getSampleRate
I0109 23:26:02.127202 15724 wrapper.cpp:198] SarAsioWrapper::canSampleRate

## Working cheap 8 channel soundcard under Windows
ADA-71 USB 7.1 SOUNDbox
https://www.axagon.eu/en/produkty/ada-71
Note that it works under Windows 10 when you configure speakers to 7.1 but it does NOT work under MacOS Ventura.
@trackme518
Copy link
Author

trackme518 commented Jan 22, 2024

@kevinstadler Hi, I am having luck with JASIO - https://github.com/mhroth/jasiohost I have successfully started the ASIO driver with it from processing. I am attaching minimal example sketch using the JASIO libraries - I have copied .dlls into my system32 folder on windows. I think it might be implemented into sound library - including the jar and creating the Host class that can than pass the buffers from SoundFile to ASIO driver directly.... I made an example sketch attached - I successfully copied data from SoundFile buffer and pass them into ASIO device - I used Voicemeeter app for debugging - it represents itself as 8 channel ASIO device that will be listed in my sketch so select it. Start the Voicemeeter and select A1 physical output to your speakers, click start. You should hear the audio. You can also notice that when you pass file in diffrent sample rate it will play faster / slower - this can be probably account for by dividing / multiplying each frame, I am just posting it as proof of concept.

Beside I can confirm that Windows is limited to 8 channels when using WDM drivers (and I can't load ASIO drivers with Sound lib right now). This is a solution if need more than 8 channels or you need ASIO for some reason (theoretically it should have lower latency)

jasio.zip

Listing various ASIO devices
ASIO_on_windows

Listing and playing into 128 channel outputs:

ASIO_128channels

@trackme518
Copy link
Author

trackme518 commented Jan 22, 2024

@kevinstadler how do you deal with resampling / playing audio with different sampling freq inside sound lib? Maybe I can reuse existing code...

@kevinstadler
Copy link
Collaborator

Thanks for your extensive testing and sorry for the delay! The sound library does not do any of the synthesis number crunching itself, so the way to integrate this would be to implement a generic Jasio-based AudioOutputStream which gets instantiated by a Jasio AudioDeviceManager that could be added to the Sound library.

Based on a generic AudioOutputStream implementation all other questions of synthesis and resampling are solved because they are already implemented by JSyn classes (particularly the VariableRateDataReader). This would all work out of the box because the JSyn generators (and in turn the Sound library ones) are oblivious to the implementation details of the output streams, they just fill the buffers in the appropriate way that matches the (fixed) framerate that the AudioDeviceManager is operating at.

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

2 participants