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 Issues with arecord command
  • 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 4 replies
  • Subscribers 675 subscribers
  • Views 4335 views
  • Users 0 members are here
  • logic
  • audio
  • cirrus
  • raspberry_pi
  • raspberrypi
  • record
  • raspeberry_pi_accessories
Related

Issues with arecord command

maxj345
maxj345 over 10 years ago

I'm not sure if it's related to the card (maybe I installed it wrong or something), but I was wondering if anyone on here could help me out.

I'm having some mixed results with the arecord command in the terminal. The hardware I'm using consists of the Cirrus Audio Card for the Raspberry Pi. I'm trying to record a 24-bit 192kHz sound (from the onboard MIC) into a WAV file, and then play it back (through the headeset). First I make sure to enable the MIC and headset:

 

$ ./Record_from_DMIC.sh

$ ./Playback_to_Headset.sh

 

Then I tried multiple commands, and got mixed results.

 

$ arecord -f S24_LE -r 192 -d 20 test.wav

Recording WAVE 'test.wav' : Signed 24 bit Little Endian, Rate 192000 Hz, Mono

$ arecord: set_params:1087: Channels count non available

# So I set the number of channels to 1 (even though it is that, by default)

$ arecord -c 1 -f S24_LE -r 192 -d 20 test.wav

Recording WAVE 'test.wav' : Signed 24 bit Little Endian, Rate 192000 Hz, Mono

arecord: set_params:1087: Channels count non available

 

Still get the same error. I got rid of the rate (192kHz), and let it default:

 

$ arecord -d 10 -c 1 -f S24_LE -t wav test.wav

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

$ arecord: set_params:1087: Channels count non available

 

Still getting the same error. So I just used an example run of the command I found online (http://linux.die.net/man/1/arecord):

 

$ arecord -d 10 -f cd -t wav test.wav

Recording WAVE 'test.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo

 

This worked. But clearly used different values than from what I wanted. I also had trouble playing at 192kHz:

 

$ aplay -c 1 -r 192000 test.wav

Playing WAVE 'test.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo

 

I try to play at 192kHz, but it goes down to 44.1kHz. Does anyone have any idea as to why I'm getting all these weird errors and results?

  • Sign in to reply
  • Cancel
  • Former Member
    Former Member over 10 years ago

    The card is stereo (2 channels) only, but arecord defaults to mono (1 channel).

    That's why you get the "Channels count non available" error. Arecord tries to record only one channel, but the card can't do that.

    You have to have  -c 2 on the arecord command line.

     

    The example you found online uses -f cd, which is shorthand for -f S16_LE -c2 -r44100, i.e. CD quality.

    Thus, your recorded "test.wav" file is 16-bit, 44.1kHz stereo and that is what aplay will use to play it back.

    --

    Ragnar

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • Cancel
  • maxj345
    maxj345 over 10 years ago in reply to Former Member

    It worked! Thank you very much!

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

    hello friend's,

    i have one problem related to arecord command any one knows solution for these

     

    pi@raspberrypi ~/Desktop $ arecord -d 10 -f cd -t wav test.wav

    arecord: main:682: audio open error: No such file or directory

    pi@raspberrypi ~/Desktop $

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

    Rafiq

     

    It looks as if your card may not be initialised.  Did you first run:

    ./Record_from_lineIn.sh

     

    The command

    arecord -L

    will report the available audio devices.  You should see something like

    default:CARD=sndrpiwsp

        snd_rpi_wsp,

        Default Audio Device

    sysdefault:CARD=sndrpiwsp

        snd_rpi_wsp,

        Default Audio Device

     

    Good luck -- Ross

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
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