Archive for May, 2009

Controlling Pitch and Tempo

UPDATE: fixed the clicking noise correcting the zero-crossing, thanks to Caco Teixeira

Just another test now controlling the pitch and the tempo of the playback.
Source… soon, I’m re-writing the classes trying new approaches.

Vote in HexoSearch Vote

Comments (2)

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.

Komposer_0.0.1.zip.

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();

Komposer_0.0.1.zip.

Vote in HexoSearch Vote

Comments (4)