Getting analog audio/sound to work (headphones socket) on debian
#1
Music 
Hi,

I've finally started playing with my Pine64+ board, and have been able to get both ubuntu and debian systems up and running thanks to the great work by longsleep and lenny. I am setting up a headless system which will probably be a lightweight webserver / database server for sensors and a few other bits and pieces... not 100% sure yet. However, in the meantime, since I have it sat on my desk atm, I thought it would be fun to hook it up to some internet radio, and let it do that for a while... but how do I get the audio to work? I don't have anything plugged into the HDMI, so can't use that for audio. And nothing seems to be coming out of the headphones jack, although mplayer seems to be playing fine, bar an error about the output device!!!

I started with the Debian Base (3.10.65 BSP) image, and applied the Debian Base (3.10.65 BSP) rootfs (although I suspect I didn't actually need too! Rolleyes ) from pine64.pro. I then updated uboot and the kernel with the included scripts. I setup my wireless connection, and ditched the eithernet cord. I changed the built-in user, and have SSH working. So everything else seems to be working so far. I noticed there was a mplayer-play script, but didn't even let mplayer run - mplayer stops due to no hardware device (e.g.  /usr/local/sbin/mplayer-play.sh http://80.237.154.83:8120), whereas a simple mplayer http://80.237.154.83:8120 at least comes back with errors. Does anyone have any thoughts what I should do... is there something else I need to install or configure, or is this one of those "it doesn't work yet" bits? I came across another thread, but it didn't have any useful information anymore as links seem to have changed... I tried installing the alsa-tools alsa-utils libsound2 etc but that didn't send to help... I haven't tried adding pulseaudio yet.

Thanks in advance,
Pete


Code:
Connecting to server 80.237.154.83[80.237.154.83]: 8120...
Name   : Radio Landsberg International from Germany: Inter-cultural & multi-lingual
Genre  : International
Website: http://www.radiolandsberg.international
Public : yes
Bitrate: 128kbit/s
Cache size set to 320 KiB
Cache fill:  0.00% (0 bytes)
Detected file format: Audio only
Selected audio codec: MPEG 1.0/2.0/2.5 layers I, II, III [mpg123]
AUDIO: 44100 Hz, 2 ch, s16le, 128.0 kbit/9.07% (ratio: 16000->176400)
AO: [pulse] Init failed: Connection refused
[AO_ALSA] alsa-lib: confmisc.c:768:(parse_card) cannot find card '0'
[AO_ALSA] alsa-lib: conf.c:4259:(_snd_config_evaluate) function snd_func_card_driver returned error: No
 file or directory
[AO_ALSA] alsa-lib: confmisc.c:392:(snd_func_concat) error evaluating strings
[AO_ALSA] alsa-lib: conf.c:4259:(_snd_config_evaluate) function snd_func_concat returned error: No such
 or directory
[AO_ALSA] alsa-lib: confmisc.c:1251:(snd_func_refer) error evaluating name
[AO_ALSA] alsa-lib: conf.c:4259:(_snd_config_evaluate) function snd_func_refer returned error: No such f
or directory
[AO_ALSA] alsa-lib: conf.c:4738:(snd_config_expand) Evaluate error: No such file or directory
[AO_ALSA] alsa-lib: pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM default
[AO_ALSA] Playback open error: No such file or directory
[AO OSS] audio_setup: Can't open audio device /dev/dsp: No such file or directory
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
[JACK] cannot open server
[AO SDL] Samplerate: 44100Hz Channels: Stereo Format s16le
[AO_ALSA] alsa-lib: confmisc.c:768:(parse_card) cannot find card '0'
[AO_ALSA] alsa-lib: conf.c:4259:(_snd_config_evaluate) function snd_func_card_driver returned error: No
 file or directory
[AO_ALSA] alsa-lib: confmisc.c:392:(snd_func_concat) error evaluating strings
[AO_ALSA] alsa-lib: conf.c:4259:(_snd_config_evaluate) function snd_func_concat returned error: No such
 or directory
[AO_ALSA] alsa-lib: confmisc.c:1251:(snd_func_refer) error evaluating name
[AO_ALSA] alsa-lib: conf.c:4259:(_snd_config_evaluate) function snd_func_refer returned error: No such f
or directory
[AO_ALSA] alsa-lib: conf.c:4738:(snd_config_expand) Evaluate error: No such file or directory
[AO_ALSA] alsa-lib: pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM default
[AO SDL] Unable to open audio: No available audio device
AO: [null] 44100Hz 2ch s16le (2 bytes per sample)
Video: no video
Starting playback...
A:   2.2 (02.1) of -0.0 (unknown)  0.7% 35%
ICY Info: StreamTitle='Dick Charlesworth _ His City Gents - That_s When I_ll Come Back To You';StreamUrl
tp://www.radiolandsberg.international';
A:  41.2 (41.2) of -0.0 (unknown)  0.6% 45%

Just some further information...

I added pulseaudio, and it got rid of the error, but didn't seem to be able to configure it (had no idea what I was doing though either!!).

I plugged my computer monitor which has HDMI audio output option, rebooted the pine and tried mplayer again... and it worked, but was clicking. I seemed to remember that that exact issue was the bug report I linked above, so I thought I'd just remove pulseaudio and try without it. Another reboot, and HDMI audio does indeed work, but for the steam I'm using as a test, it only plays the intro file, and then mp3123 gives up... whereas if I play from a SSH terminal with no HDMI audio, it get error messages, but at least it seems to continue onto playing the current track....
  Reply
#2
Why do you use an old and outdated image? I suggest you use my current Ubuntu Image (see http://forum.pine64.org/showthread.php?tid=376) - also as always search is your friend and the reason why you do no hear anything is here: http://forum.pine64.org/showthread.php?t...91#pid7591
  Reply
#3
Eureka! I'll leave the rest of the post up as it might help someone else with the same issue, but I found that after installing mplayer and pulseaudio, and following the steps in the thread that longsleep posted that it still wasn't working for me on the ubuntu image, but I was getting clicks from the sound card when muting the headphones channel and unmuting it in alsamixer. When comparing it with a desktop ubuntu system, I realised the currently logged in user wasn't in the audio group, which is why I was having to use 'sudo' to run alsamixer, aplay and why pulseaudio --start didn't appear to be doing anything. Adding the user using 'sudo usermod -a -G audio name-of-logged-in-user' and logging it and out fixed it up perfectly!

---

I started with that image as it was the only non-gui image on pine64.pro for debian. As I said above, I updated uboot and the kernel, the debain version was at kernel version 3.10.101-4, and the ubuntu image is still at 3.10.101-0-pine64-longsleep as I haven't run the kernel update on it. 


I tried running through those commands on the debian install, and didn't get any sound coming out of the earphone socket. However I did get clicking sounds from the earpiece when muting/unmuting the headphones channel in alsamixer, so that seems to imply that there is something happening at least. I ran /usr/local/sbin/mplayer-play.sh song.mp3 before installing pulseaudio (again), and got this (and it made no difference if I ran the script or ran mplayer directly):

Code:
MPlayer 1.2.1 (Debian), built with gcc-5.3.1 (C) 2000-2016 MPlayer Team
mplayer: could not connect to socket
mplayer: No such file or directory
Failed to open LIRC support. You will not be able to use your remote control.

Playing song.mp3.
libavformat version 56.40.101 (external)
Audio only file format detected.
Clip info:
 Title: The Logical Song
 Artist: Supertramp
 Album: The Very Best of Supertramp
 Year: 1997
 Comment: 000004CB 00000562 00002D38 0
 Track: 2
 Genre: Classic Rock
Load subtitles in ./
==========================================================================
Opening audio decoder: [mpg123] MPEG 1.0/2.0/2.5 layers I, II, III
AUDIO: 44100 Hz, 2 ch, s16le, 32.0 kbit/2.27% (ratio: 4000->176400)
Selected audio codec: [mpg123] afm: mpg123 (MPEG 1.0/2.0/2.5 layers I, II, III)
==========================================================================
AO: [pulse] Init failed: Connection refused
Failed to initialize audio driver 'pulse'
[AO_ALSA] alsa-lib: confmisc.c:768:(parse_card) cannot find card '0'
[AO_ALSA] alsa-lib: conf.c:4292:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory
[AO_ALSA] alsa-lib: confmisc.c:392:(snd_func_concat) error evaluating strings
[AO_ALSA] alsa-lib: conf.c:4292:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
[AO_ALSA] alsa-lib: confmisc.c:1251:(snd_func_refer) error evaluating name
[AO_ALSA] alsa-lib: conf.c:4292:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
[AO_ALSA] alsa-lib: conf.c:4771:(snd_config_expand) Evaluate error: No such file or directory
[AO_ALSA] alsa-lib: pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM default
[AO_ALSA] Playback open error: No such file or directory
Failed to initialize audio driver 'alsa'
[AO SDL] Samplerate: 44100Hz Channels: Stereo Format s16le
[AO SDL] using aalib audio driver.
[AO SDL] Unable to open audio: No available audio device
Failed to initialize audio driver 'sdl:aalib'
Could not open/initialize audio device -> no sound.
Audio: no sound
Video: no video


I installed pulseaudio, rebooted and got this:


Code:
pfeerick@pine64:~$ /usr/local/sbin/mplayer-play.sh song.mp3
MPlayer 1.2.1 (Debian), built with gcc-5.3.1 (C) 2000-2016 MPlayer Team
mplayer: could not connect to socket
mplayer: No such file or directory
Failed to open LIRC support. You will not be able to use your remote control.

Playing song.mp3.
libavformat version 56.40.101 (external)
Audio only file format detected.
Clip info:
 Title: The Logical Song
 Artist: Supertramp
 Album: The Very Best of Supertramp
 Year: 1997
 Comment: 000004CB 00000562 00002D38 0
 Track: 2
 Genre: Classic Rock
Load subtitles in ./
==========================================================================
Opening audio decoder: [mpg123] MPEG 1.0/2.0/2.5 layers I, II, III
AUDIO: 44100 Hz, 2 ch, s16le, 32.0 kbit/2.27% (ratio: 4000->176400)
Selected audio codec: [mpg123] afm: mpg123 (MPEG 1.0/2.0/2.5 layers I, II, III)
==========================================================================
AO: [pulse] 44100Hz 2ch s16le (2 bytes per sample)
Video: no video
Starting playback...
A:   0.1 (00.0) of 637.0 (10:37.0) ??,?%
Audio device got stuck!
A:   0.1 (00.0) of 637.0 (10:37.0) ??,?%
Audio device got stuck!
A:  28.2 (28.1) of 268.0 (04:28.0)  1.5%


MPlayer interrupted by signal 2 in module: play_audio
A:  28.4 (28.3) of 268.0 (04:28.0)  1.5%

Exiting... (Quit)

It said it was playing, but no sound, so I Ctrl+C'd after about 28 seconds...

sudo aplay -l gets me : 

Code:
**** List of PLAYBACK Hardware Devices ****
Home directory not accessible: Permission denied
card 0: sndhdmi [sndhdmi], device 0: SUNXI-HDMIAUDIO sndhdmi-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: audiocodec [audiocodec], device 0: SUNXI-CODEC codec-aif1-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: audiocodec [audiocodec], device 1: bb Voice codec-aif2-1 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: audiocodec [audiocodec], device 2: bb-bt-clk codec-aif2-2 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: audiocodec [audiocodec], device 3: bt Voice codec-aif3-3 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0

I hopped over to the ubuntu image I was working on, and it doesn't appear to be any different. Please don't tell me I need to switch to a GUI image just to be able to configure the sound properly without having to jump through a dozen hoops??!  Huh

And thanks for the link to that thead btw... I was searching for sound, not audio, so no wonder it didn't turn up!!  Blush

The below *should* be a complete list of the steps I needed to do get audio / sound working on the earphone / headphone / analog jack on the debian image. I didn't need to install alsa-base or alsa-utils on the ubuntu image, only pulseaudio.



Code:
sudo apt-get install alsa-base alsa-utils
sudo apt-get install pulseaudio

sudo su

cat <<EOF >/etc/modules-load.d/pine64-audiojack.conf
sunxi_codec
sunxi_i2s
sunxi_sndcodec
EOF

exit

wget https://raw.githubusercontent.com/longsleep/build-pine64-image/master/blobs/asound.state

sudo mv asound.state /var/lib/alsa/asound.state

sudo usermod -a -G audio username

sudo reboot now


I used mplayer to play a demo mp3 I had downloaded on the pine64, so also did 

Code:
sudo apt-get install mplayer


And played the mp3 simply by running

Code:
mplayer demo.mp3
  Reply
#4
hi all,

I followed the above steps in the previous post to get sound working on the audiojack (debian 120bsp kernel); and the instructions worked brilliantly ! The sound is wonderful quality; in the preferences-->sound settings I was able to select either the sndhdmi or audiocodec (under the hardware tab) and under the input or output tabs to select the appropriate hardware options for the sound to be routed via hdmi, or audiojack.

The video (youtube) was not the best, but the audio was fabulous (crystal clear and actually pleasing, I was impressed). With my setup (since my hdmi monitor has no speakers, only jack) I am forced to move the plug in order to swith between the two hardware options/ but logically the idea is the similar / and in either case the sound (including system sounds) was fine.

Pulse Audio, alsa-base, and alsa-utils were on the img already, so I did not have to load those. So, looking forward to a video driver that will make the experience all-round fabulous.

good evening !

marcus
  Reply
#5
The instruciton above did not work for me on latest stable longsleep Ubuntu. Any pointers on how to get this debugged and working?
  Reply
#6
(10-24-2016, 03:11 PM)Pander Wrote: The instruciton above did not work for me on latest stable longsleep Ubuntu. Any pointers on how to get this debugged and working?

I'll have a look at this tomorrow. AFAIK, most of this shouldn't be needed on Ubuntu. Is this with a headless (non GUI) setup? And what sort of audio are you playing... can you get any audio with the suggested use of mplayer to play a mp3? It might also be worth checking if you have the headphones muted in alsamixer (m for mute/unmute).
  Reply
#7
Ok, repeated all of the steps I documented above on a clean ubuntu image, and mplayer had no problems at all playing audio (on the headphones jack) - I am currently listening to a MP3 radio stream from my national radio news service. 

Did you do all of the steps (up to and including the reboot) (repeated below without duplicate sudos, and without scrolling code box). This was using the ethernet - and a clean 20160507-1 ubuntu image - so nothing else has been configured at all. 


Code:
sudo su
pine64_update_uboot.sh
pine64_update_kernel.sh
reboot

--->>> Reboot to allow kernel update to take effect

Code:
sudo su
apt-get update
apt-get install alsa-base alsa-utils pulseaudio

cat <<EOF >/etc/modules-load.d/pine64-audiojack.conf
sunxi_codec
sunxi_i2s
sunxi_sndcodec
EOF

Code:
wget https://raw.githubusercontent.com/longsleep/build-pine64-image/master/blobs/asound.state

mv asound.state /var/lib/alsa/asound.state

usermod -a -G audio ubuntu

reboot now

--->>> Reboot to allow module and group changes to take effect

Code:
mplayer -playlist http://www.abc.net.au/res/streaming/audio/mp3/news_radio.pls
  Reply
#8
[quote pid='21713' dateline='1477541049']
Code:
wget https://raw.githubusercontent.com/longsleep/build-pine64-image/master/blobs/asound.state
Code:
mv asound.state /var/lib/alsa/asound.state

usermod -a -G audio ubuntu

reboot now

--->>> Reboot to allow module and group changes to take effect

Code:
mplayer -playlist http://www.abc.net.au/res/streaming/audio/mp3/news_radio.pls

[/quote]

Why do we use ubuntu ?
Topic says its for Debain? sorry for my noob question
  Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Debian installer on Pine A64+ but no hdmi mrwick 1 4,882 07-28-2020, 01:49 PM
Last Post: kuleszdl
  Debian Pine64 h264/5 Video under vlc ozcy 6 12,745 04-15-2020, 05:27 AM
Last Post: dmitrymyadzelets
  OMV/debian/systemd: how to start the network kittyland 0 2,938 12-10-2019, 05:29 PM
Last Post: kittyland
  Debian 10 (Buster) in deep freeze - includes support for Pine64+ amp 5 10,086 07-22-2019, 09:29 PM
Last Post: amp
  Pine64 Debian Stretch/mainline [4.14.7] CallMeFoxie 50 121,068 07-22-2019, 09:24 PM
Last Post: amp
  Installing Debian with the Debian Installer (Buster RC1) amp 1 4,752 06-28-2019, 12:35 PM
Last Post: Kaarme42
  Script to build pure Debian images for Pine64+ amp 1 4,188 05-01-2019, 09:09 PM
Last Post: tllim
  Debian (Stretch) for Pine64-LTS wgray 2 6,261 04-04-2019, 09:54 PM
Last Post: wgray
  Is there just one fuctioning Debian Desktop image? KNERD 7 13,059 03-29-2019, 02:00 AM
Last Post: desai_amogh
  (ARCHIVED) Debian Jessie Images (3.10.102 BSP Kernel) New Release lenny.raposo-pine64.pro 259 459,727 05-21-2018, 06:30 AM
Last Post: Luke

Forum Jump:


Users browsing this thread: 1 Guest(s)