Posts Tagged ‘audio’

Dynamic Sound – Part 2

Wednesday, May 6th, 2009

Last post I started with the basic of dynamic sound in flash. Now we will do something more pratical with what we saw. We will create a piano that play notes by clicking or pressing keys.

I will not spend time creating the piano, so you can download it here.

This movie requires Flash Player 9

OK, starting here, we need to create a sound instance, a soundChannel instance, add the listeners and play the sound.

private var sound:Sound;
private var channel:SoundChannel;
 
public function Main():void{
	init();
 
	sound = new Sound();
	sound.addEventListener(SampleDataEvent.SAMPLE_DATA, onSampleData);
 
	channel = sound.play();
}
private function onSampleData(e:SampleDataEvent):void{
}

(more…)

Dynamic Sound – Part 1

Monday, April 27th, 2009

I spent the last couple weeks working on a project involving sound. Unfortunatly I can’t show it yet, but my goal was to play a bunch of musical notes at the same time in a especific interval. The first thing I tried to do was load a lot of samples and play then when I needed, but I got a slow performance with that. So my only solution was to dig out Google and Andre’s Michelle lab to know how to work with dynamic sound.

Well, I’m still learning, but I think that a lot of people would like to work with this and have no idea where to start, so I hope this post be usefull to you.

First thing we need to have in mind is that a sound is a wave, and this wave can have diferent shapes depending on the sound we are hearing.

sound_wave
(more…)