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 Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • 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
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • 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 Cirrus Logic Audio Card does not recognize single-channel mono files
  • 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 8 replies
  • Subscribers 663 subscribers
  • Views 603 views
  • Users 0 members are here
  • problems
  • raspberry_pi
  • raspeberry_pi_accessories
  • cirrus logic audio card
Related

Cirrus Logic Audio Card does not recognize single-channel mono files

chema_at
chema_at over 9 years ago

Hello,

 

It is true that the Cirrus Logic Audio Card does not recognize
single-channel mono files?

Is there any solution to play a mono file?

 

I have made the following test using the following mono
file:

/usr/share/sounds/alsa/Front_Center.wav

 

I have made the following test:

root@raspberrypi:/home/pi# ./Playback_to_Lineout.sh

 

root@raspberrypi:/home/pi# aplay -Dhw:sndrpiwsp -r
48000 -c 1 -f S16_LE Front_Center.wav

Playing WAVE 'Front_Center.wav' : Signed 16 bit Little
Endian, Rate 48000 Hz, Mono

aplay: set_params:1087: Channels count non available

 

root@raspberrypi:/home/pi# aplay -Dhw:sndrpiwsp -r
48000 -c 2 -f S16_LE Front_Center.wav

Playing WAVE 'Front_Center.wav' : Signed 16 bit Little
Endian, Rate 48000 Hz, Mono

aplay: set_params:1087: Channels count non available

 

On the other hand, the same file has been reproduced
with the application Audacity , on the same channel (Line Out), and the file
has been reproduced correctly.

In theory if it works with this application would also
have to work with commands.

 

