Returns a Synth object which can produces a variety of sounds, sound effects and music.
Example - Tetris Theme
function OnStart()
{
syn = app.CreateSynth();
syn.SetWaveShape( "Saw" );
syn.SetVcaSustain( 0.5 );
syn.SetVolume( 1, 1 );
syn.SetNoteLength( 2 );
syn.PlayMidiTune(
"76:4,71:8,72:8,74:4,72:8,71:8,69:4,69:8,72:8,76:4," +
"74:8,72:8,71:4,71:8,72:8,74:4,76:4,72:4,69:4,69:8," +
"69:8,71:8,72:8,74:8,74:4,77:8,81:4,79:8,77:8,76:8,76:4,72:8,76:4," +
"74:8,72:8,71:4,71:8,72:8,74:4,76:4,72:4,69:4,69:4"
);
}
from native import app
def OnStart():
syn = app.CreateSynth()
syn.SetWaveShape("Saw")
syn.SetVcaSustain(0.5)
syn.SetVolume(1, 1)
syn.SetNoteLength(2)
syn.PlayMidiTune(
"76:4,71:8,72:8,74:4,72:8,71:8,69:4,69:8,72:8,76:4," +
"74:8,72:8,71:4,71:8,72:8,74:4,76:4,72:4,69:4,69:8," +
"69:8,71:8,72:8,74:8,74:4,77:8,81:4,79:8,77:8,76:8,76:4,72:8,76:4," +
"74:8,72:8,71:4,71:8,72:8,74:4,76:4,72:4,69:4,69:4"
)
Example - Multiple Synths Song
function OnStart()
{
synth1 = app.CreateSynth();
synth1.SetWaveShape( "Saw" );
synth1.SetVcaSustain( 0.5 );
synth1.SetVcaDecay( 500 );
synth1.SetVolume( 1, 1 );
synth2 = app.CreateSynth();
synth2.SetWaveShape( "Saw" );
synth2.SetVcaDecay( 300 );
synth2.SetVolume( 1, 1 );
setTimeout('synth1.PlayMidiTune("35:4,35:4,35:4,35:4,31:4,31:4,30:4,30:4")', 0*5120);
setTimeout('synth1.PlayMidiTune("35:4,35:4,35:4,35:4,31:4,31:4,30:4,30:4")', 1*5120);
setTimeout('synth1.PlayMidiTune("35:4,35:4,35:4,35:4,31:4,31:4,30:4,30:4")', 2*5120);
setTimeout('synth1.PlayMidiTune("35:4,35:4,35:4,35:4,31:4,31:4,30:4,30:4")', 3*5120);
setTimeout('synth1.PlayMidiTune("35:4,35:4,35:4,35:4,31:4,31:4,30:4,30:4")', 4*5120);
setTimeout('synth1.PlayMidiTune("35:4,35:4,35:4,35:4,31:4,31:4,30:4,30:4")', 5*5120);
setTimeout('synth2.PlayMidiTune("59:4,59:8,59:8,62:8,59:4,57:8,55:2,54:2")', 2*5120);
setTimeout('synth2.PlayMidiTune("59:8,59:4,59:8,62:8,59:4,57:8,55:8,57:4,55:8,54:2")', 3*5120);
setTimeout('synth2.PlayMidiTune("59:4,59:8,59:8,62:8,59:4,57:8,55:2,54:2")', 4*5120);
setTimeout('synth2.PlayMidiTune("59:8,59:4,59:8,62:8,59:4,57:8,55:8,57:4,55:8,54:2")', 5*5120);
}
from native import app
def OnStart():
synth1 = app.CreateSynth()
synth1.SetWaveShape("Saw")
synth1.SetVcaSustain(0.5)
synth1.SetVcaDecay(500)
synth1.SetVolume(1, 1)
synth2 = app.CreateSynth()
synth2.SetWaveShape("Saw")
synth2.SetVcaDecay(300)
synth2.SetVolume(1, 1)
def playSynth1():
synth1.PlayMidiTune("35:4,35:4,35:4,35:4,31:4,31:4,30:4,30:4")
def playSynth2():
synth2.PlayMidiTune("59:4,59:8,59:8,62:8,59:4,57:8,55:2,54:2")
setTimeout(playSynth1, 0*5120)
setTimeout(playSynth1, 1*5120)
setTimeout(playSynth1, 2*5120)
setTimeout(playSynth1, 3*5120)
setTimeout(playSynth1, 4*5120)
setTimeout(playSynth1, 5*5120)
setTimeout(playSynth2, 2*5120)
setTimeout(playSynth2, 3*5120)
setTimeout(playSynth2, 4*5120)
setTimeout(playSynth2, 5*5120)