Exemplo n.º 1
0
def compiler_test():
    mmls = ("t115o5l8f2r8cfa>c<ar8fgr8ggr8d4r8gfr8ef2r8cfa>c<ar8fg-r8g-g-r8f1r8",
            "t115o4l8a2r8aa>cfcr8<ab-r8b-b-r8b-4r8b-b-r8b-a2r8aa>cfcr8<ab-r8b-b-r8a1r8",
            "t115o2l16v6f.r32f.r32f.r32f.r32r4f.r32f.r32f.r32f.r32r4"
            "f.r32f.r32f.r32f.r32r4f.r32f.r32f.r32f.r32r4"
            "f.r32f.r32f.r32f.r32r4f.r32f.r32f.r32f.r32r4"
            "f.r32f.r32f.r32f.r32r8f1r8")


    mml_compiler = MMLCompiler()
    sequences = [mml_compiler.to_sequence(mml) for mml in mmls]
    tones = [Tone(), Tone(), SquareWaveOscillator()]

    seq = Sequencer()
    seq.add_track(0, "track_0", tones[0], tones[0])
    seq.add_track(1, "track_1", tones[1], tones[1])
    seq.add_track(2, "track_3", tones[2], tones[2])

    seq.add_sequence(0, sequences[0])
    seq.add_sequence(1, sequences[1])
    seq.add_sequence(2, sequences[2])

    sink = WaveFileSink(output_file_name="output.wav")
    clock = Clock()

    renderer = Renderer(clock=clock, source=seq, sink=sink)
    renderer.do_rendering()
Exemplo n.º 2
0
def main():
    mml_compiler = MMLCompiler()
    music_sequence = mml_compiler.to_sequence(MML)

    osc = SquareWaveOscillator()
    sequencer = Sequencer()
    sequencer.add_track(0, "tone1", osc, osc)
    sequencer.add_sequence(0, music_sequence)

    sink = WaveFileSink(output_file_name="output.wav")
    clock = Clock()
    renderer = Renderer(clock=clock, source=sequencer, sink=sink)
    renderer.do_rendering()
Exemplo n.º 3
0
def main():
    mml_compiler1 = MMLCompiler()
    mml_compiler2 = MMLCompiler()
    mml_compiler3 = MMLCompiler()
    music_sequence1 = mml_compiler1.to_sequence(MML1)
    music_sequence2 = mml_compiler2.to_sequence(MML2)
    music_sequence3 = mml_compiler3.to_sequence(MML3)

    osc1 = SquareWaveOscillator()
    osc2 = SquareWaveOscillator()
    osc3 = SquareWaveOscillator()
    sequencer = Sequencer()
    sequencer.add_track(0, "tone1", osc1, osc1) # 一つ目のoscが周波数をかえる先(オシレーター)、2つ目はデータを取り出す元(通常ならばアンプとかミキサー)
    sequencer.add_track(1, "tone2", osc2, osc2)
    sequencer.add_track(2, "tone3", osc3, osc3)

    sequencer.add_sequence(0, music_sequence1)
    sequencer.add_sequence(1, music_sequence2)
    sequencer.add_sequence(2, music_sequence3)

    sink = WaveFileSink(output_file_name="output.wav")
    clock = Clock()
    renderer = Renderer(clock=clock, source=sequencer, sink=sink)
    renderer.do_rendering()