MAC: No alsa driver for Jack

Post Reply
dpoznan
Posts: 68
Joined: Wed Jun 30, 2021 10:50 pm

MAC: No alsa driver for Jack

Post by dpoznan » Thu Mar 24, 2022 8:22 pm

I am trying to run openMHA on my M1 Macbook Pro. I try to run a simple sine generator..
(my3.9) macbook2020@DansMacBook-Pro-2022 Poz_tools % python3.9 new_gen_sin.py
Enter host name for sine generator: localhost
select L, R or Both headset from hearingpi to the desired Mic (L R B): B
Traceback (most recent call last):
File "/Users/macbook2020/projects/Hearing-Aid-Prototype/Experiment/Poz/Poz_tools/new_gen_sin.py", line 106, in <module>
mha_PI.set_val('cmd','prepare')
File "/Users/macbook2020/projects/Hearing-Aid-Prototype/Experiment/openMHA-4.17.0-master/mha/tools/python/openMHA/MHAConnection.py", line 237, in set_val
return self.set_val_raw(path, value).decode()
File "/Users/macbook2020/projects/Hearing-Aid-Prototype/Experiment/openMHA-4.17.0-master/mha/tools/python/openMHA/MHAConnection.py", line 202, in set_val_raw
return self._send_command(cmd)
File "/Users/macbook2020/projects/Hearing-Aid-Prototype/Experiment/openMHA-4.17.0-master/mha/tools/python/openMHA/MHAConnection.py", line 123, in _send_command
raise ValueError(
ValueError: Error sending message b'cmd=prepare\n' with error code 1:
Response: b"\n(mhafw_lib) IO error: (mhajack) Unable to connect to JACK server 'default' as client 'MHA'.\n(MHA:failure)"
(my3.9) macbook2020@DansMacBook-Pro-2022 Poz_tools %


I attempted to start Jack and I get a complaint about no alsa driver. I also don't know what to specify for sound card.

+ SOUNDSTREAM=0
+ SOUNDCHANNELS=1,2
+ SAMPLERATE=48000
+ FRAGSIZE=48
+ NPERIODS=2
+ MHACONFIG=/home/pi/hearingaid-prototype/openMHA.cfg
+ MHAIP=0.0.0.0
+ MHAPORT=33337
+ echo 'killall mha'
killall mha
+ killall mha -9
+ echo 'killall jackd'
killall jackd
+ killall jackd -9
+ sleep 1
+ echo 'start jackd'
start jackd
+ jackd --realtime -d alsa -d hw:,0 -p 48 -r 48000 -n 2 -s
+ sleep 2
+ sed 's/^/[JACKD] /'
[JACKD] Unknown driver "alsa"
[JACKD] jackdmp 1.9.16
[JACKD] Copyright 2001-2005 Paul Davis and others.
[JACKD] Copyright 2004-2016 Grame.
[JACKD] Copyright 2016-2020 Filipe Coelho.
[JACKD] jackdmp comes with ABSOLUTELY NO WARRANTY
[JACKD] This is free software, and you are welcome to redistribute it
[JACKD] under certain conditions; see the file COPYING for details
+ jack_connect MHA:out_1 system:playback_2
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
jack server not running?
+ jack_connect MHA:out_2 system:playback_1
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
jack server not running?
+ echo 'start network command server'
start network command server
(my3.9) macbook2020@DansMacBook-Pro-2022 Poz % ps -el|grep jack
501 13592 1406 4006 0 31 0 408637584 1696 - S+ 0 ttys005 0:00.00 grep jack
(my3.9) macbook2020@DansMacBook-Pro-2022 Poz %

Any suggestions? I haven't been able to find alsa drivers on the web. Is my M1 Apple chip an issue?

dpoznan
Posts: 68
Joined: Wed Jun 30, 2021 10:50 pm

Re: MAC: No alsa driver for Jack

Post by dpoznan » Fri Mar 25, 2022 4:12 pm

I changed my jackd invocation, and I am able to run the simple sine generatore cfg.
I used:

jackd -d coreaudio -r 48000 -p 240 >&1 | sed 's/^/[JACKD] /' &


But I did get errors on
#echo "connect mha"
jack_connect MHA:out_1 system:playback_2
jack_connect MHA:out_2 system:playback_1

[JACKD] jackdmp 1.9.16
[JACKD] Copyright 2001-2005 Paul Davis and others.
[JACKD] Copyright 2004-2016 Grame.
[JACKD] Copyright 2016-2020 Filipe Coelho.
[JACKD] jackdmp comes with ABSOLUTELY NO WARRANTY
[JACKD] This is free software, and you are welcome to redistribute it
[JACKD] under certain conditions; see the file COPYING for details
[JACKD] JACK server starting in realtime mode with priority 10
[JACKD] self-connect-mode is "Don't restrict self connect requests"
Default input and output devices are not the same !!
Cannot open default device in duplex mode, so aggregate default input and default output
[JACKD] Separated input = 'MacBook Pro Microphone'
[JACKD] Separated output = 'MacBook Pro Speakers'
[JACKD] Input channel = 0 ==> JACK input port = 0
[JACKD] JACK output port = 0 ==> output channel = 0
[JACKD] JACK output port = 1 ==> output channel = 1
[JACKD] CoreAudio driver is running...
+ jack_connect MHA:out_1 system:playback_2
ERROR MHA:out_1 not a valid port
Cannot read socket fd = 5 err = Socket is not connected
CheckRes error
JackSocketClientChannel read fail
+ jack_connect MHA:out_2 system:playback_1
ERROR MHA:out_2 not a valid port
Cannot read socket fd = 5 err = Socket is not connected
CheckRes error
JackSocketClientChannel read fail
+ echo 'start network command server'
start network command server




So I am partway there. Need to find the input and output devices on Mac.
When I ran the sine cfg I did get a sine signal out the Mac speaker.

dpoznan
Posts: 68
Joined: Wed Jun 30, 2021 10:50 pm

Re: MAC: No alsa driver for Jack

Post by dpoznan » Sat Mar 26, 2022 11:31 am

I found the device names to use and am able to get the simple sine generator to output to headset

SAMPLERATE=48000
PERIOD=240
#[JACKD] Device ID = '51' name = 'MacBook Pro Microphone', internal name = 'BuiltInMicrophoneDevice' (to be used as -C, -P, or -d parameter)
#[JACKD] Device ID = '44' name = 'MacBook Pro Speakers', internal name = 'BuiltInSpeakerDevice' (to be used as -C, -P, or -d parameter)
#[JACKD] Device ID = '175' name = 'External Microphone', internal name = 'BuiltInHeadphoneInputDevice' (to be used as -C, -P, or -d parameter)
#[JACKD] Device ID = '168' name = 'External Headphones', internal name = 'BuiltInHeadphoneOutputDevice' (to be used as -C, -P, or -d parameter)

jackd -d coreaudio -C BuiltInHeadphoneInputDevice -P BuiltInHeadphoneOutputDevice -r $SAMPLERATE -p $PERIOD >&1 | sed 's/^/[JACKD] /' &

sleep 2


#echo "connect mha"
jack_connect MHA:out_1 system:playback_1
jack_connect MHA:out_2 system:playback_2

Post Reply