Nicolas Pirson :
Go to my website : tatactic.be [FR] (Website about hepatitis)
nicolas.pirson.me [FR - EN] (current website)
business card - blog
[FR - EN] (just for fun)
Nicolas Pirson CV page [FR] on tatactic.be
Back to AS3 - FLASH index ... [EN]
With a few lines of code, you can include a Sound in the library or load an external sound file, then draw and stop draw the sound wave.
The graphic part is easily resizable and customizable...
Colors of the containers, line tickness, colors of the containers, colors of the wave channels (left or right...)
AS3 test V 01.0.0
//Nothing on stage exept this code on frame 1 :
IMPORTS :
// import flash native classes if loading external Sound(optionnal)
// import classes to draw Sound
import tatactic.media.SoundGraph_Class;
import tatactic.media.sounds.ObjectSound_Class;
// ----------------------------------------------------------- //
// import optionnal classes for display Objects
import tatactic.display.CustomSPRITE;
// ----------------------------------------------------------- //
// import ContextMenuChangeClass
import tatactic.system.FlashPlayer_Class;
// ----------------------------------------------------------- //
// ----------------------------------------------------------- //
// variables declarations to create the Sound Object;
var soundAttached:ObjectSound_Class;
var testSound:ObjectSound_Class;
// ----------------------------------------------------------- //
fpsInfosText.x = 20;
fpsInfosText.y = 20;
fpsInfosText.autoSize = "left";
fpsInfosText.text = ".FLA Framerate = " + stage.frameRate + " (retrieved by : stage.frameRate)";
fpsInfosText.setTextFormat(preloaderTformat);
soundLoader.drawRectangle(1,10,0,0,0x857885,0xcccccc,0x000000,1,1);
soundLoader.place(50,50);
mp3_fileName = new String("quatreBoulesDeCuirPublic.mp3");
mp3_path = new String("medias/music/mp3/");
mp3_toLoad = new String(mp3_path + mp3_fileName);
mp3_URLRequest = new URLRequest(mp3_toLoad);
function createGraphObject():void{
myFirstGraph = new SoundGraph_Class(this,
testSound,
0,
0,
displayWidth,
displayHeight
)
// this calls the constructor for sound graph.
myFirstGraph.setbackgroundColors(0x2a3d2a,0x262A22,0.8,0.7);
// Customize a little the display:
// For more options to customize the look :
// Just edit tatactic/settings/DefaultsSettings_Class.as
myFirstGraph.displayWaveCoef(1.5,1.5);
// this coef multiply the wave height in the graph
// so here sometimes out of display limits BUT MASKED IF OVERSIZED!
// METHODS to CALL BEFORE to PLAY or LAUNCH here ABOVE !!!
myFirstGraph.playSoundObject(10000,0,null);
// 10 seconds of applauses skipped :)
// initialize and play the Sound (ComputeSpectrum, sets channel for Sound at startPlay...)
myFirstGraph.startDrawSound();
// if startDrawSound() is not called, Sound will NOT be drawed
myFirstGraph.place(middleX, middleY);
// here above : place the graph Object where you want.
// END MAIN APPLICATION.
// ----------------------------------------------------------- //
}
// ----------------------------------------------------------- //
// END frame 1 .fla