JUCE + ALSA + MARIAN Clara E

Hi Jucers,

I am running into a very specific problem that I don’t know how to address.
I am trying to use a Dante Clara E PCI card from MARIAN with a JUCE App on Ubuntu 22.04.

MARIAN provides an ALSA driver and that works well with softwares like command-line speaker-test or Reaper.

The JUCE App also works well with some other audio output/driver than the Dante card.

But when trying this combination, even with the DemoRunner, the audio is totally distorted as in this example:

The output of the DemoRunner with LINUX_ALSA_LOGGING = 1 is the following:

JUCE/cmake-build/examples/DemoRunner/DemoRunner_artefacts$ ./DemoRunner 
ALSA: scanForDevices()
ALSA: Soundcard ID: hw:ClaraE,0, name: 'ClaraE, ClaraE PCM, isInput:1, isOutput:1

ALSA: getDeviceProperties(hw:ClaraE,0)
ALSA: getDeviceNumChannels: 1 512
ALSA: getDeviceProperties(hw:ClaraE,0)
ALSA: getDeviceNumChannels: 1 512
ALSA: getDeviceProperties(hw:ClaraE,0)
ALSA: getDeviceNumChannels: 1 512
ALSA: getDeviceProperties(hw:ClaraE,0)                                                                
ALSA: getDeviceNumChannels: 1 512                                                                     
ALSA: snd_pcm_open (hw:ClaraE,0, forInput=1)                                                          
ALSA: ALSADevice::setParameters(hw:ClaraE,0, 48000, 1, 512)                                           
ALSA: format: bitDepth=24, isFloat=0, isLittleEndian=1, numChannels=1                                 
ALSA: frames: 512, periods: 2, samplesPerPeriod: 512                                                  
ACCESS:  RW_NONINTERLEAVED                                                                            
FORMAT:  S24_3LE                                                                                      
SUBFORMAT:  STD                                                                                       
SAMPLE_BITS: 24                                                                                       
FRAME_BITS: 24                                                                                        
CHANNELS: 1                                                                                           
RATE: 48000
PERIOD_TIME: (10666 10667)
PERIOD_SIZE: 512
PERIOD_BYTES: 1536
PERIODS: 2
BUFFER_TIME: (21333 21334)
BUFFER_SIZE: 1024
BUFFER_BYTES: 3072
TICK_TIME: 0
tstamp_mode: NONE
tstamp_type: MONOTONIC
period_step: 1
avail_min: 512
start_threshold: 512
stop_threshold: 4611686018427387904
silence_threshold: 0
silence_size: 4611686018427387904
boundary: 4611686018427387904
ALSA: snd_pcm_open (hw:ClaraE,0, forInput=0)
ALSA: ALSADevice::setParameters(hw:ClaraE,0, 48000, 2, 512)
ALSA: format: bitDepth=24, isFloat=0, isLittleEndian=1, numChannels=2
ALSA: frames: 512, periods: 2, samplesPerPeriod: 512
ACCESS:  RW_NONINTERLEAVED
FORMAT:  S24_3LE
SUBFORMAT:  STD
SAMPLE_BITS: 24
FRAME_BITS: 48
CHANNELS: 2
RATE: 48000
PERIOD_TIME: (10666 10667)
PERIOD_SIZE: 512
PERIOD_BYTES: 3072
PERIODS: 2
BUFFER_TIME: (21333 21334)
BUFFER_SIZE: 1024
BUFFER_BYTES: 6144
TICK_TIME: 0
tstamp_mode: NONE
tstamp_type: MONOTONIC
period_step: 1
avail_min: 512
start_threshold: 512
stop_threshold: 4611686018427387904
silence_threshold: 0
silence_size: 4611686018427387904
boundary: 4611686018427387904

I don’t really know what to look for in this. It does seem ok but??
If anyone as an idea on how to start debugging this problem, I would be very grateful.

Thank you,
Benjamin

PS: I am not new to JUCE but rather fresh on ALSA!

Hi,
Just a obvious first question, don’t you have PulseAudio/Pipewire running?

Hi @KottVV,

Thank you for your answer.
That’s not obvious! I do not have PulseAudio or Pipewire installed on the machine.
Is that required for JUCE?
Other apps seems to be doing fine without…
Does JUCE ALSA driver use PulseAudio ?

Thank’s

Benjamin

And btw, reproducing the exact same config of format (buffer size, period etc.) with speaker-test works well:

speaker-test -t sine -f 440 -c 2 -F S24_3LE -b 24000 -P 2

speaker-test 1.2.6

Playback device is default
Stream parameters are 48000Hz, S24_3LE, 2 channels
Sine wave rate is 440.0000Hz
Rate set to 48000Hz (requested 48000Hz)
Buffer size range from 32 to 2048
Period size range from 16 to 1024
Requested buffer time 24000 us
Periods = 2
was set period_size = 512
was set buffer_size = 1024
 0 - Front Left
 1 - Front Right
Time per period = 5.973892

Sound is good!

It is not required and moreover it cause problems with JUCE apps often, that’s why I asked.
This is might be an unlucky coincidence with Marian ALSA driver and JUCE. Maybe it’s worth to ask Marian also.

Ahah! Thank’s for the info @KottVV
I did not intend to add any layers (PulseAudio, Jack or PipeWire) to keep the system as bare as possible. But that’s good to know anyway.

I’m trying to get some info from Marian as well (about another problem) but got no answer yet. I’ll try asking them as well. But as it works “out of the box” for speaker-test and for Reaper, I don’t think they’ll be much concerned about my question…

Meanwhile, I’ll continue digging on my own :wink:

Cheers

Benjamin