Run It

On every boot, the sound module will need to be loaded and set to output to the 3.5mm audio jack:

sudo modprobe snd-bcm2835
sudo amixer cset numid=3 1

Next, play a mp3 file:

mpg321 <filename>

Leave the file playing and open a new terminal window or SSH connection to start the Python script:

sudo ./raspi-adc-pot.py
Now simply adjust the trim pot and you should hear the audio level change as the mp3 file is playing.
This guide was first published on Jul 29, 2012. It was last updated on Oct 23, 2018. This page (Run It) was last updated on May 04, 2015.