element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Acoustics
  • Challenges & Projects
  • Project14
  • Acoustics
  • More
  • Cancel
Acoustics
Blog Audio project: Agony Box
  • Blog
  • Forum
  • Documents
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Acoustics to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: cypresstwist
  • Date Created: 17 Jan 2020 7:27 AM Date Created
  • Views 2012 views
  • Likes 13 likes
  • Comments 8 comments
  • sounds
  • python
  • circuitpython
  • WAV
  • drum machine
  • sound
  • acousticsch
  • circuit playground express
  • microcontroller
  • adafruit
Related
Recommended

Audio project: Agony Box

cypresstwist
cypresstwist
17 Jan 2020

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:

 

image

the CircuitPython code is as follows:

 

import time
import board
import touchio
import digitalio

try:
    from audiocore import WaveFile
except ImportError:
    from audioio import WaveFile

try:
    from audioio import AudioOut
except ImportError:
    try:
        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):
    touchPad.append(touchio.TouchIn(capPins[i]))

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

audio = AudioOut(board.SPEAKER)


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


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

 

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

 

You don't have permission to edit metadata of this video.
Edit media
x
image
Upload Preview
image

 

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:

You don't have permission to edit metadata of this video.
Edit media
x
image
Upload Preview
image

 

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.

  • Sign in to reply

Top Comments

  • dubbie
    dubbie over 5 years ago +5
    Something to give to the Grandchildren - if you want to annoy their parents. Still, a good project. Dubbie
  • robogary
    robogary over 5 years ago +3
    OMG - I could have so much fun with this. Install the agony sound box in a baby doll or a stuffed animal and watch the reactions. when it gets touched :-)
  • clem57
    clem57 over 5 years ago +3
    Thanks cypresstwist . Because of this project, I went and got one to play with from local Micro Center. I am using Circuit Python as well... Just love how easy to use this board. Did you share the code…
Parents
  • clem57
    clem57 over 5 years ago

    Thanks cypresstwist . Because of this project, I went and got one to play with from local Micro Center. I am using Circuit Python as well...

    Just love how easy to use this board. Did you share the code?

    • Cancel
    • Vote Up +3 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • cypresstwist
    cypresstwist over 5 years ago in reply to clem57

    BTW, here are the code and WAV files I have used in the video demo. In case you need them too.

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • More
    • Cancel
Comment
  • cypresstwist
    cypresstwist over 5 years ago in reply to clem57

    BTW, here are the code and WAV files I have used in the video demo. In case you need them too.

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • More
    • Cancel
Children
No Data
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube