Audio out mode setting (CB for Banana Pi image)

18 33140
Post Last Edited by tony_zhang at 2014-5-4 16:17

There are two audio devices HDMI and headphone in the Banana Pi.
  1. sudo  alsamixer
Copy the Code
There are two audio devices named sunxi-sndhdmi and sunxi-CODEC in the system. The sound output is send out from HDMI by default . You can adjust volume and other configuration ,use Ctrl + z to save it.
To set sound care being sunxi-CODEC modify /etc/asound.conf to turn on the headphone.
  1. pcm.!default {
  2.     type hw
  3.     card 0    //If you want to set HDMI as output ,turn 0 to 1.
  4.     device 0
  5.   }
  6.   ctl.!default {
  7.     type hw
  8.     card 0   //If you want to set HDMI as output ,turn 0 to 1.
  9.   }
Copy the Code
If Plug in the headphone and type:
  1. speaker-test -twav -c2
Copy the Code
The sound "sound left,sound right,sound left" will output from headphone.

Let bananapi speak by package named espeak :
  1. sudo apt-get install espeak
  2. espeak "hello"            //say: hello
  3. espeak "hello_bananapi"  //say: hello banana pi
Copy the Code
Reply 1# tony_zhang
Hi guys,

tried to have the Banana Pi give audio via HDMI and came across your hints above. I started the AlsaMixer-tool but neither the F-Keys work properly (F4 gives me the help instead of F1 and all other F-keys seem to have no effect) nor can I change the sound-card, i.e. from sunxi-CODEC to the HDMI-output.
Why is that so? To me the SW appears to be v1.0.25 - any hints I have missed?

The raspberry-way with editing the config.txt obviously does not work.

Thanx and best regards

Hi, below an update:
I created /etc/asound.conf (not present in your distibution?) to turn on the headphone and in a second step I tried HDMI. After each code-change of asound.conf I rebooted but neither worked.
Code Step 1 was:

    pcm.!default {
        type hw
        card 0    //If you want to set HDMI as output ,turn 0 to 1.
        device 0
      ctl.!default {
        type hw
        card 0   //If you want to set HDMI as output ,turn 0 to 1.

Step 2 was

    pcm.!default {
        type hw
        card 1    //If you want to set HDMI as output ,turn 0 to 1.
        device 0
      ctl.!default {
        type hw
        card 1   //If you want to set HDMI as output ,turn 0 to 1.

Plugging in the earphones -or alternatively trying over HDMI- and issuing the command
speaker-test -twav -c2

gave me folowing error:
speaker-test 1.0.25

Playback device is default
Stream parameters are 48000Hz, S16_LE, 2 channels
WAV file(s)
ALSA lib pcm_hw.c:1466_snd_pcm_hw_open) Unknown field //If
Playback open error: -22,Invalid argument

I'm thankful for any help,
best regards Bjöern

Post Last Edited by Fab at 2014-9-8 17:45

I am struggling to get audio working too with hdmi (have not tried with speakers). I use Arch. In uEnv.txt I set

  1. hdmi.audio=1
Copy the Code
I type

  1. amixer cset numid=3 2
Copy the Code
but still no sound.

same for me, only sunxi-CODEC available in last Lubuntu

what does "cat /proc/asound/cards"  reveal?

Reply 6# sashijoseph

0 [sunxicodec     ]: sunxi-CODEC - sunxi-CODEC
                      sunxi-CODEC  Audio Codec
no hdmi driver present

Lubuntu 3.1.1. set card from 0 to 1.
-> sudo alsamixer not working anymore: Error while opening Mixer Device. File or directory not found.

What's wrong here?

Post Last Edited by Kulli at 2014-10-2 02:18


the method described in Post #1 doesn't work for me either. The file was already changed, but I cannot hear anything comming out of the headphones connector.
The only think which works is
  1. speaker-test -twav -c2
Copy the Code
but I cannot hear anything else.
What could be the problem? I am using Lubuntu 3.1.1.

I can not get any sound on this version either, I want it through the headphone jack this time.

You have to log in before you can reply Login | Sign Up

Points Rules