Creating music in AS3 Flash 10
Has been a while Flash 10 has been released and I never got really into the new sound capabilities.
So, here is a demo I made with the best game sound track ever.
Dragging the points in the graph will change the tone of the sound.
And of course, here is the source.
And a quick explanation about the code.
Komposer is the main class, who will playback the music.
Timbre is the class that defines the tone of the sound.
Track is a groups of notes that will play with the defined timbre. Currently it will only play one track.
Note is the class that defines the pitch(frequency) and the in/out of the sound.
var komposer:Komposer = new Komposer();
var timbre:Timbre = new Timbre();
timbre.addValue(0);
timbre.addValue(1);
timbre.addValue(-1);
timbre.addValue(0);
var track:Track = new Track(timbre);
track.addNote(new Note(Notes.toFrequency(Notes.C, Notes.OCTAVE_4), 0, 500));
track.addNote(new Note(Notes.toFrequency(Notes.D, Notes.OCTAVE_4), 500, 1000));
track.addNote(new Note(Notes.toFrequency(Notes.E, Notes.OCTAVE_4), 1000, 1500));
track.addNote(new Note(Notes.toFrequency(Notes.F, Notes.OCTAVE_4), 1500, 2000));
track.addNote(new Note(Notes.toFrequency(Notes.G, Notes.OCTAVE_4), 2000, 2500));
track.addNote(new Note(Notes.toFrequency(Notes.A, Notes.OCTAVE_5), 2500, 3000));
track.addNote(new Note(Notes.toFrequency(Notes.B, Notes.OCTAVE_5), 3000, 3500));
track.addNote(new Note(Notes.toFrequency(Notes.C, Notes.OCTAVE_5), 3500, 4000));
komposer.addTrack(track);
komposer.volume = 0.1;
komposer.play();
Danilo said,
May 17, 2009 @ 4:24 am
ace!
Edson Pavoni said,
May 17, 2009 @ 12:14 pm
awesome. Tks for share!
Felipe Bachian said,
May 18, 2009 @ 9:42 pm
Well done Keita!
Weekly Shared Items - 20. May, 2009 | TOXIN LABS - weblog of a german design student from wuerzburg said,
May 21, 2009 @ 2:56 am
[...] Creating music in AS3 Flash 10 [...]