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

SiON練習その6 その他音源でコード表現、できてる???

/**
 * Copyright siouxcitizen ( http://wonderfl.net/user/siouxcitizen )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/1oC1
 */

// forked from siouxcitizen's SiON練習その5 その他音源でのMML再生
//
package {
    import flash.display.Sprite;
    import org.si.sion.*;
    import com.bit101.components.*;
    import flash.events.MouseEvent;
    public class SiONRensyu extends Sprite {
        public var driver:SiONDriver = new SiONDriver();
        public var mainMelody:SiONData;
        function SiONRensyu() {
            var mml:String = "t100;";
            //音色定義(%5, @4 = 三角波)
            mml += "%5@4 l8 cdefgab<c   r  c>bagfedc;";
            //音色定義(%5, @4 = 三角波)
            //コード表現のつもり。。。
            mml += "%5@4 l8  c^e^c^^<c  r  c^^^>e^^c;";
            mml += "%5@4 l8  e^g^e^^a   r  a^^^g^^e;";
            mml += "%5@4 l8  g^b^g^^f   r  f^^^b^^g;";
        	    mainMelody = driver.compile(mml);
        	    new PushButton(this, 10, 20, "play", mml_play);
        	    new PushButton(this, 150, 20, "stop", mml_stop);
        }        
        private function mml_play(e:MouseEvent):void{
			driver.play(mainMelody);
        }
		private function mml_stop(e:MouseEvent):void{
			driver.stop();
		}
    }
}