6

I need to change my volume on my USB sound card (which is the default card) via the command line. I know alsamixer will do that but I need it to be a one line command so I can use it in a python script, e.g., os.system("volume up 1"), or something like that. Is there any way to do this?

goldilocks
  • 60,325
  • 17
  • 117
  • 234
Patrick Cook
  • 6,365
  • 8
  • 38
  • 63

1 Answers1

4
  1. Create a Bash file with the following code:

    amixer scontrols
    amixer sset 'Master' 50%
    
  2. Make the Bash file executable using chmod +x filename

  3. In Python, use the following:

    import os
    os.system("directorytobashfile/file")
    
Bex
  • 2,929
  • 3
  • 26
  • 34
Kachamenus
  • 749
  • 6
  • 26