Enter Your Electronics & Design Project for a chance to win an $200 Shopping cart of product!

Back to The Project14 homepage

Project14 Home
Monthly Themes
Monthly Theme Poll


This is just something to have disturbing fun with: the Agony Box.

I'm using an Adafruit's Circuit Playground Express with some CircuitPython code in it and some freely available WAV files. The WAV files had to be converted to PCM 16-bit Mono and I think I need to tune down their volume a bit. I used the open-source SoundConverter app in Ubuntu for the conversion:


the CircuitPython code is as follows:


import time
import board
import touchio
import digitalio

    from audiocore import WaveFile
except ImportError:
    from audioio import WaveFile

    from audioio import AudioOut
except ImportError:
        from audiopwmio import PWMAudioOut as AudioOut
    except ImportError:
        pass  # not always supported by every board!

bpm = 120  # Beats per minute, change this to suit your tempo

# Enable the speaker
speaker_enable = digitalio.DigitalInOut(board.SPEAKER_ENABLE)
speaker_enable.direction = digitalio.Direction.OUTPUT
speaker_enable.value = True

# Make the input capacitive touchpads
capPins = (board.A1, board.A2, board.A3, board.A4, board.A5,
           board.A6, board.TX)

touchPad = []
for i in range(7):

# The seven files assigned to the touchpads
audiofiles = ["1aaa.wav", "1aarrgghh.wav", "1scream.wav",
              "1scream5.wav", "1scream7.wav", "1scream11.wav",

audio = AudioOut(board.SPEAKER)

def play_file(filename):
    print("playing file " + filename)
    file = open(filename, "rb")
    wave = WaveFile(file)
    time.sleep(bpm / 960)  # Sixteenth note delay

while True:
    for i in range(7):
        if touchPad[i].value:


I just modified the WAV files from this drum machine code that originally sounded like this:



Next I used some brass standoffs and standoff rounded metal caps to be able to better access the touch sensors. I soldered some Dupont wires to a 3.7V phone battery and filed down their ends a bit to fit the battery port of the Circuit Playground Express.


Now let's hear some screams:


Disturbing - I know.

I plan to use analog buttons and a cheaper CircuitPython-capable device to build a better Agony Box. This is just some quick hack I did.