Page 1 of 1

Setting the volume for 3.5mm jack

Posted: Sun Aug 19, 2012 6:41 am
by Eradicatore
Hi,
So I got audio playing just fine, but I can't seem to change the volume. I'm trying to find a way to use amixer to change this, but I need some help. To play audio, I just type "aplay xyz.wav" and I get audio on headsets plugged into the 3.5mm jack. So I tried this to set volume, but I don't see any change in the listed values:



[email protected]:/home/jdeltoft# amixer cset numid=1 -- 90%
numid=1,iface=MIXER,name='PCM Playback Volume'
; type=INTEGER,access=rw---R--,values=1,min=-10239,max=400,step=0
: values=-10239
| dBscale-min=-102.39dB,step=0.01dB,mute=1
[email protected]:/home/jdeltoft# amixer cset numid=1 -- 10%
numid=1,iface=MIXER,name='PCM Playback Volume'
; type=INTEGER,access=rw---R--,values=1,min=-10239,max=400,step=0
: values=-10239
| dBscale-min=-102.39dB,step=0.01dB,mute=1
[email protected]:/home/jdeltoft# sudo amixer cset numid=1 -- 10%
numid=1,iface=MIXER,name='PCM Playback Volume'
; type=INTEGER,access=rw---R--,values=1,min=-10239,max=400,step=0
: values=-10239
| dBscale-min=-102.39dB,step=0.01dB,mute=1

Re: Setting the volume for 3.5mm jack

Posted: Sun Aug 19, 2012 6:43 am
by Eradicatore
Oh, and one other question that may be quick for someone that can answer the volume question is how to change it from Mono to stereo? This is my output of "amixer":



[email protected]:/home/jdeltoft# amixer
Simple mixer control 'PCM',0
Capabilities: pvolume pvolume-joined pswitch pswitch-joined penum
Playback channels: Mono
Limits: Playback -10239 - 400
Mono: Playback -10239 [0%] [-99999.99dB] [off]

Re: Setting the volume for 3.5mm jack

Posted: Sun Aug 19, 2012 10:04 am
by dom
Can you try updating firmware. There's been some improvements with ALSA volume/muting.
http://elinux.org/R-Pi_Troubleshooting# ... g_firmware

Re: Setting the volume for 3.5mm jack

Posted: Sun Aug 19, 2012 10:11 am
by Jim JKla
I've added a link to the troubleshooting page to the Noob Image guide page might solve some issues. ;)

Re: Setting the volume for 3.5mm jack

Posted: Sun Aug 19, 2012 10:38 am
by jgearing
you could buy a cheap inline volume control from amazon
mine works fine
http://www.amazon.co.uk/gp/offer-listin ... dition=all
cheers

JG

Re: Setting the volume for 3.5mm jack

Posted: Sun Aug 19, 2012 8:36 pm
by Eradicatore
Dom, thanks, I updated my firmware (and then had to get wifi working again :) ) But no help.

