| ||||||||||
Yes, the comment just goes in once at the top. Draw on a World. I can make a movie out of it – see Gallery HW3: Turtle Dance-Sp06. Mark Guzdial |
The "ration value"? Okay, let's take this from the top:
|
Have you compiled SimpleSound yet? Mark Guzdial |
For those who didn't make it to class today, Jennifer's question above (about ratio's) is because she had a CD-quality sound (sampled at 44Khz), mixed with our sounds which are sampled at 22Khz. For those brave souls trying to use JMusic for HW3, be sure to read at http://jmusic.ci.qut.edu.au/jmDocumentation/jm/util/Play.html – that explains the Play class. You'll particularly want to pay attention to (a) the false second parameter to the midi method that keeps the program from crashing and (b) the waitCycle method. Think about it this way: When you play MIDI, it plays in parallel (technically, "in a separate thread") to your turtle drawing. It's just like using someSound.play(). How do you synchronize with MIDI? Well, after drawing (which takes almost zero time), you need to get your drawing thread to wait for the music. How do you do that? With sounds, we'd say someSound.blockingPlay(). In JMusic, you use waitCycle(someScore) which will make your drawing thread sleep (wait) for awhile – long enough to play the score. If the score is about as long as the piece you're playing, the turtles will wait until the current piece is done. Then you play the next piece and do the next drawing, and wait until the piece is done. And so on. Make sense? Mark Guzdial |
Some of you may be thinking, "Hey, it's not fair that I can't use JMusic for the extra credit, just because I don't read music or know how to compose music!" First response: Nobody said that the music had to sound GOOD. Just play SOME notes, and you get the extra credit. Second response: Here's the cheater's way to compose music: Just use C, E, and G in different octaves. Those three notes make up what's called a C major chord. It won't sound exciting to just use those three notes (see First Response), but it'll never sound bad. (It's the computational equivalent of three-chord rock-n-roll. :-) Mark Guzdial |
BTW, you don't have to use waitCycle to get your drawing to pause while using JMusic. sound.blockingPlay() should work just as well to get some pauses in your drawing, so that you can synchronize with the music. Mark Guzdial |
Look in SimpleTurtle. Mark Guzdial |
You need to interleave. Typically you'll start a sound.play(), then move the turtles with sound.blockingPlay() interleaved (e.g., in the loop). Mark Guzdial |
If you send the sounds to me, I can scaled them down to the right sampling rate and mail them back to you. Mark Guzdial |