Thanks in advance

  • Sign in to reply
  • Cancel
  • hiassoft
    hiassoft over 9 years ago

    Use aplay -Dplughw:... instead of -Dhw:...

     

    Plughw is the default alsa "filter" and will do automatic sample rate / format conversions. Usually you want to have that instead of hw:... If you run aplay without the -D option it'll use plughw with the first card. So if you disabled the onboard audio (or made sure the cirrus card is fixed at index 0) you can use just aplay file.wav.

     

    BTW: you might need to enable the i2s-mmap overlay, IIRC plughw needs this.

     

    so long,

     

    Hias

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • chema_at
    chema_at over 9 years ago in reply to hiassoft

    Hello Matthias,


    If I use  -Dplughw  the result it the following:

     


    Test1: Mono file.  It setup one channel (-c  1). It doesn´t work.

     

    root@raspberrypi:/home/pi# aplay -Dplughw:sndrpiwsp -r 44100 -c 1 -f S16_LE Front_Center.wavPlaying WAVE 'Front_Center.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Mono
    aplay: set_params:1145: Unable to install hw params:
    ACCESS:  RW_INTERLEAVED
    FORMAT:  S16_LE
    SUBFORMAT:  STD
    SAMPLE_BITS: 16
    FRAME_BITS: 16
    CHANNELS: 1
    RATE: 48000
    PERIOD_TIME: 125000
    PERIOD_SIZE: 6000
    PERIOD_BYTES: 12000
    PERIODS: 4
    BUFFER_TIME: 500000
    BUFFER_SIZE: 24000
    BUFFER_BYTES: 48000
    TICK_TIME: 0

     

     

    Test2: Mono file.  It is setup Two channel  (-c  2). It doesn´t work.


    root@raspberrypi:/home/pi# aplay -Dplughw:sndrpiwsp -r 44100 -c 2 -f S16_LE Front_Center.wav
    Playing WAVE 'Front_Center.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Mono
    aplay: set_params:1145: Unable to install hw params:
    ACCESS:  RW_INTERLEAVED
    FORMAT:  S16_LE
    SUBFORMAT:  STD
    SAMPLE_BITS: 16
    FRAME_BITS: 16
    CHANNELS: 1
    RATE: 48000
    PERIOD_TIME: 125000
    PERIOD_SIZE: 6000
    PERIOD_BYTES: 12000
    PERIODS: 4
    BUFFER_TIME: 500000
    BUFFER_SIZE: 24000
    BUFFER_BYTES: 48000
    TICK_TIME: 0

     

     

    Test3: Stereo file.  It setup two channel  (-c  2). It working .


    root@raspberrypi:/home/pi# aplay -Dplughw:sndrpiwsp -r 44100 -c 2 -f S16_LE Track_8s_32bits_44100Hz_stereo_2C.wav
    Playing WAVE 'Track_8s_32bits_44100Hz_stereo_2C.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo

     


    I think that the audio card is correctly installed. My problem is when the audio file is single-channel mono, but when the audio reproduced is stereo (two-channel) , I don't have problem.
    I would like to known if it is possible to play a mono file? and in this case, the right way to follow.


    Best regards,


    Jose

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • hiassoft
    hiassoft over 9 years ago in reply to chema_at

    You don't seem to have mmap enabled. Are you sure you have "dtoverlay=i2s-mmap" in config.txt and it's working correctly?

     

    Check with "aplay -Dhw:sndrpiwsp --dump-hw-params file.wav", at the very beginning you should see this line:

     

    ACCESS:  MMAP_INTERLEAVED RW_INTERLEAVED

     

    so long,

     

    Hias

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • chema_at
    chema_at over 9 years ago in reply to hiassoft

    Thanks for the answer.

     

    But this it mean that it is possible to play single-channel mono files?.

    I'm no expert in raspberry and I don´t understand the purpose of these changes.

     

    On the other hand, I have tested the file   /boot/config.txt , and doesn´t has the line dtoverlay=i2s-mmap

     

    File config.txt

    # For more options and information see

    # http://www.raspberrypi.org/documentation/configuration/config-txt.md

    # Some settings may impact device functionality. See link above for details

    # uncomment if you get no picture on HDMI for a default "safe"
    mode

    #hdmi_safe=1

    # uncomment this if your display has a black border of unused pixels
    visible

    # and your display can output without overscan

    #disable_overscan=1

    # uncomment the following to adjust overscan. Use positive numbers if
    console

    # goes off screen, and negative if there is too much border

    #overscan_left=16

    #overscan_right=16

    #overscan_top=16

    #overscan_bottom=16

    # uncomment to force a console size. By default it will be display's size
    minus

    # overscan.

    #framebuffer_width=1280

    #framebuffer_height=720

    # uncomment if hdmi display is not detected and composite is being output

    #hdmi_force_hotplug=1

    # uncomment to force a specific HDMI mode (this will force VGA)

    #hdmi_group=1

    #hdmi_mode=1

     

    # uncomment to force a HDMI mode rather than DVI. This can make audio work
    in

    # DMT (computer monitor) modes

    #hdmi_drive=2

    # uncomment to increase signal to HDMI, if you have interference, blanking,
    or

    # no display

    #config_hdmi_boost=4

    # uncomment for composite PAL

    #sdtv_mode=2

    #uncomment to overclock the arm. 700 MHz is the default.

    arm_freq=900

    core_freq=250

    sdram_freq=450

    over_voltage=2

    dtoverlay=rpi-cirrus-wm5102-overlay

     

    I have added in the file config.txt the commad:  dtoverlay=i2s-mmap and I have rebooted the raspberry

     

    Also, I have executed the command    aplay --dump-hw-params and the result it the following

     

    pi@raspberrypi /var/www $ aplay -Dhw:sndrpiwsp --dump-hw-params  file.wav

    aplay: unrecognized option '--dump-hw-params'

    Try `aplay --help' for more information.

    pi@raspberrypi /var/www $ aplay -Dhw:sndrpiwsp --dump-hw-params -r 44100 -c 2 -f S16_LE Muestra02_8s_32bits_44100Hz_mono_1C.wav

    aplay: unrecognized option '--dump-hw-params'

    Try `aplay --help' for more information.

     

    With aplay -h , doesn´t appears information about the --dump

     

     

    Why appeard the message aplay: unrecognized option '--dump-hw-params' .   Is it problem of versions?

     

    Best regards,

    Jose

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • hiassoft
    hiassoft over 9 years ago in reply to chema_at

    Hi Jose!

    With aplay -h , doesn´t appears information about the --dump

     

     

    Why appeard the message aplay: unrecognized option '--dump-hw-params' . Is it problem of versions?

    Indeed, you seem to be running an old version (--dump-hw-params only works with the current Raspbian Jessie version).

     

    Could you enter "uname -a" to check which kernel version you are running? If that's an old one too it might not support i2s-mmap at all - so no chance of getting mono playback working with it.

     

    The best solution would be to do a fresh Raspbian Jessie installation, make sure you are running kernel 4.4 and then follow the instructions on my webpage (install kernel 4.4 with cirrus drivers)

    http://www.horus.com/~hias/cirrus-driver.html

     

    Then everything should work out of the box.

     

    so long,

     

    Hias

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • chema_at
    chema_at over 9 years ago in reply to hiassoft

    Hello  Hias,

     

    Thank you for your answer.

     

    I am going to work in the installation of kernell  version 4.4. 

     

    My current version of Kernel is: 3.18

    pi@raspberrypi ~ $ uname -a  

    Linux raspberrypi 3.18.9-v7+ #2 SMP PREEMPT Mon Mar 23 20:25:20 GMT 2015 armv7l GNU/Linux

     

    On the other hand:

    I have a Raspberry Pi 2 Model B.   (Model B)   ¿Is it necessary to buy the raspberry 3 (model B)?

     

    My current image was downloaded  from (this is the image indicated by Fannel):

    http://downloads.element14.com/downloads/cirrus/cirrus_logic_audio_card_all_pi_versions.zip?ICID=CirrusLogicAudio-topMain-firmware&COM=CirrusLogicAudioCard

     

    I want to clarify that when indicated I need to play single-channel mono file, this file has only signal in one channel, and not the same signal for two channels.

     

    Best regards,

    Jose

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • hiassoft
    hiassoft over 9 years ago in reply to chema_at

    On the other hand:

    I have a Raspberry Pi 2 Model B. (Model B) ¿Is it necessary to buy the raspberry 3 (model B)?

    It doesn't make too much difference. RPi3 is a little bit faster and has WiFi+Bluetooth on board. If you don't need these the RPi2 will do just fine.

    My current image was downloaded from (this is the image indicated by Fannel):

    OK, this explains everything image That image is outdated and comes with a buggy driver. Better use the kernel from my website on top of standard Raspbian. I've fixed the most annoying driver bugs and made sure it also works with RPi3.

    I want to clarify that when indicated I need to play single-channel mono file, this file has only signal in one channel, and not the same signal for two channels.

    That's also how I understood your question.

     

    BTW: The same happens with most PC soundcards. Usually the hardware is limited to 2 channels (minimum) and the default ALSA plugin has to upmix mono to stereo and do samplerate conversions (early AC97 cards only support 48kHz for example). If you try to play a mono file on a Linux PC using -Dhw:0 you usually get the same errors.

     

    so long,

     

    Hias

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • chema_at
    chema_at over 9 years ago in reply to hiassoft

    Thank you so much Mattias. It is working now.

     

    I have installed the version 4.4.6 and now I can to play and record a single-channel mono file.

     

    I followed the steps  (http://www.horus.com/~hias/cirrus-driver.html )

     

    In my case,  I executed the following steps

     

    1) To start a Root session.

    2) I have download the file cirrus-linux-4.4.6.tgz.

    3) I have copy this file in /root

    4) It is executed  the following  comand

    root@raspberrypi ~ $ sudo tar zxf cirrus-linux-4.4.6.tgz -C /

    5) Add the following line to /boot/config.txt

    dtoverlay=rpi-cirrus-wm5102

    dtoverlay=i2s-mmap

    Note: It is deleted the "overlay" in the line:  dtoverlay=rpi-cirrus-wm5102-overlay

     

     

    6) Create a file /etc/modprobe.d/cirrus.conf with the following content:

    softdep arizona-spi pre: arizona-ldo1

    softdep spi-bcm2708 pre: fixed

    softdep
    spi-bcm2835 pre: fixed

     

    7)Download and install "usecase" scripts in /home/pi/bin.

    wget http://www.horus.com/~hias/tmp/cirrus/usecase-scripts.tgz

    mkdir bin

    cd bin

    tar zxf
    ../usecase-scripts.tgz

     

    8)Disable RPi on-board audio device snd-bcm2835

    In my case, doesn't was necessary. It was disabled.

     

    9) Disable Raspbian kernel updates.

    sudo apt-mark hold raspberrypi-bootloader

     

     

    8) Updating the GPU firmware.  It is executed  the following  comand

    sudo SKIP_KERNEL=1 rpi-update

     

    9) Reboot  the system.

     

    Test:

    pi@raspberry ~$ ./Playback_to_Lineout.sh

    pi@raspberry ~$ aplay -Dplughw:sndrpiwsp -r 8000 -c 1 -f S16_LE mono_file_1C.wav

     

    The file was play correctly.

     

     

    Thanks again Mattias.

     

    Regards

     

    Jose.

    • 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