2013年12月21日 星期六

raspberry pi 調整大小聲

資料參考來自:
http://raspberrypi.stackexchange.com/questions/157/if-i-plug-my-headphones-into-the-audio-jack-how-do-i-control-the-volume

Make sure you are in the user folder:
$ cd ~/

Create the file .bash_aliases (this will be where I keep all the aliases I make so they aren't lost when I reboot my Raspberry Pi):
$ sudo nano .bash_aliases

In the text editor, add the aliases:
# Increase volume by 5%
alias volup='sudo amixer set PCM -- $[$(amixer get PCM|grep -o [0-9]*%|sed 's/%//')+5]%'
# Decrease volume by 5%
alias voldown='sudo amixer set PCM -- $[$(amixer get PCM|grep -o [0-9]*%|sed 's/%//')-5]%'

Exit and save: Ctrl+X, Y, Enter
Reboot:
$ sudo reboot

Log in and test the commands:
$ volup
Simple mixer control 'PCM',0
  Capabilities: pvolume pvolume-joined pswitch pswitch-joined penum
  Playback channels: Mono
  Limits: Playback -10239 - 400
  Mono: Playback 400 [100%] [4.00dB] [on]
$ voldown
Simple mixer control 'PCM',0
  Capabilities: pvolume pvolume-joined pswitch pswitch-joined penum
  Playback channels: Mono
  Limits: Playback -10239 - 400
  Mono: Playback -131 [95%] [-1.31dB] [on]

Note: This solution has only been tested on Raspbian systems only (the OS that the OP assumed they would use).

沒有留言:

張貼留言