I’m trying to compile the audioInputExample from examples/sound, but I’m running into some issues opening the device. I have a small USB sound card with an external microphone attached and I can see the device listed by lsusb
:
Bus 001 Device 006: ID 0d8c:013c C-Media Electronics, Inc. CM108 Audio Controller
in OF however I’m getting this output:
[notice ] ofRtAudioSoundStream: device 0 hw:bcm2835 ALSA,0
[notice ] ofRtAudioSoundStream: maximum output channels 2
[notice ] ofRtAudioSoundStream: maximum input channels 0
[notice ] ofRtAudioSoundStream: -----------------------------------------
[notice ] ofRtAudioSoundStream: device 1 hw:bcm2835 ALSA,1
[notice ] ofRtAudioSoundStream: maximum output channels 2
[notice ] ofRtAudioSoundStream: maximum input channels 0
[notice ] ofRtAudioSoundStream: -----------------------------------------
[notice ] ofRtAudioSoundStream: device 2 hw:USB PnP Sound Device,0
[notice ] ofRtAudioSoundStream: maximum output channels 2
[notice ] ofRtAudioSoundStream: maximum input channels 1
[notice ] ofRtAudioSoundStream: -----------------------------------------
RtApiAlsa::getDeviceInfo: snd_pcm_open error for device (default), No such file or directory.
[notice ] ofRtAudioSoundStream: device 3 default
[notice ] ofRtAudioSoundStream: maximum output channels 10000
[notice ] ofRtAudioSoundStream: maximum input channels 0
[notice ] ofRtAudioSoundStream: -----------------------------------------
RtApiAlsa::getDeviceInfo: snd_pcm_open error for device (default), No such file or directory.
[notice ] ofAppEGLWindow: runAppViaInfiniteLoop(): setting up notifications complete
-nan
-nan
-nan
-nan
-nan
-nan
-nan
-nan
-nan
-nan
-nan
-nan
-nan
-nan
I noticed the USB sound card is at index 2 and there is a single audio input channel so I setup like this:
soundStream.setDeviceID(2);
soundStream.setup(this, 0, 1, 44100, bufferSize, 4);
(where bufferSize is 256)
I see -nan when printing scaledVol
to the console and I’m not sure where I’m going wrong.
I’m guessing the right sound card is chosen and opened, but maybe other settings (sample/rate/etc. are wrong) ?
Has anyone else came across a similar situation ? How can I use an external mic with on a basic usb sound card on Raspberry PI 2 with OF ?