element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      • Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Vietnam
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Raspberry Pi
  • Products
  • More
Raspberry Pi
Raspberry Pi Forum Wolfson and pocketsphinx_continuous - error
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Raspberry Pi to participate - click to join for free!
Featured Articles
Announcing Pi
Technical Specifications
Raspberry Pi FAQs
Win a Pi
Raspberry Pi Wishlist
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • Replies 3 replies
  • Subscribers 675 subscribers
  • Views 482 views
  • Users 0 members are here
  • wolfson
  • pocketsphinx
  • raspberry_pi
  • raspberrypi
  • raspeberry_pi_accessories
Related

Wolfson and pocketsphinx_continuous - error

willondubs
willondubs over 11 years ago

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
}

  • Sign in to reply
  • Cancel
Parents
  • Former Member
    Former Member over 11 years ago

    That's my .asoundrc image

     

    I have no idea whatsoever what pocketsphinx is all about, but  the words

    -adcdev hw:0

    in your command line looks suspicious.

    hw:0 is ALSA's name for the physical sound card, so it looks like you're actually overriding the resampling goodness in .asoundrc.

    I would first try without the -adcdev parameter, and if that doesn't work with "default", "pduplex" or "sysdefault" instead of "hw:0".

    --

    Ragnar

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • willondubs
    willondubs over 11 years ago in reply to Former Member

    Hi Ragner,

     

    I recently acquired a USB microphone. I'm wondering if you could help me modify your .asoundrc solution to have the USB mic as the default capture device on the Pi. If so...

     

    This arecord command is required:

    arecord -D hw:2 -f S16_LE test.wav

    output:

    Recording WAVE 'test.wav' : Signed 16 bit Little Endian, Rate 8000 Hz, Mono

     

    Ideally, I'd just be able to arecord test.wav and have it come from the USB Mic. Hoping S16_LE can be default.

     

    Thanks!

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Reply
  • willondubs
    willondubs over 11 years ago in reply to Former Member

    Hi Ragner,

     

    I recently acquired a USB microphone. I'm wondering if you could help me modify your .asoundrc solution to have the USB mic as the default capture device on the Pi. If so...

     

    This arecord command is required:

    arecord -D hw:2 -f S16_LE test.wav

    output:

    Recording WAVE 'test.wav' : Signed 16 bit Little Endian, Rate 8000 Hz, Mono

     

    Ideally, I'd just be able to arecord test.wav and have it come from the USB Mic. Hoping S16_LE can be default.

     

    Thanks!

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Children
No Data
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube