To make it more intuitive to control dynamic sound, I wrote a utility class, 'SoundSequencePlayer'.
With this class, sequences of sound can be assigned with a set of a pitch and a volume for given time. Here's a sample to show how to use this class:
download sample
Install flash player 10 or later if you don't see the sample movie.
With this class, sequences of sound can be assigned with a set of a pitch and a volume for given time. Here's a sample to show how to use this class:
import fl.events.ComponentEvent;
button.label = "play";
button.addEventListener(ComponentEvent.BUTTON_DOWN, h_playButtonDown);
var seq:SoundSequence = new SoundSequence();
seq.addPoint(0,C4,0);
seq.addPoint(1000,C4,1);
seq.addPoint(1500,D4,0.5);
seq.addPoint(2000,D4,0.5);
seq.addPoint(2500,E4,1);
seq.addPoint(3000,E4,1);
seq.addPoint(3500,D4,0.5);
seq.addPoint(4000,C4,0.2);
seq.addPoint(5000,C4,0.2);
seq.addPoint(5500,C4,0);
var player = new SoundSequencePlayer(seq);
function h_playButtonDown(evt:ComponentEvent):void {
player.play();
}
const A4:Number = 440;
const As4:Number = 466.1637615180899;
const B4:Number = 493.8833012561241;
const C4:Number = 523.2511306011972;
const Cs4:Number = 554.3652619537442;
const D4:Number = 587.3295358348151;
const Ds4:Number = 622.2539674441618;
const E4:Number = 659.2551138257398;
const F4:Number = 698.4564628660078;
const Fs4:Number = 739.9888454232688;
const G4:Number = 783.9908719634985;
const Gs4:Number = 830.6093951598903;
const A5:Number = 880;
const As5:Number = 932.3275230361799;
const B5:Number = 987.7666025122483;
const C5:Number = 1046.5022612023945;
const Cs5:Number = 1108.7305239074883;
const D5:Number = 1174.6590716696303;
const Ds5:Number = 1244.5079348883237;
const E5:Number = 1318.5102276514797;
const F5:Number = 1396.9129257320155;
const Fs5:Number = 1479.9776908465376;
const G5:Number = 1567.981743926997;
const Gs5:Number = 1661.2187903197805;
const A6:Number = 1760;
download sample
Install flash player 10 or later if you don't see the sample movie.



Leave a comment