Packing a lot of sound files into an application is one method of including audio. Another method is the runtime generation of sound data. We'll produce some simple sine tones in this recipe, which vary based upon detected touch pressure.
We will examine how to generate audio sample byte data based upon user touch pressure and feed this into a
Sound object to generate a variety of tones:
import flash.display.Sprite; import flash.display.StageAlign; import flash.display.StageScaleMode; import flash.events.SampleDataEvent; import flash.events.TouchEvent; import flash.media.Sound; import flash.media.SoundChannel; import flash.ui.Multitouch; ...