speaker speaker.frequency(f) do.every(10ms) : distanceSensor.value -> speaker.frequency // creates a theramin speaker.playNote( note number, volume, duration ) note number = 1 to 88 and beyond, as in piano key numbers plays all notes as a sine wave at frequency of given note, EG: draw a piano keyboard on a piece of paper, each key 1cm wide, then place a distance sensor at the edge of the paper, and do: do.every(10ms) : distanceSensor.cm -> math.add(36) -> speaker.playNote and voila', you are playing the piano. The math shifts it up 3 octaves. speaker.setScaleMode(type number) type is: 1=chromatic, 2=major, 3=harmonic minor, 4=blues, etc. speaker.setScaleReference(frequency)) sets frequency for middle A, defaults to 440Hz. speaker.setWaveformForAllNotes gives a custom waveform to replace sine waves for all notes, adjusted to frequency of each note. Custom waveform is stored in a memory. speaker.playNoteFromWaveforms( note number, volume, duration ) Uses a different waveform for each note, stored in memories # 1 to 88. Now we've got a fully general sound synth. speaker.playRaw Inputs one digital sample and sets analog output correspondingly. Thus: do.atRate(20000) -> mike.raw -> speaker.playRaw do.atRate(20000) -> mike.raw -> math.addReverb(20,100) -> speaker.playRaw define speaker.playRawWithReverb(r,a,b) : math.addReverb(a,b) -> speaker.playRaw do.atRate(20000) -> mike.raw -> speaker.playRawWithReverb(20000,20,100) Text to speech functions ------------------------ speaker.say("hello, how are you?") runs text-to-speech algorithm. distanceSensor.ifLessThan(6 ft) -> speaker.say("Step away from the vehicle!") speaker.sayInFrench("phrase") define speaker.sayInFrench(text) : language.translate("english","french") -> speaker.say Example: mike.avgVolume_db(10 sec) -> math.stopIfLessThan(80) -> speaker.sayInFrench("Please be quiet!") -> phone.txt(555-1212, "noise levels exceeded");