ALSA Card for Respeaker 4-Mic Setup - audio

During the installation, we are supposed to check the sound card by pressing ‘arecord -L’ to obtain a certain output like shown below,
pi#raspberrypi:~ $ arecord -L
null
Discard all samples (playback) or generate zero samples (capture)
jack
JACK Audio Connection Kit
pulse
PulseAudio Sound Server
default
playback
ac108
sysdefault:CARD=seeed4micvoicec
seeed-4mic-voicecard,
Default Audio Device
dmix:CARD=seeed4micvoicec,DEV=0
seeed-4mic-voicecard,
Direct sample mixing device
dsnoop:CARD=seeed4micvoicec,DEV=0
seeed-4mic-voicecard,
Direct sample snooping device
hw:CARD=seeed4micvoicec,DEV=0
seeed-4mic-voicecard,
Direct hardware device without any conversions
plughw:CARD=seeed4micvoicec,DEV=0
seeed-4mic-voicecard,
Hardware device with all software conversions
usbstream:CARD=seeed4micvoicec
seeed-4mic-voicecard
USB Stream Output
usbstream:CARD=ALSA
bcm2835 ALSA
USB Stream Output
However, the output that I have received is as shown below,
Screenshot of Output
It basically shows that I don’t have the ALSA soundcard, and I cant move on to the sound localization process. Please show how can I move forward, thanks!

Related

How to debug a Linux I2S audio input issue

I am trying, and failing, to connect an I2S microphone (Invensense ICS43432) to my Raspberry Pi (B+) running Arch Linux. I have asked for specific advice in the relevant Arch Linux ARM forum but my question is really more general than that: how does one go about debugging Linux audio input issues?
I have verified with a logic analyser that the I2S microphone is sending sensible data in the correct channel (left) and the correct pin of the Raspberry Pi. The I2S microphone appears under ALSA as a "sound card". arecord is perfectly happy to record from that device and I have boosted the gain of that device using alsamixer by 30 dB. Yet all the data bytes of the recorded file are zero.
How does one go about checking the flow of audio data, the operation of DMA, under Linux?
I had the same problem trying to record in stereo, using 2 Adafruit I2S MEMS breakout mics: arecord worked fine, but zeros when using ALSA to write to a bin file. Choosing a 32 bit word format (Little Endian 32 bits, Signed) made it work. Only I end up with 64 bit stereo Frames.

Trying to stream audio from USB recording device

