In case Flash no longer exists; a copy of this site is included in the Flashpoint archive's "ultimate" collection.

Dead Code Preservation :: Archived AS3 works from wonderfl.net

flash on 2010-5-19

SiON testing
Get Adobe Flash player
by wwuu 19 May 2010
/**
 * Copyright wwuu ( http://wonderfl.net/user/wwuu )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/oZKD
 */

// SiON testing
package {
    import flash.display.Sprite;
   	import org.si.sion.*;
   	import org.si.sion.events.*;
   	import org.si.sion.effector.*;
   	import org.si.sion.sequencer.*;
   	import org.si.sound.*;
   	import org.si.sound.synthesizers.*;
   	
    public class SiON extends SiONDriver {

	private var bs:BassSequencer = new BassSequencer("o3C", 15);
	private var dm:DrumMachine = new DrumMachine(0,0,0,2,2,2);
	private var back:SiONData, fill:SiONData, fill2:SiONData;
	private var analogSynth:AnalogSynth = new AnalogSynth();
	
	function SiON(onBeat:Function, onNoteOn:Function) : void {
		super();

		setVoice(0, new SiONVoice(5,2,63,63,-10,0,2,20));
        back = compile("#EFFECT1{delay312,30,1};%5@0,40@v64,32q1s24$o6b-r2.;");
        fill = compile("#A=o7[crgrfrcrgrfcrgfr];r1^1%6@0l16@v32,16q8$A(7)A(5);%2@f0,2,16q8s20@0,10%t1,1,0c1^1^8;%2q0s32l16v4[cc(]16;@v128%5@5q0s32,-128o3$c;");
        fill2= compile("#A=o7[drargrdrargaragr];%6@0l16@v16,8q8$AA");
        bpm = 132;
        setSamplerData(0, render("%2@v128q0s32o4g16"));
        setSamplerData(1, render("#A=%6@0q0s20o3c*<<<g;A;kt7A"));
        setSamplerData(37, render("%6@0o7q8l64cb-f"));
        setSamplerData(39, render("%6@0o7q8l64gcd"));
        setSamplerData(88, render("%6@0o4q8l32g*<<g"));
        setSamplerData(90, render("%6@0o4q8l32f*<<f"));
        addEventListener(SiONTrackEvent.BEAT, onBeat);
        addEventListener(SiONTrackEvent.NOTE_ON_FRAME, onNoteOn);
        addEventListener(SiONEvent.STREAM_STOP, _onStreamStop);
        dm.volume = 0.6;
        bs.synthesizer = analogSynth;
        bs.volume = 0.4;
        analogSynth.setVCAEnvelop(0,   0.3, 0.7, 0.2);
        analogSynth.setVCFEnvelop(0.4, 0.3, 0.1, 0.6, 0.7);
    }

	public function set measure(m:int) : void {
		switch (m) {
			case 1: dm.bass.mute = false;
 			break;
        	case 4: dm.hihat.mute = false;
 			break;
        	case 8: bs.mute = false;
 			bs.fadeIn(16);
 			break;
        	case 10: bpm = 105;
 			break;
        	case 12: bpm = 110;
 			analogSynth.setVCFEnvelop(0.45, 0.3, 0.1, 0.6, 0.75);
 			break;
         	case 14: bpm = 115;
 			analogSynth.setVCFEnvelop(0.5,  0.3, 0.1, 0.6, 0.8);
  			break;
        	case 16: bpm = 120;
 			analogSynth.setVCFEnvelop(0.55, 0.3, 0.1, 0.6, 0.85);
 			break;
        	case 18: bpm = 125;
 			analogSynth.setVCFEnvelop(0.6,  0.3, 0.1, 0.6, 0.85);
 			break;
        	case 20: bpm = 132;
 			dm.snare.mute = false;
 			dm.hihatPatternNumber = 2;
 			break;
        	case 24: sequenceOn(fill, null, 0, 0, 16);
 			break;
        	case 28: sequenceOn(fill2, null, 0, 0, 16);
 			break;
        }
	}
	public function start() : void {
		bpm = 100;
        fadeIn(4);
        play(back);
        dm.snarePatternNumber = 0;
        dm.hihatPatternNumber = 13;
        dm.snare.mute = true;
        dm.hihat.mute = true;
        dm.bass.mute = true;
        bs.mute = true;
        dm.play();
        bs.play();
    }
	public function end() : void {
		fadeOut(4);
    }
	public function se(i:int, pan:int=0, len:int=0, qnt:int=1) : void {
		var t:SiMMLTrack = playSound(i, len, 0, qnt);
        t.effectSend1 = 32;
        t.pan = pan;
    }
	private function _onStreamStop(e:SiONEvent) : void {        bs.stop();
        dm.stop();
    }
}
}