USB audio card on Raspberry Pi


First of all, sorry for my english !
I’m using fmodex to do real-time treatment on a raspberry pi. Thanks an USB audio card plug and play i added an audio input on the rpi. I installed correctly libraries and examples compiled. But when i run record.cpp nothing happens. Except this :

Record Example.
Copyright (c) Firelight Technologies 2004-2015.

Adjust LATENCY define to compensate for stuttering
Current value is 50ms

Press 1 to enable DSP effect
Press Q to quit

Adjusted playback latency: 2400 (50ms)
Current playback latency:    0 (0ms)
Record position:     0
Play Position:       0

Adjusted playback latency: 2400 (50ms) Current playback latency: 0 (0ms) Record position: 0 Play Position: 0

It’s like if the mic was not used :frowning: However the audio card is indexed in 0 and in record.cpp i was careful to set up DEVICE_INDEX to “0” …

Otherwise when i run the play_sound.cpp, the audio card’s headphone works properly. So if anybody has an idea i’ll be happy ^^.

If you want details as term output or whatever ask !

Thanks !


Thanks Mathew for your help. So, yes i guess it’s FMOD5 … I’m a bit lost (bad in english). This is the output when i run record.cpp

[LOG] SystemI::init                            : FMOD Studio Version: 00010603 (64399)
[LOG] SystemI::init                            : maxchannels = 100, flags = 00000000, extradriverdata = (nil)

[LOG] SystemI::close                           : 
[LOG] SystemI::close                           : Stop all sounds
[LOG] SystemI::close                           : Remove miscllaneous DSP stuff.
[LOG] SystemI::close                           : done.

[LOG] FMOD_OS_Init                             : Detected VFP instruction support, will use VFP optimized mixing and resampling.
[LOG] OutputALSA::registerLib                  : Loaded ALSA version 1.0.25.
[LOG] OutputALSA::enumerate                    : Found device NAME:null IOID:(null).
[LOG] OutputALSA::enumerate                    : Found device NAME:default:CARD=Set IOID:(null).
[LOG] OutputALSA::enumerate                    : Found device NAME:sysdefault:CARD=Set IOID:(null).
[LOG] OutputALSA::enumerate                    : Found device NAME:front:CARD=Set,DEV=0 IOID:(null).
[LOG] OutputALSA::enumerate                    : Found device NAME:surround40:CARD=Set,DEV=0 IOID:(null).
[LOG] OutputALSA::enumerate                    : Found device NAME:surround41:CARD=Set,DEV=0 IOID:(null).
[LOG] OutputALSA::enumerate                    : Found device NAME:surround50:CARD=Set,DEV=0 IOID:(null).
[LOG] OutputALSA::enumerate                    : Found device NAME:surround51:CARD=Set,DEV=0 IOID:(null).
[LOG] OutputALSA::enumerate                    : Found device NAME:surround71:CARD=Set,DEV=0 IOID:(null).
[LOG] OutputALSA::enumerate                    : Found device NAME:iec958:CARD=Set,DEV=0 IOID:(null).
[LOG] OutputALSA::enumerate                    : Found device NAME:default:CARD=ALSA IOID:Output.
[LOG] OutputALSA::enumerate                    : Found device NAME:sysdefault:CARD=ALSA IOID:Output.
[LOG] OutputALSA::init                         : Requested block size: 1024, Actual block size: 1024
[LOG] OutputALSA::init                         : Requested buffer size: 4096, Actual buffer size: 4096
[LOG] Thread::initThread                       : Initializing FMOD mixer thread.  priority 3
[LOG] Thread::initThread                       : - Stacksize 49152.  Stack pointer (nil) : usesemaphore = 0 : sleeptime = 0
[LOG] Thread::callback                         : * FMOD mixer thread started
[LOG] SystemI::init                            : Set up emulated output
[LOG] SystemI::init                            : create the channel pool
[LOG] SystemI::init                            : Set up streamer
[LOG] Thread::initThread                       : Initializing FMOD stream thread.  priority 2
[LOG] Thread::initThread                       : - Stacksize 65536.  Stack pointer (nil) : usesemaphore = 0 : sleeptime = 10
[LOG] Thread::callback                         : * FMOD stream thread started
[LOG] SystemI::createSoundInternal             : filename =  : mode 00000402
[LOG] SystemI::createSoundInternal             : exinfo->cbsize             = 140
[LOG] SystemI::createSoundInternal             : exinfo->length             = 96000
[LOG] SystemI::createSoundInternal             : exinfo->numchannels        = 1
[LOG] SystemI::createSoundInternal             : exinfo->defaultfrequency   = 48000
[LOG] SystemI::createSoundInternal             : exinfo->format             = 2
[WRN] File::open                               : File offset: 0 + length: 96000 > actual file size 0, truncating length.
[LOG] SystemI::createSoundInternal             : Format has 0 subsounds.
[LOG] SystemI::createSoundInternal             : Create as FMOD_CREATESAMPLE
[LOG] SystemI::createSoundInternal             : creating subsound 0/0
[LOG] SystemI::createSample                    : mode 00000402 length 48000 samples, lengthbytes 0
[LOG] SystemI::createSample                    : subsamples = 1, channels = 1
[LOG] SystemI::createSample                    : subsample 0.  output = 0x2e2a30
[LOG] OutputSoftware::createSample             : lengthpcm 48000, lengthbytes 0, channels 1, format 2, freq 48000, mode 0000040a
[LOG] SystemI::createSoundInternal             : No name found in file, use filename.
[LOG] SystemI::createSoundInternal             : done.  OpenState now = FMOD_OPENSTATE_READY.

[LOG] OutputALSA::recordStart                  : Requested block size: 1024, Actual block size: 1024
[LOG] OutputALSA::recordStart                  : Requested buffer size: 8192, Actual buffer size: 8192

In fact, i’ve already made a program for real-time treatment, who worked on rpi, but my SD card failed and i have to set up a new one and since that fail, impossible to do anything with FMOD. Then I was asking if i have to configure ALSA or pulseaudio or whatever in a certain way ?
What i don’t understand is the fact that with arecord or aplay my microphone/speaker works but not with FMOD. Is it possible it comes from my installation ?

Many thanks for your attention.

As FMOD4 doesn’t run on Raspberry Pi can I assume you mean FMOD5? Also, can you update your question with TTY output from the logging version of FMOD?

Thank you for the information, I will investigate ALSA recording in FMOD 5 on a clean Raspberry Pi install and report back my findings.

Thanks for your patience, there is indeed a bug with our implementation of ALSA recording and it has been fixed ready for our next release of all branches.