Skip to content

Instantly share code, notes, and snippets.

@j6k4m8
Created December 11, 2019 20:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save j6k4m8/002b3219e5a52e6873fc49b670e329bf to your computer and use it in GitHub Desktop.
Save j6k4m8/002b3219e5a52e6873fc49b670e329bf to your computer and use it in GitHub Desktop.
Raspberry Pi Volume Control. Use with `vol 70` for 70% volume
#!/usr/bin/env python
import subprocess
import sys
if len(sys.argv) > 1:
subprocess.check_output("amixer sset 'PCM' {}%".format(sys.argv[1]), shell=True)
else:
print(subprocess.check_output("amixer get 'PCM' | grep '%'", shell=True).split()[3].strip('[]'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment