Introduction: How to Connect a Push Button With Audio Input and Output
A push button is one of a basic component for capturing your action. You can dynamically push a button to do something.
There are already several way to use push buttons in your projects (e.g. hacking mouse and keyboard, or Arduino, gainer, MCK). This probides alternative way to use push buttons with audio input and output.
We also present an application of this instructable from a work Monalisa "shadow of the sound".
All you need is just a push button, some soldering, and some software.
Note: This is a series of "How to coonect with Audio". Please see others: Fader, and Sensor.
Step 1: The Parts
All of the following components can be found at your local electronics shop (e.g. maplin in UK, RadioShack in USA, Tokyu-Hands in Japan).
1 Push button
In this time, we choose a button with push on / off locking switch. However you could choose a push button with no lock, toggle switch, or foot switch instead.
2 3.5mm Mono Plug
One for audio input and another for audio output.
1 Twin Cable
You could use loudspeaker cable for this purpose. The length depends on how long you want.
Step 2: The Tools
These are standard tools for assembling this project. I borrow part of the list from greyhathacker45's great work, thanks!
Step 3: Cutting the Middle of the Cable
Cut one line of the cable (usually cable has a mark for the one side) in the middle. Then strip the cutting sides.
Step 4: Stripping the Ends of the Cable
Strip the ends of the cable.
Step 5: Soldering the Push Button
Now you ready to solder the push button to the middle of the cable. Before soldering, the cutting side of the cable needs to be twisted to avoid expanses.
Step 6: Soldering the Plugs
Then you ready to solder the plugs to the each end of the cable. Be assure to solder the switch side of the cable to the center of the plug. Before soldering, the plug cover needs to be installed in the cable and the cutting side of the cable needs to be twisted to avoid expanses. After soldering, just attach the cover for the plugs.
Step 7: Quality Control
Now you have a set of a switch, two plugs, and a cable. Using multimeter on the resistance between the plugs. Tips (upper side) should be infinity and grounds (lower side) should be zero.
Step 8: Connect to the Audio Input and Output
Now you have a working hardware, so lets connect each side of the plug to the audio input and output.
Step 9: Some Software
Open your programming environment (e.g. MaxMSP, Pure Data, Flash, SuperCollider). If it could treat audio input and output, any environment is ok.
In this time, we use MaxMSP and Pure Data.
Assign an audio signal (e.g. 10000Hz sine wave) for audio output.
Set volume calculator for audio input. In this time, we use a meter~ object on MaxMSP, and a threshold~ object on Pure Data.
Add a receiver for the calculator / threshold. In this time we use a 'toggle' object on MaxMSP, and a 'print' object on Pure Data.
Here are basic examples of MaxMSP and Pure Data patches.
Pure Data: pushbutton-001.pd
Step 10: Moment of the Connection
If it does not work, you just need to adjust the volume for audio output.
Step 11: Uses? Photo Release
Here is the setup. You will need to setup yourself (and your friends) for photo. In your software, you add a webcam control function. In this time, we made a patch with MaxMSP on Mac OSX. We use an apple script to control webcam and a shell object to run the script.
You could download shell object from here!
Now, you can finely take your photo from a distance!
Here are the apple script and the MaxMSP patch (photorelease.zip). You just need to put both files in a same folder and run the patch.
Apple Script: takephoto.scpt
Step 12: Application: Monalisa "shadow of the Sound"
In this work, we detect the conduction of a push button as on/off of audio signal.
Step 13: Possible Improvements and Modifications
You can use other types of buttons and switches.
You can use two push buttons with 3.5mm stereo plugs and triple cable.
If you need more push buttons, you can extend with external audio interfaces. In this time, you need to use proper plugs for the port of the audio interface.