Digitization - Why? ● Easier to manipulate digital audio ● Easier to store digital audio ● Easier to transport digital audio ● Get back perfect original analog audio
Sampling ● Sampling Frequency > 44100 : Oversampling ● Sampling Frequency < 44100 : Undersampling ● 44100Hz => ○ 44100 samples per second ○ 44100 data points per second ● Less computation vs Audio Fidelity
Buffer Size - Latency Ideally we want.... ● Fill up next buffer well before current is fully output. (No clicks/silence) ● Have no delay between audio being sent to the OS and output. (No buffering)
Callback Example - AS3 var mySound:Sound = new Sound(); function sineWaveGenerator(event:SampleDataEvent):void { for ( var c:int=0; c<8192; c++ ) { event.data.writeFloat(Math.sin((Number(c+event. position)/Math.PI/2))*0.25); event.data.writeFloat(Math.sin((Number(c+event. position)/Math.PI/2))*0.25); } } mySound.addEventListener(SampleDataEvent.SAMPLE_DATA, sineWaveGenerator); mySound.play();