shaden
shaden copied to clipboard
engine error: Invalid number of channels
Hi Brett, first of all, really cool project. I used to be really into audio stuff years ago, i'm a go programmer and interested in learning a bit of lisp, so plenty of reasons to check out your project.
I run on linux. i have pulseaudio (and i think also alsa, at least i always use alsamixer to adjust my levels)
upon installing shaden and running an example i get no sound and this output:
shaden examples/frequency-modulation.lisp
ALSA lib pcm_dsnoop.c:638:(snd_pcm_dsnoop_open) unable to open slave
ALSA lib pcm_dmix.c:1108:(snd_pcm_dmix_open) unable to open slave
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
connect(2) call to /dev/shm/jack-1011/default/jack_0 failed (err=No such file or directory)
attempt to connect to server failed
connect(2) call to /dev/shm/jack-1011/default/jack_0 failed (err=No such file or directory)
attempt to connect to server failed
ALSA lib pcm_oss.c:377:(_snd_pcm_oss_open) Unknown field port
ALSA lib pcm_oss.c:377:(_snd_pcm_oss_open) Unknown field port
ALSA lib pcm_usb_stream.c:486:(_snd_pcm_usb_stream_open) Invalid type for card
ALSA lib pcm_usb_stream.c:486:(_snd_pcm_usb_stream_open) Invalid type for card
ALSA lib pcm_dmix.c:1108:(snd_pcm_dmix_open) unable to open slave
connect(2) call to /dev/shm/jack-1011/default/jack_0 failed (err=No such file or directory)
attempt to connect to server failed
PID: 22416
Seed: 1548878518814495279
Input Device: HDA Intel HDMI: 0 (hw:0,3) (5.804988ms/-1s)
Output Device: HDA Intel HDMI: 1 (hw:0,7) (5.804988ms/34.829931ms)
Expression 'parameters->channelCount <= maxChans' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 1513
Expression 'ValidateParameters( inputParameters, hostApi, StreamDirection_In )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2813
engine error: Invalid number of channels
any ideas? thanks!
Hmmmm could you run shaden -device-list and paste the output? The indices of those inputs and outputs can be selected using -device-in INDEX and -device-out INDEX respectively. It might be that you will need to select a particular device for pulseaudio.
shaden -device-list ⏎
ALSA lib pcm_dsnoop.c:638:(snd_pcm_dsnoop_open) unable to open slave
ALSA lib pcm_dmix.c:1108:(snd_pcm_dmix_open) unable to open slave
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
connect(2) call to /dev/shm/jack-1011/default/jack_0 failed (err=No such file or directory)
attempt to connect to server failed
connect(2) call to /dev/shm/jack-1011/default/jack_0 failed (err=No such file or directory)
attempt to connect to server failed
ALSA lib pcm_oss.c:377:(_snd_pcm_oss_open) Unknown field port
ALSA lib pcm_oss.c:377:(_snd_pcm_oss_open) Unknown field port
ALSA lib pcm_usb_stream.c:486:(_snd_pcm_usb_stream_open) Invalid type for card
ALSA lib pcm_usb_stream.c:486:(_snd_pcm_usb_stream_open) Invalid type for card
ALSA lib pcm_dmix.c:1108:(snd_pcm_dmix_open) unable to open slave
connect(2) call to /dev/shm/jack-1011/default/jack_0 failed (err=No such file or directory)
attempt to connect to server failed
Audio Devices
0: HDA Intel HDMI: 0 (hw:0,3)
1: HDA Intel HDMI: 1 (hw:0,7)
2: HDA Intel HDMI: 2 (hw:0,8)
3: HDA Intel HDMI: 3 (hw:0,9)
4: HDA Intel HDMI: 4 (hw:0,10)
5: HDA Intel PCH: ALC3226 Analog (hw:1,0)
6: hdmi
7: pulse
8: default
MIDI Devices
0: Midi Through Port-0 (output)
1: Midi Through Port-0 (input)
I have run
for i in 0 1 2 3 4 5 6 7 8 ; do timeout 4 shaden -device-out $i examples/frequency-modulation.lisp &> test-device-$i.txt; done
all output files are identical to the output posted above, with the (obvious) exceptions of the printouts of the Seed, PID, and Output Device lines.
should i try a similar loop trying input devices? i presume there's no need for an input device?
This might be something I need to improve on. Ideally inputs shouldn’t be required, but right now I think it might be. I’ll make a branch with some adjustments for you to try if you are game for helping test it out 😊? At the very least we can probably improve some error logging to help diagnose the issue faster.
On Sun, Feb 3, 2019 at 12:40 PM Dieter Plaetinck [email protected] wrote:
shaden -device-list ⏎
ALSA lib pcm_dsnoop.c:638:(snd_pcm_dsnoop_open) unable to open slave
ALSA lib pcm_dmix.c:1108:(snd_pcm_dmix_open) unable to open slave
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
connect(2) call to /dev/shm/jack-1011/default/jack_0 failed (err=No such file or directory)
attempt to connect to server failed
connect(2) call to /dev/shm/jack-1011/default/jack_0 failed (err=No such file or directory)
attempt to connect to server failed
ALSA lib pcm_oss.c:377:(_snd_pcm_oss_open) Unknown field port
ALSA lib pcm_oss.c:377:(_snd_pcm_oss_open) Unknown field port
ALSA lib pcm_usb_stream.c:486:(_snd_pcm_usb_stream_open) Invalid type for card
ALSA lib pcm_usb_stream.c:486:(_snd_pcm_usb_stream_open) Invalid type for card
ALSA lib pcm_dmix.c:1108:(snd_pcm_dmix_open) unable to open slave
connect(2) call to /dev/shm/jack-1011/default/jack_0 failed (err=No such file or directory)
attempt to connect to server failed
Audio Devices
0: HDA Intel HDMI: 0 (hw:0,3)
1: HDA Intel HDMI: 1 (hw:0,7)
2: HDA Intel HDMI: 2 (hw:0,8)
3: HDA Intel HDMI: 3 (hw:0,9)
4: HDA Intel HDMI: 4 (hw:0,10)
5: HDA Intel PCH: ALC3226 Analog (hw:1,0)
6: hdmi
7: pulse
8: default
MIDI Devices
0: Midi Through Port-0 (output)
1: Midi Through Port-0 (input)
I have run
for i in 0 1 2 3 4 5 6 7 8 ; do timeout 4 shaden -device-out $i examples/frequency-modulation.lisp &> test-device-$i.txt; done
all output files are identical to the output posted above, with the (obvious) exceptions of the printouts of the Seed, PID, and Output Device lines.
should i try a similar loop trying input devices? i presume there's no need for an input device?
— You are receiving this because you commented.
Reply to this email directly, view it on GitHub https://github.com/brettbuddin/shaden/issues/9#issuecomment-460072028, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAXq5GVaM0gmSOQ-_R1ESfog9aCSUT3ks5vJx8igaJpZM4aa9ez .
I'm happy to help ! :)
Could you pull down this branch and give it a try? https://github.com/brettbuddin/shaden/tree/no-input
By giving the -device-in a negative index like -1 it'll disable the lookup of the input device entirely. This is a cheap work-around, but it might help your situation. I'll look to something more holistic if this solves your problem.
Aha! With the same bash loop as before, all runs print something along the lines of
ALSA lib pcm_dsnoop.c:638:(snd_pcm_dsnoop_open) unable to open slave
ALSA lib pcm_dmix.c:1108:(snd_pcm_dmix_open) unable to open slave
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
connect(2) call to /dev/shm/jack-1011/default/jack_0 failed (err=No such file or directory)
attempt to connect to server failed
connect(2) call to /dev/shm/jack-1011/default/jack_0 failed (err=No such file or directory)
attempt to connect to server failed
ALSA lib pcm_oss.c:377:(_snd_pcm_oss_open) Unknown field port
ALSA lib pcm_oss.c:377:(_snd_pcm_oss_open) Unknown field port
ALSA lib pcm_usb_stream.c:486:(_snd_pcm_usb_stream_open) Invalid type for card
ALSA lib pcm_usb_stream.c:486:(_snd_pcm_usb_stream_open) Invalid type for card
ALSA lib pcm_dmix.c:1108:(snd_pcm_dmix_open) unable to open slave
connect(2) call to /dev/shm/jack-1011/default/jack_0 failed (err=No such file or directory)
attempt to connect to server failed
PID: 10330
Seed: 1549444590903409133
Input Device: none
Output Device: default (8.684807ms/34.807256ms)
Adding gen-1
└ Completed in 31.255µs
Patching gen-1
│ 40.00Hz -> amp
│ 5.00Hz -> freq
└ Completed in 23.529µs
Adding gen-2
└ Completed in 24.144µs
Patching gen-2
│ 0.5011872336272722 -> amp
│ 300.00Hz -> freq
│ gen-1/sine -> freq-mod
└ Completed in 26.32µs
Emitting
│ gen-2/sine -> left
│ gen-2/sine -> right
└ Completed in 13.42µs
and with devices 5,7,8 (intel pch, pulse, default) I can hear a sine! not over the other ones (makes sense because they're all hdmi which I don't use)
note that if I run shaden -device-in -1 examples/frequency-modulation.lisp i hear nothing because it uses device Output Device: HDA Intel HDMI: 1 (hw:0,7) (5.804988ms/34.829931ms) (equivalent of -device-out 1).
In my case it seems that for output-device, defaulting to the one with name "default" would be better than using id 1.
Very cool!
This device selection implementation was the dumbest thing I could do sort of situation way back when, and it can be improved. For now I'm going to commit to this idea of not selecting an in/out device via the existing flags. I'll change the API to accept none as an option for -device-in and -device-out instead of a negative number.
I'm not sure about the best way to look up what the machine considers the default. I could use some help seeing if there is a way to easily look it up on Linux. I'll take a look at the macOS case and see what I can dig up. Ideally we'd see what the machine's active audio in/out device scheme is and use those without any user intervention. Better device introspection and error messages will go a long way, too.
On macOS I can run: system_profiler SPAudioDataType -xml and get something like this:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<array>
<dict>
<key>_SPCommandLineArguments</key>
<array>
<string>/usr/sbin/system_profiler</string>
<string>-nospawn</string>
<string>-xml</string>
<string>SPAudioDataType</string>
<string>-detailLevel</string>
<string>full</string>
</array>
<key>_SPCompletionInterval</key>
<real>0.084399938583374023</real>
<key>_SPResponseTime</key>
<real>0.17759394645690918</real>
<key>_dataType</key>
<string>SPAudioDataType</string>
<key>_detailLevel</key>
<integer>-1</integer>
<key>_items</key>
<array>
<dict>
<key>_items</key>
<array>
<dict>
<key>_name</key>
<string>Built-in Microphone</string>
<key>coreaudio_default_audio_input_device</key>
<string>spaudio_yes</string>
<key>coreaudio_device_input</key>
<integer>2</integer>
<key>coreaudio_device_manufacturer</key>
<string>Apple Inc.</string>
<key>coreaudio_device_srate</key>
<real>44100</real>
<key>coreaudio_device_transport</key>
<string>coreaudio_device_type_builtin</string>
<key>coreaudio_input_source</key>
<string>Internal Microphone</string>
</dict>
<dict>
<key>_name</key>
<string>Built-in Output</string>
<key>_properties</key>
<string>coreaudio_default_audio_system_device</string>
<key>coreaudio_default_audio_output_device</key>
<string>spaudio_yes</string>
<key>coreaudio_default_audio_system_device</key>
<string>spaudio_yes</string>
<key>coreaudio_device_manufacturer</key>
<string>Apple Inc.</string>
<key>coreaudio_device_output</key>
<integer>2</integer>
<key>coreaudio_device_srate</key>
<real>44100</real>
<key>coreaudio_device_transport</key>
<string>coreaudio_device_type_builtin</string>
<key>coreaudio_output_source</key>
<string>Internal Speakers</string>
</dict>
<dict>
<key>_name</key>
<string>Loopback Audio</string>
<key>coreaudio_device_input</key>
<integer>2</integer>
<key>coreaudio_device_manufacturer</key>
<string>Rogue Amoeba Software, Inc.</string>
<key>coreaudio_device_output</key>
<integer>2</integer>
<key>coreaudio_device_srate</key>
<real>44100</real>
<key>coreaudio_device_transport</key>
<string>coreaudio_device_type_virtual</string>
<key>coreaudio_input_source</key>
<string>spaudio_default</string>
<key>coreaudio_output_source</key>
<string>spaudio_default</string>
</dict>
<dict>
<key>_name</key>
<string>To Scarlett</string>
<key>coreaudio_device_input</key>
<integer>2</integer>
<key>coreaudio_device_manufacturer</key>
<string>Rogue Amoeba Software, Inc.</string>
<key>coreaudio_device_output</key>
<integer>2</integer>
<key>coreaudio_device_srate</key>
<real>48000</real>
<key>coreaudio_device_transport</key>
<string>coreaudio_device_type_virtual</string>
<key>coreaudio_input_source</key>
<string>spaudio_default</string>
<key>coreaudio_output_source</key>
<string>spaudio_default</string>
</dict>
<dict>
<key>_name</key>
<string>Aggregate Device</string>
<key>coreaudio_device_input</key>
<integer>4</integer>
<key>coreaudio_device_manufacturer</key>
<string>Apple Inc.</string>
<key>coreaudio_device_output</key>
<integer>4</integer>
<key>coreaudio_device_srate</key>
<real>44100</real>
<key>coreaudio_device_transport</key>
<string>coreaudio_device_type_unknown</string>
<key>coreaudio_input_source</key>
<string>spaudio_default</string>
<key>coreaudio_output_source</key>
<string>spaudio_default</string>
</dict>
</array>
<key>_name</key>
<string>coreaudio_device</string>
</dict>
</array>
<key>_parentDataType</key>
<string>SPHardwareDataType</string>
<key>_properties</key>
<dict>
<key>_name</key>
<dict>
<key>_isColumn</key>
<string>YES</string>
<key>_isOutlineColumn</key>
<string>YES</string>
<key>_order</key>
<string>0</string>
</dict>
<key>spaudio_bitdepth</key>
<dict>
<key>_order</key>
<string>100</string>
</dict>
<key>spaudio_bitwidth</key>
<dict>
<key>_order</key>
<string>110</string>
</dict>
<key>spaudio_channels</key>
<dict>
<key>_order</key>
<string>120</string>
</dict>
<key>spaudio_codec</key>
<dict>
<key>_order</key>
<string>10</string>
</dict>
<key>spaudio_controls</key>
<dict>
<key>_order</key>
<string>220</string>
</dict>
<key>spaudio_ismixable</key>
<dict>
<key>_order</key>
<string>130</string>
</dict>
<key>spaudio_newtype</key>
<dict>
<key>_order</key>
<string>200</string>
</dict>
<key>spaudio_num_inputs</key>
<dict>
<key>_order</key>
<string>40</string>
</dict>
<key>spaudio_num_outputs</key>
<dict>
<key>_order</key>
<string>50</string>
</dict>
<key>spaudio_oldtype</key>
<dict>
<key>_order</key>
<string>20</string>
</dict>
<key>spaudio_playthrough</key>
<dict>
<key>_order</key>
<string>230</string>
</dict>
<key>spaudio_pluginid</key>
<dict>
<key>_order</key>
<string>240</string>
</dict>
<key>spaudio_sample_rate</key>
<dict>
<key>_order</key>
<string>30</string>
</dict>
<key>spaudio_samplerates</key>
<dict>
<key>_order</key>
<string>140</string>
</dict>
<key>volumes</key>
<dict>
<key>_detailLevel</key>
<string>0</string>
</dict>
</dict>
<key>_timeStamp</key>
<date>2019-02-06T22:21:34Z</date>
<key>_versionInfo</key>
<dict>
<key>com.apple.SystemProfiler.SPAudioReporter</key>
<string>634.2</string>
</dict>
</dict>
</array>
</plist>
The important thing here is the coreaudio_default_audio_output_device and coreaudio_default_audio_input_device keys. They tell me what my current setup is. The channel configuration is also available.
On Linux, Alsa is very common. PulseAudio can be run on top of ALSA but also on top of other backends (see https://wiki.archlinux.org/index.php/PulseAudio) but i suspect ALSA is also common amongst PA users.
For ALSA it looks like you can simply look at the device name, there should be a device named "default", see https://www.alsa-project.org/main/index.php/DeviceNames#Multiple_sound_cards
Could you pull down no-input once more and give it another go? I'm replacing a negative value -1 with the string none to be more clear.
These both work:
shaden -device-in -1 -device-out 5 examples/frequency-modulation.lisp
shaden -device-in none -device-out 5 examples/frequency-modulation.lisp
i would suggest erroring on the first one. is -1 ever a valid value now?
question for device-out, does it ever make sense to specify none ? (or -1)? is shaden useful without an output device?
Agreed. I'll only allow it to be used for -device-in for now. I'll get this merged in and at some point look into default device lookup for each platform. I'll let you know when there's more to play with there.
:+1: