Getting analog audio/sound to work (headphones socket) on debian
#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


Messages In This Thread
RE: Getting analog audio/sound to work (headphones socket) on debian - by pfeerick - 06-01-2016, 10:16 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Debian installer on Pine A64+ but no hdmi mrwick 1 1,939 07-28-2020, 01:49 PM
Last Post: kuleszdl
  Debian Pine64 h264/5 Video under vlc ozcy 6 5,527 04-15-2020, 05:27 AM
Last Post: dmitrymyadzelets
  OMV/debian/systemd: how to start the network kittyland 0 1,064 12-10-2019, 05:29 PM
Last Post: kittyland
  Debian 10 (Buster) in deep freeze - includes support for Pine64+ amp 5 3,964 07-22-2019, 09:29 PM
Last Post: amp
  Pine64 Debian Stretch/mainline [4.14.7] CallMeFoxie 50 54,439 07-22-2019, 09:24 PM
Last Post: amp
  Installing Debian with the Debian Installer (Buster RC1) amp 1 1,943 06-28-2019, 12:35 PM
Last Post: Kaarme42
  Script to build pure Debian images for Pine64+ amp 1 1,471 05-01-2019, 09:09 PM
Last Post: tllim
  Debian (Stretch) for Pine64-LTS wgray 2 2,170 04-04-2019, 09:54 PM
Last Post: wgray
  Is there just one fuctioning Debian Desktop image? KNERD 7 5,629 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 216,082 05-21-2018, 06:30 AM
Last Post: Luke

Forum Jump:


Users browsing this thread: 1 Guest(s)