I'm trying to use libusb-1.0 to pull audio samples through an isochronous transfer on a USB recording device. I imagined that for an isochronous transfer this would be easy, i.e. no control transmissions needed, just connect and read from the designated interface, but what I'm reading appears to be device information. (See the hexdump below. See source code file on pastebin.)
So my question is how do I stream audio from a USB device? (I've read USB In a Nutshell. I've confirmed that the interface, alternate setting, and endpoint I'm using are for Isochronous OUT by using lsusb -v. See pastebin for full device information.) I don't think that I need to (or can) send any control signals to alter the configuration of clocks/channels/interrupts because the control interface has no endpoints (as you can see in the foregoing link).
Here's the "character" portion of the top of a hexdump -C from the packets I captured with libusb-1.0. (See the whole hexdump at pastebin):
................................14.0/usb2/2-3.2-0:1.0...........
`.......x.......................1d.0/usb1/1-1/1-1:1.0.1.5:1.0...
`.......x.......`.......0.......................b2/2-0:1.0......
0.......1........!..............................14.0/usb2/2-0:1.
0...............................#.............DEVTYPE.usb_inte
rface.DRIVER.hub.PRODUCT.1d6b/2/404.TYPE.9/0/0.INTERFACE.9/0/0.M
ODALIAS.usb:v1D6Bp0002d0404dc09dsc00dp00ic09isc00ip00in00.......
................................................................
...............................................DEVTYPE.usb_inte
rface.DRIVER.hub.PRODUCT.1d6b/3/404.TYPE.9/0/3.INTERFACE.9/0/0.M
ODALIAS.usb:v1D6Bp0003d0404dc09dsc00dp03ic09isc00ip00in00.......
................*................................14.0/usb2/2-3.2-
0:1.0...........`.......x.......................1d.0/usb1/1-1/1-
1:1.0.1.5:1.0...`.......x.......`.......0.......................
b2/2-0:1.0......0.......1........!..............................
14.0/usb2/2-0:1.0...............................* # ....... ......

Setting channel volume in ALSA

My app plays raw PCM audio data through various channels using ALSA. I'm allocating a new audio channel by using snd_pcm_open(), then setting the PCM format via the snd_pcm_hw_params_xxx() calls and finally feeding raw PCM audio data to ALSA by using the snd_pcm_writei() API.
This is all working fine so far but I haven't found any way to tell ALSA to reduce the volume of a sound channel allocated in the way outlined above. Of course, I could just manually apply volume scaling to the PCM data before sending it to ALSA via snd_pcm_writei() but is there really no way to have ALSA do this on its own?
ALSA has no such function.
You have to do the scaling yourself, or use a sound server like PulseAudio.
You can via amixer:
amixer cset name='Headphone Playback Volume' 98%,100%
To get the name value - check alsamixer, appending 'Playback Volume' to each.
And via alsamixer:
Keyboard z is left channel decrease.
q is left increase.
and
c is right decrease.
e is right increase

Set one device for output and another one for input in Raspberry Pi

I added an USB Microphone to my Raspberry Pi, but now I cannot play sounds thru Nodes.js, me:
[../deps/mpg123/src/output/alsa.c:165] error: cannot open device default
I guess it's because it's trying to play the sound thru the USB Microphone, because I set: options snd-usb-audio index=0 in order to user the Microphone.
So, my question is: Is there any way to tell ALSA which device it should use for output and which device it should use for input. I'm trying to use the USB for input and the 3.5mm jack for output.
Thank you in advance.
The Speaker module does not allow to configure its output device.
You could set the internal device as the default device, and configure your recording applications to use the USB microphone.
Alternatively, try a definition like the following in /etc/asound.conf:
pcm.default {
type asym
playback.pcm "plughw:1" # or dmix for software mixing
capture.pcm "plughw:0"
}

With Python/PySide/PyQt/Phonon how to control a USB Soundcards output sample clock rate?

I am trying to O/P audio to a USB soundcard (Lindy PnP SoundCard device) via Python/PySide/PyQT by the use of Phonon and/or QTMultimedia.
I can O/P the aduio (mp3/wav) which is no problem - the issue is that I want to control the USB's output sample clock rate, I need to be able to change this from 44.1 to 48 kHz. The soundcard comes with its own s/w that allows this so it is possible.
I can play Audio through Phonon like so..
self.mediaObj=phonon.Phonon.MediaObject(self)
self.audioSink=Phonon.AudioOutput(Phonon.MusicCategory, self)
self.audioPath=Phonon.createPath(self.mediaObj, self.audioSink)
self.audioSink.setVolume(0.3)
However I do not see any way to change the sample clock rate of the USB device from looking at the Class Reference doc's it seems its not possible.
http://www.pyside.org/docs/pyside/PySide/phonon/index.html
So then I have tried to use Qt Multimedia to change the USB soundcards O/P clock rate..
format = QtMultimedia.QAudioFormat()
format.setChannels(2)
format.setFrequency(44100)
format.setSampleSize(16)
format.setByteOrder(QtMultimedia.QAudioFormat.LittleEndian)
format.setSampleType(QtMultimedia.QAudioFormat.SignedInt)
This has no effect. Does anyone know how I would do this and if it is even possible with Phonon/PyQT? I am guessing I need to go lower and try find the USB Soundcard directly which will be messy..
Much appeciate any help!!
Alan

Resources