I have tested recording and playback with my wolfson audio card, and both work fine. The problem is, when I try to use pocketsphinx with the card, it gives this error:
"Failed to set PCM device to mono: Invalid argument
FATAL: "continuous.c", line 239: Failed to open audio device"
It may problem with the .asoundrc or another hidden config file...
I found this .asoundrc file on the internet that supposedly works with the wolfson:
- #######################################################################
- #
- # Use libsamplerate instead of internal resampler.
- # You might have to: sudo apt-get install libasound2-plugins
- # Or just comment out the next line if the internal one is good enough for your needs.
- defaults.pcm.rate_converter "samplerate"
- ######################################################################
- #
- # Wolfson Audio Card for Raspberry Pi
- #
- pcm.wolfson_pi_soundcard {
- type hw
- card sndrpiwsp
- device 0
- }
- # Create a Master volume control
- pcm.softvol {
- type softvol
- slave {
- pcm "pduplex"
- }
- control {
- name "Master"
- card 0
- }
- }
- pcm.!default {
- type asym
- playback.pcm "plug:softvol"
- capture.pcm "pduplex"
- }
- #####################################################################
- #
- # Mixing and resampling goodness :-)
- #
- # Several clients can record and play back simultaneously.
- # The dmix and dsnoop plugins operate at 48kHz by default, i.e. the sound card will be kept at 48kHz at all times.
- # All playback streams are converted to 2 channels/48kHz/16bit.
- # All recording streams are converted from the card's 2 channels/48kHz/16bit
- # to the requested number of channels, sample rate and bit depth.
- # We define one pcm device called "playmixer" for playback.
- pcm.playmixer {
- ipc_key 140324 # Any number will do, as long as it's unique in the system.
- ipc_key_add_uid true
- type dmix
- slave.pcm "wolfson_pi_soundcard"
- }
- # Define another one called "recmixer" for capture.
- # The sound card will run at 48kHz and input is resampled to the requested rate.
- pcm.recmixer {
- ipc_key 140325
- ipc_key_add_uid true
- type dsnoop
- slave.pcm "wolfson_pi_soundcard"
- }
- # Define a duplex device, with both in- and outputs.
- pcm.duplex {
- type asym
- playback.pcm "playmixer"
- capture.pcm "recmixer"
- }
- # Add a "plug" plugin for the above "duplex" device.
- # This is where all the converting takes place.
- # Sample rate, number of channels, bit depth.
- # By the way, who thought that "plug" was a good name for a plugin?
- #
- # Use this device for all your playback and recording resampling needs.
- pcm.pduplex {
- type plug
- slave.pcm "duplex"
- }
- # A ctl device to keep xmms happy
- ctl.pduplex {
- type hw
- card 0
- }
- # A DSP to keep the alsa-oss layer happy:
- pcm.dsp0 {
- type plug
- slave.pcm "duplex"
- }
- ctl.mixer0 {
- type hw
- card 0
- }
Why is the wolfson not working with pocketsphinx when it worked when I recorded .wav files?




