raspberry only play mono sound - audio

I installed raspbian using noobs on a fresh SD card.
I have XBian with XBMC in another SD and it works so HW is Ok.
The problem is that I cannot play stereo, thus I cannot play through HDMI, and I cannot play from ZynAddSubFX that is a midi sampler and my final target for this project.
This is the result from amixer:
Simple mixer control 'PCM',0
Capabilities: pvolume pvolume-joined pswitch pswitch-joined penum
Playback channels: Mono
Limits: Playback -10239 - 400
Mono: Playback -1900 [78%] [-19.00dB] [on]
the Mono playback is weird for me and the Limites of the playback are also suspicious.
If I install pulseaudio then amixer takes A LOT OF TIME to respond BUT this is the result:
amixer
Simple mixer control 'Master',0
Capabilities: pvolume pswitch pswitch-joined penum
Playback channels: Front Left - Front Right
Limits: Playback 0 - 65536
Mono:
Front Left: Playback 27111 [41%] [on]
Front Right: Playback 27111 [41%] [on]
Simple mixer control 'Capture',0
Capabilities: cvolume cswitch cswitch-joined penum
Capture channels: Front Left - Front Right
Limits: Capture 0 - 65536
Front Left: Capture 65536 [100%] [on]
Front Right: Capture 65536 [100%] [on]
Much more convenient and expected.
The problem is that I DON'T want to use pulseaudio and, actually, I think ZynAddSubFX is not compatible with pulseaudio.
For sure I've googled around a lot but there is no clear solution. I found out the trick for forcing analog output (amixer cset numId=3 1) it works in terms that I do hear something but the main problem is there .. only mono.
this is the output for lsmod:
lsmod
Module Size Used by
snd_bcm2835 16165 0
snd_soc_bcm2708_i2s 5474 0
regmap_mmio 2806 1 snd_soc_bcm2708_i2s
snd_soc_core 131268 1 snd_soc_bcm2708_i2s
regmap_spi 1897 1 snd_soc_core
snd_pcm 81593 2 snd_bcm2835,snd_soc_core
snd_page_alloc 5156 1 snd_pcm
regmap_i2c 1645 1 snd_soc_core
snd_compress 8076 1 snd_soc_core
snd_seq 53769 0
snd_timer 20133 2 snd_pcm,snd_seq
snd_seq_device 6473 1 snd_seq
leds_gpio 2059 0
led_class 3688 1 leds_gpio
snd 61291 7
snd_bcm2835,snd_soc_core,snd_timer,snd_pcm,snd_seq,snd_seq_device,snd_compress
Any clue ?? Any other output that might be interesting ??

I'm using Debian 4.4.6-1+rpi14 (2016-05-05) and have a very similar problem. The sound is mono only when using ALSA. The the sound is not continuous and the quality is poor. If I use omxplayer the output is stereo and the sound quality is good. I've found if I use mplayer -ao alsa:device=hw=0,0 then the sound quality is as good as using omxplayer and it is stereo! Somehow ALSA is not functioning normally if the default device hw:0.0 is not given as an parameter. So the solution for pulseaudio is to add the the device=hw:0,0 option.
pactl load-module module-alsa-sink device="hw:0,0"
pactl set-default-sink alsa_output.hw_0_0
Now pulseaudio shows stereo output and the sound quality is as good as omxplayer.

I finally "solved" by buying a 1.34€ USB sound card. I dont really thing that this count as a solution but .. I needed the mic line anyhow

Late answer but I can still relevant at this date: I faced the same problem (mono sound through hdmi output) with the ubuntu distro for raspberry pi, but everything works fine when using the raspbian distro from raspberry web site.

Related

arecord records silence instead of audio output

