ProteusInvincibile

It works in this way: 6 lasers, each one hitting a photodiode. When the photodiode doesn't receive the laser (because the hand is interrupting it), a range sensor gives voltage based on the point where the hand is interrupting the laser (from 0 to 2.5V). There is a sensor for each laser.

I'm trying to write the code to load into the Arduino board, and there is something wrong.

Forgetting about the range sensors, I tried to build a code based exclusively on the status of the laser (interrupted/uninterrupted) and if it is interrupted, the board should send a "sound" to the speakers I connected.

1)I heard the "electric sound" and it shouldn't be so... dirty;2)When there aren't interrupted lasers, I can hear a sound. This shouldn't happen.3)Interrupting more lasers together makes a sound which becomes lower and lower, but what I wanted was that only THE LAST INTERRUPTED LASER makes the sound.

1) Dirty sound: With a single string continuously active, noTone() is executed every time loop() executes, and then tone() is executed. I don't know the internals of tone() and noTone(), but I'd expect that turning the tone on and off rapidly would have an effect on the sound that you hear. I'd recommend executing noTone() only when the active string changes.

2) Sound all the time: We don't have much information about this. A schematic would help, and a description of the character and intensity of the sound. It could be digital noise, or power supply noise, or an artifact caused by executing noTone() all the time.

3) Wanted last interrupted laser to determine the tone: There's nothing in the code that remembers the last interrupted laser. If you want this feature, you'll have to do something to make the program determine which laser was interrupted last. I think you'll have to save the state of all the strings, and do manipulate the tone only when the state of any of them changes.

boguz

Would you be willing to have the Arp Plugged to a Computer?If so, maybe it would be a good idea to have it send MIDI messages instead of actual "sound".Like this the sounds that you would hear could be any sound (piano, guitar, arp, saxophone, drums,...) and with much better quality that those sounds produced by the Arduino.

Also, it would be much less work for you if you would use arrays on your code(http://arduino.cc/en/Tutorial/Array)

This project looks really nice and i hope you can get it to work!Could you post your schematics? I bet there are more people here interested in such cool project (and it could also help us to understand what is going on...).

Good luck!

AmbiLobe

You can get dirty sound if you keep the Arduino connected to a PC using a USB cable. Disconnect the USB cable and power the Arduino using the barrel jack. I use type K power coaxial plugs from radio shack. I have also gotten dirty audio music from my custom synthesizer when USB is attached. The noise is silenced when USB is disconnected.