Intro to Physical Computing Fall, 2003 Jeff Feddersen
For next week, I built the light saber in the picture in the upper left. I think the switch is bad, since the plasma field charge isn't arcing all the way. I'll never take my light saber to the beach again, I can tell you that. So, I won't be able to cut off any arms just yet - I can just barely trim my fingernails with it.
I found a 10-watt speaker in the junk pile, but it doesn't work. The large red 'X' that someone had written on the back should have been a clue.
I swear there are two Japanese guys named Koichi in our class, but neither of them has heard of the other. That's crazy.
It's time to play with freqout - I don't even know what the assignment is yet.
If I wire in a resistor between the pot and ground, my minimum signal is around 164. I want the full range, so I'll remove the resistor.
It's a pain to have the basicX manuals in PDF. That format doesn't lend itself to searches.
I put in the following code:
Option Explicit dim potVal as integer Public Sub Main() call delay(0.5) ' start program with a half-second delay call putPin(26, 0) ' illuminate green on-board LED to show that power is on do potVal = getADC(13) debug.print cstr(potVal) call freqout(20,440,potVal,200) loop End SubIt should play a pulsing chord composed of 'A' and a second note somewhere between the bottom and somewhat more than an octave above A. (One full octave would be 880, adjacent octave leaps are always half or double).
It's really easy to completely wipe out all your code with this editor. For the longer projects I'll probably use TextPad and paste it in when I'm ready.
The bx doesn't like to download this program, but after flipping the power a few times it learns to become obedient.
Sound! It's pretty freaking obnoxious, but works. The volume goes up as the pitch rises. I first thought that was just an accoustic anomaly, since our cochlea are more sensitive to 1000Hz, rather than say, 5Hz, which is indetectable - but, it's not that. Just having the pot turned all the way means more current going into the chip, which means more available to the speaker, I guess.
I try this code:
do potVal = getADC(13) ' debug.print cstr(potVal) tone1 = potVal tone2 = potVal * 2 call freqout(20,tone2,tone1,200) loopFreqout doesn't seem to like to have arithmetic in the parens. This should play a note and the same note one octave up, but I can't really hear whether it is or not.
The highest note I can hear is probably around 16kHz (I'm not as young as I used to be), so if I map 1023 to 16,000 I should get the whole range. I think 15x should be a good amount.
tone1 = potVal * 14 tone2 = potVal * 15 call freqout(20,tone2,tone1,250)This plays two notes an octave apart, at the top of the range. Okay, I got it. Now it's time for multiple instruments. But is there a way to use this as a mixer? Or is that just physically combining signals?
Man. It's that easy. I have pin 20 playing 2 tones, and pin 19 outputting two more.
After playing around with the pitch and interval, I got it sounding just like my alarm clock in the morning. I have the urge to smash it.
potVal = getADC(13) * cInt(Timer)
That's kind of cool - interesting rhythms. You can also put a varying variable (duh) in the duration area. Kind of interesting.
This language uses the backslash '\' for division, That's wack.
I recently found out that the company where I consult, ACM, owns the whole Siggraph show. I wonder if I could get a free pass to next year's show.
I could program this thing to play a song, but that would be very tedious and not very impressive. I could make a little keyboard, but I already know I would do it, so the fun part is already over. Maybe it's time to start making a mobile robot. But every time I try connecting a motor, there's not enough power. I have three little motors, but none have voltage or wattage information. I'm guessing they take between 5 and 9 volts, since I can run them off a 9-volt battery. Variance in current would then affect rotation speed, I suppose. I'll try the servo motor, like in the exercise - another trip to Canal St. Or maybe I'll scavenge one of the stepper motors from one of the drives on the junk shelf.
Answering machine comes through again. I tell ya, this one $10 home appliance provides more useful bits per cubic inch than anything else. It has a little motor for spinning the tape that runs on as little as 1.5 volts. It was held in place by two of the tiniest little screws I've ever seen. Little baby screws. Their diminutive size made me want to care for them, raise them into big strong bolts like their dad.
I just got a call from a contact in midtown. They're sending a messenger to my apartment right now with a set of audio cassettes. Someone needs a digital copy made asap. I've never been asked to do this before, but it's funny how one gets a reputation as 'the tech guy'. I never even owned a computer until two years ago. I don't have an easy way to get an analog signal into the 1/8" stereo jack in my computer, and it occured to me I could probably just make some kind of cable to connect a walkman to the input. I'll figure something out.
GoldWave and Blaze Audio Wave are really good audio tools (for Windows, anyway).
It sounds like a recorded telephone conversation, so digitizing at 8bit, mono, 11kHz doesn't reduce the sound quality in a noticeable way.
There are two 90-minute tapes, so I guess I'll spend the next 3 hours riding the gain.
I ripped up my umbrella for my spatial design class. The ribs of an umbrella are really ingeniously put together. They move somewhat like birds' legs. I'd like to set up four umbrella ribs with motors to make a quadraped-bot, it could carry around my IPC case. I'll work on it. The mechanical engineering of the 'hips' will be the hard part.
Whoa, over 100 total minutes of audio in just 12MB of file space. The people who came up with MP3 should get some kind of award. When I did digital video back in '94, we had to buy 3 9-Gig drives, each the size of a toaster oven, for $4,500 a piece because even cruddy 640x480 video took up a megabyte for every second of video. People talk about how the Internet has changed everything, but I think they forget that the tremendous increase in capacity and decrease in cost of storage over the past 10 years, as well as improvements in compression algorithms, are what has made a lot of 'new media' possible. I guess I show my age by putting new media in quotes.
In the Lingo class, I made some crack about the word 'kludge', about how it was a Russian word that defined the way everything was done over there. Then, Eugene, who is from Russia, says, 'Is not Russian word.' I have some Ukranian friends, who use the word 'kludge' a lot, and they told me it was Russian, but those two countries went through a messy divorce a decade or two ago. I'm going to hang out with them tomorrow night. They're fun, but man, can they drink.
Two years ago my first textbook ("Professional Web Graphics") was published. I've been getting royalty checks each March and September since then. That would be cool, except that the last check was for $697.77! 10% my eye! If you are ever in a position to write a textbook, make sure you have an MD first. Those guys get, literally, $100,000 just for the advance.
A few weeks ago, I was thinking about how cool it would be when we finally got into music stuff in IPC. But if the puny freqout is all there is, then I'm more interested in robots, maybe building one of those AT-ATs from Hoth. On the other hand, if I wire up a humbucker or two... Those are essentially variable resistors, right?
And suddenly, the paradox of political correctness becomes clear: How can you embrace all cultures if some cultures don't share the idea of embracing other cultures?
So I take apart an electromagnet I pulled from some kind of executive office desk toy, hook up the multimeter, and pass a magnet by the rod in the center. Sure enough, there's a voltage - very small. I put one lead in pin 17, and the other in... where? ground? okay. No, that's not it, I just get full-on 1023. It doesn't seem to matter how I wire it up. I got a reading down to 46 at one point, but plucking a guitar string near the electromagnet didn't have any effect. Darn, I know I'm close.
I missed the flügtag on Sunday as I was stuck in Brooklyn.
I've been to about 10 hardware stores this week, looking for servo motors - but found only steppers. It looks like we get into regular DC motors next week, so I'll do the motor stuff then. I think steppers will be more appropriate for robots anyway.
It looks like a more solid understanding of Ohm's Law and the relationship between power, current, and resistance will be necessary as we get into more complex circuits.
My final program (back to just messing with sounds)
Option Explicit dim potVal13 as integer dim potVal14 as integer dim tone1 as integer dim tone2 as integer dim tone3 as integer dim tone4 as integer dim rate1 as integer dim rate2 as integer Public Sub Main() call delay(0.5) ' start program with a half-second delay call putPin(26, 0) ' illuminate green on-board LED to show that power is on do potVal13 = getADC(13) potVal14 = getADC(14) tone1 = potVal13 * 2 tone2 = potVal13 * 4 rate1 = potVal14 tone3 = potVal13 * 8 tone4 = potVal13 * 16 rate2 = potVal14 \ 2 debug.print "tone:" ; cstr(tone1) ; " " ; cstr(tone2) ; " " ; cstr(tone3) ; " " ; cstr(tone4) debug.print "rate:" ; cstr(rate1) ; " " ; cstr(rate2) call freqout(20,tone2,tone1,rate1) call freqout(19,tone4,tone3,rate2) loop End Sub
Two pots, one in pin 13 and one in 14, acting as voltage regulators.
#13 controls the pitch, and I'm getting 4 tones out of it, ranging from 0Hz to about 16kHz.
#14 controls the duration, ranging from 0 to about 1 second, with a second duration exactly half the length.
Pins 19 and 20 both connect to the speaker, which connects to ground.
It's clumsy, but it's possible to play simple songs on it.