Hi there,
I've been working on some voice recognition projects with Wolfson and Raspberry Pi. The project uses gstreamer and pocketsphinx.
My .asoundrc includes the modifications listed in the comments here:
Raspberry Pi and Karaoke Machine (Wolfson Pi Use and its Limitation)
The modified .asoundrc (included below) frees up the Wolfson for more use cases but I'm getting an error testing the pocketsphinx_continuous command. Here's the command I'm using:
Command:
pocketsphinx_continuous -verbose yes -adcdev hw:0 -hmmusr/local/share/pocketsphinx/model/hmm/wsj1 -lm lm -dict dic
The error:
Failed to set PCM device to mono: Invalid argument FATAL_ERROR: "continuous.c", line 246: Failed to open audio device
This is the closest I've gotten. Ideas appreciated!
.asoundrc
#######################################################################
#
# 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
}





