Description



Steel Ice & Stone is a multi-media interactive installation.
Nine suspended LED panels and sensor-triggered sound create an environment for memory recall.

Friday, August 9, 2013

Under Construction

So what have we got?

More parts, I know what doesn't work, and I'm trying to figure out what I think will work.

Parts!

We have our speaker bar by Vizio:










http://www.tigerdirect.com/applications/SearchTools/item-details.asp?EdpNo=7731416&csid=_61
https://dl.dropboxusercontent.com/u/40601652/2013-07-29%2018.39.44-2.jpg
https://dl.dropboxusercontent.com/u/40601652/2013-07-29%2018.41.31.jpg

Our power strip/supply by Belkin:









http://www.tigerdirect.com/applications/SearchTools/item-details.asp?EdpNo=3839636&csid=_61
https://dl.dropboxusercontent.com/u/40601652/2013-07-29%2018.49.07.jpg
https://dl.dropboxusercontent.com/u/40601652/2013-07-29%2018.49.23.jpg
https://dl.dropboxusercontent.com/u/40601652/2013-07-29%2018.49.37-2.jpg

And our remote control by RCA: http://www.tigerdirect.com/applications/searchtools/item-details.asp?EdpNo=4456088&SRCCODE=WEBGOOPA&cm_mmc_o=mH4CjC7BBTkwCjCV1-CjCE&gclid=CICl_4CX5LcCFSdnOgodRXwA2g

Now, I tried soldering the motion sensors first. This resulted in a bad but not catastrophic case of wrong tool for the job. We have pins crossing: https://dl.dropboxusercontent.com/u/40601652/2013-08-04%2015.49.20.jpg

I was following the tutorial Adafruit provided for dealing with chips of this size, except one important part. The soldering iron. My tip's not small enough. But that's ok right? I figured "What if I just tin all of the contacts before putting the chip in place, and then heat each pin until the solder melts?" https://dl.dropboxusercontent.com/u/40601652/2013-08-04%2015.57.27.jpg well that's a bad idea for two reasons. 1: It doesn't work that way, you need need need need neeeeed a fine tipped iron. 2: Soldering things by pressing on top of the wire/lead/pin doesn't work very well. You might end up warping the pin, and the solder won't flow into place properly.

I spoke with Professor Marantz and he affirmed that a fine tipped soldering iron is a necessity, and told me to get a tip from Radioshack. Which actually means I'm going to have to get a different soldering iron. I got mine from the near by hardware store (not Radioshack) and the only tip I can find is this: http://www.allspec.com/products/Weller/Soldering_and_Rework%7CPortable_Soldering_Equipment%7CSOL-27/BP1.html which is what I'm already using. My other alternative is to scour the internet for a tip for my really old soldering iron which I can't make out any manufacturer information on, or maybe to get a hot air gun. That might make the whole pre tinned contacts thing work.

Now, code. Remember that method for handling sound involving alternating between the sound buffers as rapidly as possible? Not happening. I got it to "work" and it sounds worse than I thought. Reading from file A and playing it, then reading from file B and playing it only works ok if you have a delay of 15 milliseconds or more between switching. Below that, you'll hear something that sounds like a corrupt recording of someone with the hiccups. If you here anything at all. With 8 milliseconds of delay or less, you're lucky if you hear anything.

Not all is bad though! Remember how I mentioned using code from Audacity? I looked into how it exports sound and downloaded its code. Lo and behold, there's an FAQ on their wiki, and it answers my question in theory: http://wiki.audacityteam.org/wiki/HowAudacityWorks all the way at the very bottom we have
"What is the algorithm used by Audacity to mix separate sound tracks (i.e. what is the process of merging the tracks to a single one when the "Mix and Render" command is used)?"

Perfect! The part of the answer I care about is:
"Mixing is just addition. The waveforms show the air pressure moment by moment. If there are two sounds at the same time then the air pressures add. So we just add the waveform values."
Which is excellent. So I set up the code to read from both files, add the values of the data read, and feed that to the decoder on the music shield. But before running it, I realize "Wait, these are MP3s, they're compressed, just adding the data wont do it." and try it anyway for the hell of it. It was amusing. Have you ever had a pair of headphones messed up in such a way/plugged in just wrong enough that you here only one side and it's all garbled? Now imagine that in both ears. That's what happens.

So I convert the files to .wav and try again. Now I hear nothing. I realized that even though .wav is raw and usually uncompressed, it's still digital and has a file structure, waveforms are analogue. Adding the buffers that I read from each file won't do the job.

After some poking around, I found this! https://github.com/TMRh20/TMRpcm code meant to play .wav files with minimal hardware (an SD card and no more). It outputs through the Arduino's PWM pins (pulse width modulation), which means I can figure out something resembling a wave form to work with (PWM can be used to fake analogue output). All I need to do is find where in the code data gets sent to the pins, and that'll be my wave form. If this can make analogue sense of a digital file, it can do the reverse too.

And that's where I'm at now.

Until next time!

Things to do:

  1. Fiddle with that library until it works or until I don't think it'll work
  2. Separate the pins on the motion sensor module.
  3. Aquire as close to a needle point soldering iron as I can find.
  4. Get the Arduino to read commands from the remote control.

1 comment:

  1. It really isn't worth getting a cheap soldering iron from the hardware store or the 99-cents store for detailed work like this. In fact, it is worth the investment to get a good soldering iron at Radioshack with modular tips.

    So here's the basic problem with just adding samples in wav files. A wav file uses PCM where in each analog sample is encoded to an n-bit binary word, 'n' depends on the format setting, i.e. it could be 8-bit, 16-bit, etc. However, you have to remember that when you're listening to some standard audio files, they come in two-cahnnels: left and right. These two channels are interleaved in the wav file. There's a specific structure to the file and you have to make sure that you're adding the correct samples, in addition to other subtleties including alignment and sample rates.

    Here's a link describing the format of a wav file: http://www-mmsp.ece.mcgill.ca/Documents/AudioFormats/WAVE/WAVE.html

    PJMEDIA uses their libraries to mix two wav files: http://www.pjsip.org/pjmedia/docs/html/page_pjmedia_samples_mix_c.htm (This may not be practical for the Arduinos's resources, but the code may be helpful.)

    Also, it could be that by adding the two files you are saturating the values. Instead, perform an average, e.g. (0.5)*wav1 + (0.5)*wav2 and see what happens.

    Hope this helps.

    ReplyDelete

Thanks for your feedback.