Arduino – Crickets (played by Processing with minim)

I grabbed the minim library for better sound control in PROCESSING from, installed and eventually got it running. Pretty easy to play a sound from .mp3 or .wav file – in fact playing three at once sounds really cool. So I jumped onto the freesound project and grabbed three random cricket sounds which I turned into crickets1, 2 and 3 .wav. After fiddling about starting and stopping the sounds under keyboard control [AudioPlayMinim02_Feckabout.pde] I decided to find a way to control the sounds by SoundPressureLevel readings from my Arduino.

A quick munge of my earlier ARDUINO <-> PROCESSING serial ‘ASCII call / response’ code for running a dot on the screen by model aeroplane TX / RX remote controls did the trick:

  • MultiSensorsSerialCallResponse_Crickets.ino – reads SPL from freetronics MIC sound input into Analog pin 8 of my Arduino & writes the value (0-1023) as the first of four (channel) Comma Separated Values to the serial port (every time an “A” is read from the serial port).
  • SerialCallResponseASCII_Crickets02.pde – reads the 4 value parameter CSV from Serial port and does all the logic to figure out how much noise is coming in (on the first parameter) and what to do about it. The basic idea is to react to noise by setting a ‘fear’ string to the values: calm, alert or panic depending on the SPL level coming in. It then decays gradually from panic through alert to calm when all is quiet. Various cricket noises play depending on the state of fear: all three crickets.wav files play simultaneously when all is calm, only one when alert and immediately stop playing all sounds when in panic. I also threw in 4 keyboard controllable ‘seasons’ morn, noon, eve, night to toggle the mix of creatures making noise by typing 1, 2, 3 or 4. This is in preparation for time / light control.

Creative Commons License

Fang – Mike Seyfang



About mseyfang

Interruptus Digitalis
This entry was posted in Hobbies, phd and tagged , , , , , , , , , , , , , , , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s