[Note: this webpage last modified Friday, 04-Feb-2011 19:44:51 EST]
Adinistrative...
Homework 7.
Survey
Final Project
Today: splicing!
Splicing: in the old days, actually taping together tapes of sound or video. Now, of course so much easier (right?).
Basic outline.
(1) Create a new empty sound using makeEmptySound or makeEmptySoundBySeconds. makeEmptySound lets you say how many samples long it will be and makeEmptySoundBySeconds lets you say how many seconds long it will be.
(2) Do a series of loops to copy over the sample values from other sounds into the new sound. The trick is to keep a "master counter" for where you are in the new sound. It keeps being increased as you go from copying one sound to another. This is the "index" variable in the sample Python file for today and in the book for this section.
There is an example in the book that sets up an "empty" sound by loading it from a file instead of using makeEmptySoundBySeconds. I like the makeEmptySoundBySeconds better personally. You can use whichever way you like. The example in the book puts together sounds of spoken words to make sentences. The examples in the sample Python file for today put notes together to make music. Same concept behind them to do both.
First example in the Python file: making a siren-like sound.
Second example in the Python file: making a scale of notes - plays C, D, E, F, G, A, B, C.
Other fun: make your own song by putting the appropriate notes into a new sound file. You may need to use makeEmptySound instead of makeEmptySoundBySeconds to have notes that last for less than 1 second.
Next time: making code that is more "modular" - easier to reuse.
And make sure to take the quiz, and type things into JES to try them out!