I am trying to record what my device is currently playing using arecord (it is playing audio via mplayer).
I've done everything I have been able to read so far such as checking under which user mplayer is running, setting the user as per the command below, but it only ever records silence.
This is the list of users where my user is ID 1000:
user:x:1000:1000:,,,:/home/user:/bin/bash
This shows that what I am trying to record is running by that user:
user 1217 2.3 1.3 131704 25524 ? SL 09:11 12:15 /usr/bin/mplayer http://example.com/stream
This is the command I am running:
XDG_RUNTIME_DIR=/run/user/1000 /usr/bin/arecord -d 1 /home/user/rec.waw
The command will output:
Recording WAVE '/home/user/rec.waw' : Unsigned 8 bit, Rate 8000 Hz, Mono
And it writes the file, but the content is silent.
I have tried specifying --device but not sure how to specify it from the list of devices below (I tried --device=CARD=Headphones and --device=hw:CARD=Headphones but I get errors.
This is the output of arecord -L
user#device:~ $arecord -L
null
Discard all samples (playback) or generate zero samples (capture)
jack
JACK Audio Connection Kit
pulse
PulseAudio Sound Server
default
Playback/recording through the PulseAudio sound server
output
usbstream:CARD=b1
bcm2835 HDMI 1
USB Stream Output
usbstream:CARD=Headphones
bcm2835 Headphones
USB Stream Output
Any help would be appreciated.

Debian 9 Dummy Output after resume from suspend (snd_hda_intel codec)

I have an external monitor that I plug-in my Dell laptop after turn it on. The sound works before and after plug it in the Laptop, So the headphone works too, plugin it in and out too. The problem is when I resume Debian after suspend. The sound has gone, and some times when increasing and decreasing volume one of the three options appears in the screen: Headphone unplugged, HDMI output (or something like), or Dummy Output.
I will show now what happens when Dummy Output is displayed and some outputs of commands.
$ lspci | grep Audio
Output:
00:1f.3 Audio device: Intel Corporation Sunrise Point-LP HD Audio (rev 21)
$ lsmod | grep hda
Output:
snd_hda_ext_core 28672 1 snd_soc_skl
snd_hda_intel 36864 0
snd_hda_codec 135168 1 snd_hda_intel
snd_hda_core 90112 4 snd_hda_intel,snd_hda_codec,snd_hda_ext_core,snd_soc_skl
snd_hwdep 16384 1 snd_hda_codec
snd_pcm 110592 6 snd_hda_intel,snd_hda_codec,snd_hda_ext_core,snd_hda_core,snd_soc_skl,snd_soc_core
snd 86016 7 snd_compress,snd_hda_intel,snd_hwdep,snd_hda_codec,snd_timer,snd_soc_core,snd_pcm
$ sudo dmesg | grep snd
Output (when rebooting):
[ 13.341580] snd_hda_intel 0000:00:1f.3: bound 0000:00:02.0 (ops i915_audio_component_bind_ops [i915])
[ 13.461226] snd_hda_intel 0000:00:1f.3: CORB reset timeout#1, CORBRP = 0
[ 13.462799] snd_hda_intel 0000:00:1f.3: no codecs found!
$ sudo alsactl init
Output:
alsactl: init:1757: No soundcards found...
Complete Alsa Information script:
https://alsa-project.org/db/?f=ff03c7d8dac369fc1211822de963b337c132420c
So it looks like the sound card is there but alsa does not recognize it.
Many forums/sites recommend to blacklist snd_hda_codec_hdmi (that would be the case when the problem is with connecting/desconnecting HDMI for the external monitor), and also put a line:
options snd-hda-intel model=generic
in a file, e.g., /etc/modprobe.d/alsa-base-blacklist.conf.
But it didn't work.
Other sites suggest to disable and enable sound in BIOS. Didn't work.
Can anyone help me solve this forever issue?

alsa tool arecord not recognizing plughw:1,0 on Arch Linux

Edit: All of this was probably caused by a terribly configured microphone (or a faulty one, I changed laptops and now use Ubuntu instead of Arch Linux, so I actually don't have any idea). To record to a wav file, all I do now is run:
arecord -d $DURATION -f cd -t wav $OUTPUT_FILE_PATH
...replacing $DURATION with the duration of the recording in seconds, and $OUTPUT_FILE_PATH with the path to the desired file to write. I omitted the -D sysdefault argument as it caused problems for me (as with most things, your mileage may vary, so if the command doesn't work for you, try playing with several variables until it works).
Goes without saying, but all of this requires alsa-utils to be installed.
(The original question is left below, for those that still want to see it.)
Tl;dr version: arecord not recognizing plughw:1,0 , nor hw:1,0 , nor anything without the -D option
Whole story: I'm trying to make a simple voice assistant using a Bash script (I don't find Python/Perl easy for me to use, but that's just me). Dialogs are made in Zenity/KDialog. Voice recognition isn't included yet, so one has to type in the phrase/command. For now the program is represented in Spanish, but I plan to have an English version as well.
Doing my research, I found: http://blog.oscarliang.net/raspberry-pi-voice-recognition-works-like-siri/
But it doesn't work correctly on my machine.
[owner#arch-hp-2000-notebook-pc ~]$ ~/test-speech-input
“Recording… Press Ctrl+C to Stop.”
ALSA lib pcm.c:2267:(snd_pcm_open_noupdate) Unknown PCM “plughw:1,0″
arecord: main:722: audio open error: No such file or directory
“Processing…”
^C
[owner#arch-hp-2000-notebook-pc ~]$
It apparently has to do with the arecord -D "plughw:1,0" -q -f cd -t wav part.
Output of arecord -l:
[owner#arch-hp-2000-notebook-pc ~]$ arecord -l
**** List of CAPTURE Hardware Devices ****
card 1: Generic_1 [HD-Audio Generic], device 0: ALC269VC Analog [ALC269VC Analog]
Subdevices: 1/1
Subdevice #0: subdevice #0
Output of arecord -L:
[owner#arch-hp-2000-notebook-pc ~]$
null
Discard all samples (playback) or generate zero samples (capture)
pulse
PulseAudio Sound Server
default
Default ALSA Output (currently PulseAudio Sound Server)
sysdefault:CARD=Generic_1
HD-Audio Generic, ALC269VC Analog
Default Audio Device
front:CARD=Generic_1,DEV=0
HD-Audio Generic, ALC269VC Analog
Front speakers
surround21:CARD=Generic_1,DEV=0
HD-Audio Generic, ALC269VC Analog
2.1 Surround output to Front and Subwoofer speakers
surround40:CARD=Generic_1,DEV=0
HD-Audio Generic, ALC269VC Analog
4.0 Surround output to Front and Rear speakers
surround41:CARD=Generic_1,DEV=0
HD-Audio Generic, ALC269VC Analog
4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=Generic_1,DEV=0
HD-Audio Generic, ALC269VC Analog
5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=Generic_1,DEV=0
HD-Audio Generic, ALC269VC Analog
5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=Generic_1,DEV=0
HD-Audio Generic, ALC269VC Analog
7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
[owner#arch-hp-2000-notebook-pc ~]$
Following the first part of the answer by #CharlesDuffy (thanks for the help):
[owner#arch-hp-2000-notebook-pc ~]$ ~/test-speech-input
Recording… Press Ctrl+C to Stop.
Processing…
You Said: [owner#arch-hp-2000-notebook-pc ~]$
Following the new answer, also by #CharlesDuffy (although this system is all AMD I think, no intel):
[owner#arch-hp-2000-notebook-pc ~]$ test-speech-input
Recording… Press Ctrl+C to Stop.
ALSA lib pcm.c:2267:(snd_pcm_open_noupdate) Unknown PCM CARD=Generic_1
arecord: main:722: audio open error: No such file or directory
Processing…
You Said: [owner#arch-hp-2000-notebook-pc ~]$
Following the newest answer by #CharlesDuffy:
[owner#arch-hp-2000-notebook-pc ~]$
Recording… Press Ctrl+C to Stop.
ALSA lib pcm_dsnoop.c:614:(snd_pcm_dsnoop_open) unable to open slave
arecord: main:722: audio open error: No such file or directory
Processing…
^C
[owner#arch-hp-2000-notebook-pc ~]$
Double-checked the volume of the internal mic, and it seemed to have selected a non-existent mic. Switching to the real mic yielded the same results.
I'm lost right now. Any other ideas? Is there any other command-line voice recording tool that might work or that might be easier to use (at least for me)?
Machine: HP 2000 Notebook PC, Arch Linux, uname -a returns Linux HOST_NAME 4.1.2-2-ARCH #1 SMP PREEMPT Wed Jul 15 08:30:32 UTC 2015 x86_64 GNU/Linux
The plughw:1,0 suggestion is specific to Raspberry Pi hardware, and doesn't necessarily apply elsewhere.
The first thing I'd suggest is removing the -D DEVICE argument entirely.
If that doesn't work, I'd suggest trying:
-D sysdefault
...for your basic on-board audio, as listed by arecord -L.

any command to release devices using pulseaudio

i am totally new to pulse audio and alsa. the situation is this:
i have mpd compiled for alsa. this is embedded system and pulse audio plugin for mpd is not available.
when i DO NOT start pulse audio, mpd runs fine using alsa
as soon as i start pulse audio [ which is needed by bluetooth audio unfortunately ] , mpd / alsa stops working .
seems like, somehow pulse audio is grabbing the device and not letting it go . even after i stop pulse audio daemon .
Trying to run mpd afterwards gives me:
root#FINGI_GCC:~# mpc play
http://relay3.slayradio.org:8000/
[paused] #1/1 0:00/0:00 (0%)
volume:100% repeat: off random: off single: off consume: off
ERROR: problems opening audio device
So i was wondering how to reset pulse audio ? need to keep running pulse audio,mpd,alsa all on the same device..but not all at the same time.
Any suggestion on this?
Assuming this audio device in in /dev/snd/, you could try to see which process is holding it with:
lsof /dev/snd/*
Then you could try to kill this process.
For instance when I'm running alsamixer, I get:
$ lsof /dev/snd/*
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
...
alsamixer 7152 emilien 3u CHR 116,5 0t0 10154 /dev/snd/controlC0
...

mplayer output 4 audio channels to jack

I am struggling with getting mplayer to reproduce a 4 audio channel wav file.
I created a 4chn audio file.
Want mplayer to player, and output it to jack.
The problem is that i am only able to get in jack 2 mplayer channels.
if I do:
mplayer -ao jack -channels 4 test_4chan_2.wav
mplayer plays and responds:
laying test_4chan_2.wav.
libavformat version 54.6.100 (internal)
Audio only file format detected.
Load subtitles in ./
==========================================================================
Opening audio decoder: [pcm] Uncompressed PCM audio decoder
AUDIO: 44100 Hz, 4 ch, s16le, 2822.4 kbit/100.00% (ratio: 352800->352800)
Selected audio codec: [pcm] afm: pcm (Uncompressed PCM)
==========================================================================
AO: [jack] 44100Hz 2ch floatle (4 bytes per sample)
Video: no video
Starting playback...
and jack has only the following outputs:
system:capture_1
system:capture_2
system:playback_1
system:playback_2
MPlayer [14434]:out_0
MPlayer [14434]:out_1
So it seems that mplayer recognizes that the input file as 4ch
but on AO: [jack] only 2ch appear
if I try the same with ecasound:
ecasound -f 16,4,44100 -i test_4chan_2.wav -o jack
in Jack ecasoud appears with 4 outputs
system:capture_1
system:capture_2
system:playback_1
system:playback_2
ecasound:out_1
ecasound:out_2
ecasound:out_3
ecasound:out_4
Do you have any idea of what could I be doing wrong??
I am running Debian (Jessy) and mplayer 1.1-4.7
Thanks a lot
Solved. Only need to upgrade mplayer to 4.8, in Debian Sid.
And
mplayer -channels 4 -ao jack:noconnect 4chn_file.wav
did the trick.
The -ao jack:noconnect means:
-ao audio-output: jack
noconnect: prevent mplayer to make 1-to-1 connections. As I have 2 different stereo audio sound cards, mplayer was only giving me 2 channels. And this option disables that start behavior.
hope it will be of help to someone else ,)

Resources