JG, thanks for the suggestion. I do want to have s/w control though and this seems to me to be something that should be totally trivial to get working. :-(

I did try the troubleshooting link here also: http://elinux.org/R-Pi_Troubleshooting
It doesn't have anything about volume. It would help get sound if I didn't already have that working, but as I said I have that already.

So then I tried alsamixer. Interestingly, when you run that and type any of the number keys, it "tries" to go to a higher volume, but then jumps back to zero right away. Odd since my issue is that I can't seem to lower the volume. But anyway, I'll keep playing around. I'm so confused why this is hard but hey, what fun would it be if it just worked. :-)

Re: Setting the volume for 3.5mm jack

Posted: Sun Aug 19, 2012 9:21 pm
by Eradicatore
Ok, I stumbled on it. I type to following (logged in a root for now):

amixer set PCM -- -XYY

Which will set the volume to -X.YYdB

So for example:


[email protected]:/home/jdeltoft# amixer set PCM -- -2200
Simple mixer control 'PCM',0
Capabilities: pvolume pvolume-joined pswitch pswitch-joined penum
Playback channels: Mono
Limits: Playback -10239 - 400
Mono: Playback -2200 [76%] [-22.00dB] [on]


I would still like to know how to change from mono. Let me play around there now.

Re: Setting the volume for 3.5mm jack

Posted: Wed Aug 22, 2012 11:59 pm
by spitecho
Thanks, Eradicatore. Been wondering how to set the analog volume.
Here are some aliases to put in ~/.bashrc to simplify the commands.

Code: Select all

# Increase volume by 5%
alias volu='sudo amixer set PCM -- $[$(amixer get PCM|grep -o [0-9]*%|sed 's/%//')+5]%'
# Decrease volume by 5%
alias vold='sudo amixer set PCM -- $[$(amixer get PCM|grep -o [0-9]*%|sed 's/%//')-5]%'

Re: Setting the volume for 3.5mm jack

Posted: Tue Jan 01, 2013 12:13 pm
by crsskynet
Can I just say a massive thank you to spitecho this issue of the Raspberry Volume being so low was driving me up the wall. This little script you posted has been my salvation! Massive thanks!

:D
spitecho wrote:Thanks, Eradicatore. Been wondering how to set the analog volume.
Here are some aliases to put in ~/.bashrc to simplify the commands.

Code: Select all

# Increase volume by 5%
alias volu='sudo amixer set PCM -- $[$(amixer get PCM|grep -o [0-9]*%|sed 's/%//')+5]%'
# Decrease volume by 5%
alias vold='sudo amixer set PCM -- $[$(amixer get PCM|grep -o [0-9]*%|sed 's/%//')-5]%'

Re: Setting the volume for 3.5mm jack

Posted: Mon Apr 29, 2013 3:16 am
by Raspberrypiglitch
Dear Raspberry pi users

I'm running a test with aplay and I want to put the volume down does anyone how to
Thanks,
Raspberrypiglitch! :D

Re: Setting the volume for 3.5mm jack

Posted: Fri Nov 08, 2013 6:30 pm
by mkgbian
Hi Raspbians,
I have tried many codes but when i checked amixer doc ,i found this

Code: Select all

amixer  sset PCM,0 90%
this sets the volume to desired percentage

Happy pie-ing :D

Re: Setting the volume for 3.5mm jack

Posted: Sat Nov 09, 2013 4:01 pm
by chaddha
Hi, I have tested my speakers with a iphone and the sound is quite loud, when I connect the speakers to the audiojack in the pi and play music from my iphone via shareport sound is very low. I have tried to increase sound to 100% via the great instructions on this page, but it does not increase volume. Any advice?

Re: Setting the volume for 3.5mm jack

Posted: Sat Nov 09, 2013 4:06 pm
by mahjongg
chaddha wrote:Hi, I have tested my speakers with a iphone and the sound is quite loud, when I connect the speakers to the audiojack in the pi and play music from my iphone via shareport sound is very low. I have tried to increase sound to 100% via the great instructions on this page, but it does not increase volume. Any advice?
You are hijacking a thread, you should ask non identical questions in a new thread, but I assume you did not realize it has nothing to do with loudness control.

The PI's stereo output are only for amplifiers, they do not output enough energy even for headsets, let alone to directly drive speakers.


Also, as a general remark, the PMW signal used to drive the 3.5mm port is an 11-bit signal, and decreasing the volume will simply scale the signal down to less than 11 bits, which will have effect on the quality, so you should use an external volume control, and leave the PWM output at 100%.

Re: Setting the volume for 3.5mm jack

Posted: Wed Jun 25, 2014 2:56 am
by zSprawl
spitecho wrote:Thanks, Eradicatore. Been wondering how to set the analog volume.
Here are some aliases to put in ~/.bashrc to simplify the commands.

Code: Select all

# Increase volume by 5%
alias volu='sudo amixer set PCM -- $[$(amixer get PCM|grep -o [0-9]*%|sed 's/%//')+5]%'
# Decrease volume by 5%
alias vold='sudo amixer set PCM -- $[$(amixer get PCM|grep -o [0-9]*%|sed 's/%//')-5]%'
Thank you so much for this. It has helped a lot!!

Re: Setting the volume for 3.5mm jack

Posted: Sun Jul 06, 2014 3:36 am
by ajan
mkgbian wrote:Hi Raspbians,
I have tried many codes but when i checked amixer doc ,i found this

Code: Select all

amixer  sset PCM,0 90%
this sets the volume to desired percentage

Happy pie-ing :D
This worked for me. :D
Connected my Headphones to the Pi and increased increased upto 200% :twisted:

Moderator comment: Warning Any attempt of reducing or increasing the volume of the analog output this way will lead to loss of audio fidelity, the only correct way to set audio volume on analog output is to do it externally! Now locking this thread!