Exemple #1
0
def main():
    # the filename of the midi file to read music from
    input_midi_filename = "beethoven74/beethoven74fin02.MID"
    # the directory to save the generated frames to
    frame_save_dir = "beethoven74/full01/"

    # rendering parameters of all midi tracks in the midi file
    tracks = [
        {}, # dummy track if first track is just meta events
    	{ 'name': "vln1",
          'color': (0.973, 0.129, 0.093), # red
          'width': 24,
          'z-index': 4 # higher is on top
        },
        { 'name': "vln2",
          'color': (0.929, 0.710, 0.137), # yellow
          'width': 24,
          'z-index': 3
        },
        { 'name': "vla",
          'color': (0.078, 0.659, 0.129), # green
          'width': 24,
          'z-index': 2
        },
        { 'name': "vc",
          'color': (0.098, 0.443, 1), # blue
          'width': 24,
          'z-index': 1
        },
    ]

    # for changing the block speed in the middle of an animation
    speed_map = [
        {'time': 0.0, 'speed': 5}, # time is in seconds from first event
        {'time': 99.217, 'speed': 12}
    ]

    # dimensions of generated image files
    dimensions = 1920, 1080
    # the intended fps of the animation
    fps = 29.97
    # pitches to be displayed at bottom and top of screen
    min_pitch, max_pitch = 34, 98
	
	# debugging options
    first_frame, last_frame = None, None
    every_nth_frame = 1
    do_render = True

    # enough config, let's render that shit
    renderer = MusAnimRenderer()
    renderer.render(input_midi_filename, frame_save_dir, tracks, speed_map=speed_map,
        dimensions=dimensions, first_frame=first_frame, last_frame=last_frame,
		min_pitch=min_pitch, max_pitch=max_pitch,
        every_nth_frame=every_nth_frame, do_render=do_render)
Exemple #2
0
def main():
    # the filename of the midi file to read music from
    input_midi_filename = "gould/gouldsyncfull04.MID"
    # the directory to save the generated frames to, relative to this file
    frame_save_dir = "gould/full03/"

    soprano_lyrics = '''So you want to write a fugue? * * You've got the urge to
write a fugue. * * You've ^got the nerve to write * a * fugue. So go * a- *
^head, go a- head and * write a fugue. * Write a fugue that * we can sing. Give
no mind to what we've told you. Give no heed to what we've told you. Pay no mind
to what we've told you, what _we've told you. Just for- get all that we've told
you and the theo- ry that you've read. Pay no mind, give no heed to * what we've
* told you. Pay no mind to what we've told you, what we've said. Come and write
one. ^Oh, do come and write one, oh, write us a fugue. Yes, write a fugue that we
can sing, that we can sing. ^For ^the on- ly way to ^write ^one is just to plunge
right in and ^write * one. ^So just for get the rules * and * write one, have _a
try. * For the on- ly way to write * one is just to plunge right in and ^write *
^one. So just ig- nore the rules * and * write one. It's * ^a * pleas- ure that is
bound * to * sat- is- fy. And the fun of it ^will ^get you, And the _joy of ^it will
_fetch you, it will fetch you. ^You'll _de- cide ^that John Se- bas- ^tian must have
been a ver- y per- son- a- ble guy. And * a * bit of aug- men- ta- tion is a se-
ri- ous temp- ta- tion, While a stret- ti dim- in- u- * tion, is an ob- vi- ous
so- lu- * tion, While a stret- ti, stret- ti stret- _ti dim- in- u- tion is a ver-
y, ver- y ob- vi- ous sol- u- tion. Nev- er be clev- er for the sake of show-
ing off. No, ^nev- er be clev- er for the sake of be- ing clev- ^er. But do try to
write a fugue that we can sing, * * that we can sing. * * Just write a fugue
that we * can sing. * Now, why don't you try to write ^one? Try to write a fugue
for sing- ing. Write us a fugue _that we can sing. Come a- _long now. It's rath-
er awe- some is- n't it? Well? Yes. Now _we're going to write a fugue. * _We're
going to write a fugue right now.
'''
    alto_lyrics = '''^So you want to write a _fugue? * * You've ^got the urge to
^write a fugue. * * You've ^got the nerve to write * a * fugue. * You've got the
nerve to write * a * fugue that we * can * sing. Come a- long, go a- ^head and
_write one. Go a- head and write one, and write a good fugue, one that we can
sing. Go a- head * * write a fugue that * we can sing. Go a- head * and write a
fugue for sing- ing. Pay no ^heed to what we've told you, Pay no ^mind ^to what
we've told you. Give no heed to what we've told you, ^to what we've told you.
Just for- get all that we've told you and the theo- ry that * you've read, the
theo- ry that you've ^read. Pay no mind, give no heed to * what we've * told you.
Oh, give you mind to what we've * said. Pay no mind, give no heed to what we've
told you, what we've said. ^For the _on- _ly _way _to write one is just to _plunge
right in and write * one. So just for _get the _rules * and * write one. Why *
don't * you * have a try? For the on- ly way to write * one is just to
_plunge right in and write * one. So just ig- nore the rules * and * write a
fugue. It's a pleas- ure that is bound _to sat- is- fy. And the fun of it will
get you, And _the _joy of it will _fetch you. _You'll de- cide that _John Se- bas-
tian, _You'll de- cide that _John Se- bas- tian _was _a per- son- a- ble guy.
But nev- er be clev- er for the sake of be- ing clev- er, For a can- on in in-
ver- sion is a dan- ger- ous di- ver- sion. A bit of aug- men- ta- tion is a se-
ri- ous temp- ta- * tion. Nev- er be clev- er for _the sake of show- * ing off.
But nev- er be clev- er for the sake of be- ing clev-
er, for the sake of * show- * * * * * * * * * * ing _off. Now, ^why don't you
write _a ^fugue, * * _why don't _you try to ^write * one? * Write us a fugue * that
we * can sing. * Now come a- long. And when you've fin- ished writ- ing it I
think you'll ^find a great joy in it. Well? Why not? Now _we're going to write a
fugue. * _We're going to write a fugue right now.
'''
    tenor_lyrics = '''So you want to write a fugue? * * You've got the urge to
write a fugue. * * You've ^got the nerve to write * a * fugue. So go * a- * ^head,
* so go a- head, * and write a fugue. * * * * * So go a- head and write a fugue
that we * can * _sing. Go a- head, write a fugue, and write ^a fugue that we can
^sing. Go a- head, _write _a fugue that _we can sing * * that we can sing * * and
write a fugue that we can sing. Come a- long, go a- head, write a _fugue that we
can sing. Go a- head, write a fugue * that * we can sing, * * * * and write a
fugue that we can _sing. Write a good fugue, one for sing- ing. Write a fugue
that we can sing. So * go a- head * and write a fugue, and write a fugue that *
we can sing. _Come, write a good fugue. Come, write a good fugue. _Come, write a
good fugue. Pay no mind to what we've told you. Just for- get all that we've
told you and the theo- ry * that you've * read, the theo- ry that you've ^read.
* _Pay no * mind, give no heed to * what we've * told you. ^For the on- ly way _to
write * one is just to plunge right in and write * one. So just for- get the
rules * and * write one. Have * a * try, have a try, * have a _try. For the on
ly way to write one is to plunge right _in and write one. Just ig- nore the rules
* and * try. And the fun of it will get you, _And the joy of it will fetch _you,
It's a pleas- ure that ^is bound to sat- is- fy, to sat- is- fy. So why don't you
try? For the on- ly way to write one is to ^plunge right in. * * * * * * * * *
You'll de- cide that John Se- bas- _tian must have been a ver- y per- son- a-
ble, been a ver- y per- son- a- ble guy. So nev- er be clev- er For the sake of
be- ing clev- er, For the sake of show- ing off. Nev- er be clev- er for the
sake of show- ing off. ^So you want _to write a fugue. * * You've got the urge to
write a fugue. * * _You've got the nerve to write * a * fugue. * You've got the
urge to write * a * fugue that we * can * sing. _So write a fugue _that ^we can
sing. Why _don't you _try to write _one? _Write a fugue _that we can _sing. * Write
a fugue that we can sing. * Oh, come a long. Well? Yes. Now _We're going to write
a good one. _We're going to write a fugue right now.
'''
    bass_lyrics = '''So you want to write a fugue? * * You've got the urge to
write a fugue, * * You've ^got the nerve to write * a * fugue. So go * a- * head,
so go * a- * head, go a- head ^and write a fugue, Go a- head, go a- head, go a-
head and write a fugue, write ^a fugue. Go a- head, write a fugue. You've ^got the
nerve to write ^a fugue. So come a- * long * and * write a * fugue. * Go a- head,
* write ^a fugue. * Oh, come ^a- long and write _a fugue * that * we * can * sing,
that we can sing. Go a- head, write a fugue that we can sing. Go a- head, write
a fugue, write a fugue _that we can sing. Write a good fugue, one that we can
sing, And write a good fugue, one that we can sing. Come a- long, write a fugue,
* that * we can * sing. Write a good fugue, one that we can * sing, that we can
sing. Come, write a fugue, come, write a fugue for sing- ing. Come, write a
fugue, come a- long and write a fugue for sing- ing. Come, write a good fugue.
Come, write a good fugue. Come, write a good fugue. Come, write ^a fugue that we
can sing. * _Come, write a good fugue, Come write a good fugue. _Come write a
fugue that we can sing. Oh, come, * * come, * * come and write one. Come write
a fugue that * we can * sing. * Come, write ^a fugue that * we can sing. * _Come,
write a fugue that * we can sing. * Come, write ^a fugue, write a fugue that we
can sing, that * we can * sing. _Come, for the on- ly way to write * one is just
to plunge right in and write * one. So just for- get the rules, * and * write
one. Have * a * _try, have a try, have a try. Plunge right in, have a try. Try to
write one. Yes, try to write a fugue. Have a try, plunge _right in and write one.
Yes, just for- get all * that we've told you. Yes, plunge right _in, have a try,
and write one. Yes, _plunge right in, have a try. Oh yes! Why don't you? Why
don't you write a fugue * now? For the on- ly way to write one is to plunge
right in. Just ig- ^nore _the rules and write one. _Have a try, * have ^a try. The
fun of it will get ^you, Joy of it will fetch you. You'll de- cide that John Se-
bas- tian was a per- son- a- ble guy. So nev- er be clev- er For the sake of
be- ing clev- er, For the sake of show- ing off. Nev- er be clev- * er for the
sake of show- ing off. So you want to write a fugue? * * _You've got the urge to
write a fugue. * * _You've got the nerve to write * a * fugue. So go * a- * head
and try to * write one, try to * write one. _Write us a good fugue, one that * we
* can * sing. Oh, come * and try. Oh, why don't you try? Oh, _won't you try to
write one * we can sing? Yes, come, let's try. Write us a fugue right now.
(Hope so.) _Well, noth- ^ing ven- tured noth- ing gained, _they say. But still it
is rath- er hard to start. Let us try. Right now? _We're going to write a good
one. _We're going to write a fugue right now.
'''

    # rendering parameters of all midi tracks in the midi file
    tracks = [
        {}, # dummy track if first track is just meta events
        { 'name': "soprano",
          'color': (0.973, 0.129, 0.093), # red
          'width': 10,
          'z-index': 4, # higher is on top
          'lyrics': soprano_lyrics
        },
        { 'name': "alto",
          'color': (0.929, 0.710, 0.137), # yellow
          'width': 10,
          'z-index': 3,
          'lyrics': alto_lyrics
        },
        { 'name': "tenor",
          'color': (0.078, 0.659, 0.129), # green
          'width': 10,
          'z-index': 2,
          'lyrics': tenor_lyrics
        },
        { 'name': "bass",
          'color': (0.098, 0.443, 1), # blue
          'width': 10,
          'z-index': 1,
          'lyrics': bass_lyrics
        },
        { 'name': "vln1",
          'color': (0.917, 0.384, 0.149), # red
          'width': 10,
          'z-index': 0,
        },
        { 'name': "vln2",
          'color': (0.776, 0.769, 0.098), # yellow
          'width': 10,
          'z-index': -1,
        },
        { 'name': "viola",
          'color': (0.075, 0.568, 0.353), # green
          'width': 10,
          'z-index': -2,
        },
        { 'name': "cello",
          'color': (0.188, 0.153, 0.945), # blue
          'width': 10,
          'z-index': -3,
        },
    ]

    # for changing the block speed in the middle of an animation
    # time is in seconds from first event, speeds are in pixels per second
    speed_map = [
        {'time': 0.0, 'speed': 4},
    ]

    # dimensions of generated image files
    dimensions = 720, 480
    # the intended fps of the animation
    fps = 29.97
    # pitches to be displayed at bottom and top of screen
    min_pitch, max_pitch = 34, 86

    # debugging options
    first_frame, last_frame = None, None
    every_nth_frame = 1
    do_render = True

    # enough config, let's render that shit
    renderer = MusAnimRenderer()
    renderer.render(input_midi_filename, frame_save_dir, tracks,
        first_frame=first_frame, last_frame=last_frame,
        every_nth_frame=every_nth_frame, do_render=do_render)
Exemple #3
0
def main():
    # the filename of the midi file to read music from
    input_midi_filename = "shostakovich10/shostakovich10midi01.MID"
    # the directory to save the generated frames to
    frame_save_dir = "shostakovich10/cut01/"

    # rendering parameters of all midi tracks in the midi file
    tracks = [
        {},  # dummy track if first track is just meta events
        {
            'name': "picc",
            'color': (0.725, 0.871, 1.0),
            'width': 20,
            'layer': 3,
        },
        {
            'name': "fl",
            'color': (0.475, 0.749, 1.0),
            'width': 20,
            'layer': 3,
        },
        {
            'name': "ob",
            'color': (0.231, 0.431, 1.0),
            'width': 20,
            'layer': 2,
        },
        {
            'name': "ebclar",
            'color': (0.31, 0.82, 1.0),
            'width': 20,
            'layer': 2,
        },
        {
            'name': "bbclar",
            'color': (0.0, 0.643, 0.933),
            'width': 20,
            'layer': 2,
        },
        {
            'name': "bsn",
            'color': (0.098, 0.118, 1.0),
            'width': 20,
            'layer': 2,
        },
        {
            'name': "cbsn",
            'color': (0.102, 0.118, 0.784),
            'width': 20,
            'layer': 2,
        },
        {
            'name': "horn",
            'color': (1, .611, .098),
            'width': 22,
            'layer': 2,
        },
        {
            'name': "horn2",
            'color': (1, .360, .004),
            'width': 22,
            'layer': 2,
        },
        {
            'name': "tpt",
            'color': (1.0, 0.824, 0.176),
            'width': 22,
            'layer': 2,
        },
        {
            'name': "tpt1",
            'color': (0.902, 0.667, 0.0),
            'width': 22,
            'layer': 2,
        },
        {
            'name': "tbn",
            'color': (0.992, 0.157, 0.075),
            'width': 22,
            'layer': 2,
        },
        {
            'name': "tbn2",
            'color': (0.886, 0.0, 0.086),
            'width': 22,
            'layer': 2,
        },
        {
            'name': "timp",
            'color': (0.659, 0.318, 0.212),
            'width': 36,
            'layer': 0,
        },
        {
            'name': "xyl",
            'color': (0.945, 0.671, 1.0),
            'width': 22,
            'layer': 6,
        },
        {
            'name': "snare",
            'color': (0.816, 0.631, 0.361),
            'width': 20,
            'layer': 0,
        },
        {
            'name': "vln1",
            'color': (0.725, .796, .043),
            'width': 12,
            'layer': 5,
        },
        {
            'name': "vln2",
            'color': (0.53, .8, .054),
            'width': 12,
            'layer': 5,
        },
        {
            'name': "vla",
            'color': (0.164, .67, .082),
            'width': 12,
            'layer': 5,
        },
        {
            'name': "vc",
            'color': (0.016, .509, .180),
            'width': 12,
            'layer': 5,
        },
        {
            'name': "cb",
            'color': (0.031, .463, .317),
            'width': 12,
            'layer': 5,
        },
    ]

    # for changing the block speed in the middle of an animation
    speed_map = [
        {
            'time': 0.0,
            'speed': 10
        },  # time is in seconds from first event
    ]

    # dimensions of generated image files
    dimensions = 1920, 1080
    # the intended fps of the animation
    fps = 29.97
    # pitches to be displayed at bottom and top of screen
    min_pitch, max_pitch = 28, 108

    # debugging options
    first_frame, last_frame = None, None
    every_nth_frame = 1
    do_render = True

    # enough config, let's render that shit
    renderer = MusAnimRenderer()
    renderer.render(input_midi_filename,
                    frame_save_dir,
                    tracks,
                    speed_map=speed_map,
                    dimensions=dimensions,
                    first_frame=first_frame,
                    last_frame=last_frame,
                    min_pitch=min_pitch,
                    max_pitch=max_pitch,
                    every_nth_frame=every_nth_frame,
                    do_render=do_render)
Exemple #4
0
def main():
    tracks = [
        {
            'name': "track0",
            'color': (0.000, 0.996, 0.000),
            'width': TRACK_WIDTH,
            'z-index': 0
        },
        {
            'name': "track1",
            'color': (0.996, 0.000, 0.000),
            'width': TRACK_WIDTH,
            'z-index': 1
        },
        {
            'name': "track2",
            'color': (0.004, 0.996, 0.992),
            'width': TRACK_WIDTH,
            'z-index': 2
        },
        {
            'name': "track3",
            'color': (0.996, 0.855, 0.398),
            'width': TRACK_WIDTH,
            'z-index': 3
        },
        {
            'name': "track4",
            'color': (0.563, 0.980, 0.570),
            'width': TRACK_WIDTH,
            'z-index': 4
        },
        {
            'name': "track5",
            'color': (0.000, 0.461, 0.996),
            'width': TRACK_WIDTH,
            'z-index': 5
        },
        {
            'name': "track6",
            'color': (0.832, 0.996, 0.000),
            'width': TRACK_WIDTH,
            'z-index': 6
        },
        {
            'name': "track7",
            'color': (0.996, 0.574, 0.492),
            'width': TRACK_WIDTH,
            'z-index': 7
        },
        {
            'name': "track8",
            'color': (0.992, 0.535, 0.000),
            'width': TRACK_WIDTH,
            'z-index': 8
        },
        {
            'name': "track9",
            'color': (0.520, 0.660, 0.000),
            'width': TRACK_WIDTH,
            'z-index': 9
        },
        {
            'name': "track10",
            'color': (0.000, 0.680, 0.492),
            'width': TRACK_WIDTH,
            'z-index': 10
        },
        {
            'name': "track11",
            'color': (0.738, 0.773, 0.996),
            'width': TRACK_WIDTH,
            'z-index': 11
        },
        {
            'name': "track12",
            'color': (0.738, 0.824, 0.574),
            'width': TRACK_WIDTH,
            'z-index': 12
        },
        {
            'name': "track13",
            'color': (0.000, 0.723, 0.090),
            'width': TRACK_WIDTH,
            'z-index': 13
        },
        {
            'name': "track14",
            'color': (0.004, 0.813, 0.996),
            'width': TRACK_WIDTH,
            'z-index': 14
        },
        {
            'name': "track15",
            'color': (0.566, 0.813, 0.793),
            'width': TRACK_WIDTH,
            'z-index': 15
        },
        {
            'name': "track16",
            'color': (0.730, 0.531, 0.000),
            'width': TRACK_WIDTH,
            'z-index': 16
        },
        {
            'name': "track17",
            'color': (0.867, 0.996, 0.453),
            'width': TRACK_WIDTH,
            'z-index': 17
        },
        {
            'name': "track18",
            'color': (0.000, 0.996, 0.773),
            'width': TRACK_WIDTH,
            'z-index': 18
        },
        {
            'name': "track19",
            'color': (0.996, 0.895, 0.008),
            'width': TRACK_WIDTH,
            'z-index': 19
        },
        {
            'name': "track20",
            'color': (0.594, 0.996, 0.320),
            'width': TRACK_WIDTH,
            'z-index': 20
        },
        {
            'name': "track21",
            'color': (0.000, 0.996, 0.469),
            'width': TRACK_WIDTH,
            'z-index': 21
        },
        {
            'name': "track22",
            'color': (0.996, 0.430, 0.254),
            'width': TRACK_WIDTH,
            'z-index': 22
        },
        {
            'name': "track23",
            'color': (0.645, 0.996, 0.820),
            'width': TRACK_WIDTH,
            'z-index': 23
        },
        {
            'name': "track24",
            'color': (0.996, 0.691, 0.402),
            'width': TRACK_WIDTH,
            'z-index': 24
        },
        {
            'name': "track25",
            'color': (0.000, 0.605, 0.996),
            'width': TRACK_WIDTH,
            'z-index': 25
        },
    ]

    if len(sys.argv) < 3:
        print(
            "Usage: python MusAnimLauncher.py input.mid outputDirectory [--dynamic]"
        )
        sys.exit(1)
        return

    mid = sys.argv[1]

    lexer = MidiLexer()
    lexer.lex(mid)

    frames_dir = sys.argv[2] + os.sep
    os.makedirs(frames_dir)

    dynamic = len(sys.argv) >= 4 and sys.argv[3] == '--dynamic'

    speed_map = [{'time': 0.0, 'speed': 4}]

    #dimensions = 426, 240
    dimensions = 720, 480
    #dimensions = 1920, 1080

    fps = 25
    #fps = 29.97

    renderer = MusAnimRenderer()
    renderer.introduction = False
    renderer.render(mid,
                    frames_dir,
                    tracks,
                    speed_map=speed_map,
                    dimensions=dimensions,
                    min_pitch=lexer.minPitch - PITCH_GRACE,
                    max_pitch=lexer.maxPitch + PITCH_GRACE,
                    fps=fps,
                    dynamicmode=dynamic)
Exemple #5
0
def main():
    # the filename of the midi file to read music from
    input_midi_filename = "gould/gouldsyncfull04.MID"
    # the directory to save the generated frames to, relative to this file
    frame_save_dir = "gould/1080p01/"

    soprano_lyrics = '''So you want to write a fugue? * * You've got the urge to
write a fugue. * * You've ^got the nerve to write * a * fugue. So go * a- *
^head, go a- head and * write a fugue. * Write a fugue that * we can sing. Give
no mind to what we've told you. Give no heed to what we've told you. Pay no mind
to what we've told you, what _we've told you. Just for- get all that we've told
you and the theo- ry that you've read. Pay no mind, give no heed to * what we've
* told you. Pay no mind to what we've told you, what we've said. Come and write
one. ^Oh, do come and write one, oh, write us a fugue. Yes, write a fugue that we
can sing, that we can sing. ^For ^the on- ly way to ^write ^one is just to plunge
right in and ^write * one. ^So just for get the rules * and * write one, have _a
try. * For the on- ly way to write * one is just to plunge right in and ^write *
^one. So just ig- nore the rules * and * write one. It's * a * pleas- ure that is
bound * to * sat- is- fy. And the fun of it ^will ^get you, And the _joy of ^it will
_fetch you, it will fetch you. ^You'll de- cide ^that John Se- bas- ^tian must _have
been a ver- y per- son- a- ble guy. And * a * bit of aug- ^men- _ta- tion is a se-
ri- ous temp- ta- tion, While a stret- ti dim- in- u- * tion, is an ob- vi- ous
so- lu- * tion, While a stret- ti, stret- ti ^stret- _ti ^dim- _in- u- tion is a ver-
y, ver- y ob- vi- ous sol- u- tion. Nev- er be clev- er for the sake of show-
ing off. No, ^nev- er be clev- er for the sake of be- ing clev- ^er. But do try to
write a fugue that we can sing, * * that we can sing. * * Just write a fugue
that we * can sing. * Now, why don't you try to write ^one? Try to write a fugue
for sing- ing. Write us a ^fugue _that we can sing. Come a- long now. It's rath-
er awe- some is- n't it? Well? Yes. Now _we're going to write a fugue. * _We're
going to write a fugue _right now.
'''
    alto_lyrics = '''^So you want to write a _fugue? * * You've ^got the urge to
^write a fugue. * * You've ^got the nerve to write * a * fugue. * You've got the
nerve to write * a * fugue that we * can * sing. Come a- long, go a- ^head and
_write one. Go a- head and write one, and write a good fugue, one that we can
sing. Go a- head * * write a fugue that * we can sing. Go a- head * and write a
fugue for sing- ing. Pay no ^heed to what we've told you, Pay no ^mind ^to what
we've told you. Give no heed to what we've told you, ^to what we've told you.
Just for- get all that we've told you and the theo- ry that * you've read, the
theo- ry that you've ^read. Pay no mind, give no heed to * what we've * told you.
Oh, give you mind to what we've * said. Pay no mind, give no heed to what we've
told you, what we've said. ^For the _on- _ly _way _to write one is just to _plunge
right in and write * one. So just for _get the _rules * and * write one. Why *
don't * you * have a try? For the on- ly way to write * one is just to
_plunge right in and write * one. So just ig- nore the rules * and * write a
fugue. It's a pleas- ure that is bound _to sat- is- fy. And the fun of it will
get you, And _the _joy of it will _fetch you. _You'll de- cide that _John Se- bas-
tian, _You'll de- cide that _John Se- bas- _tian was a per- son- a- ble guy.
But nev- er be clev- er for the sake of be- ing clev- er, For a can- on in in-
ver- sion is a dan- ger- ous di- ver- sion. A bit of aug- ^men- _ta- tion is a se-
ri- ous temp- ta- * tion. Nev- er be clev- er for _the sake of show- * ing off.
But nev- er be clev- er for the sake of be- ing clev-
er, for the sake of * show- * * * * * * * * * * ing _off. Now, ^why don't you
write _a ^fugue, * * _why don't ^you try to ^write * one? * Write us a fugue * that
we * can sing. * Now come a- long. And when you've fin- ished writ- ing it I
think you'll ^find a great joy in it. Well? Why not? Now _we're going to write a
fugue. * _We're going to write a fugue _right now.
'''
    tenor_lyrics = '''So you want to write a fugue? * * You've got the urge to
write a fugue. * * You've ^got the nerve to write * a * fugue. So go * a- * ^head,
* so go a- head, * and write a fugue. * * * * * So go a- head and ^write ^a fugue
that we * can * _sing. Go a- head, write a fugue, and write ^a fugue that we can
^sing. Go a- head, _write _a fugue that _we can sing * * that we can sing * * and
write a fugue that we can sing. Come a- long, go a- head, write a _fugue ^that we
can sing. Go a- head, write a fugue * that * we can sing, * * * * and write a
fugue that we can _sing. Write _a good fugue, one for sing- ing. Write a fugue
that we can sing. So * go a- head * and write a fugue, and ^write a fugue that *
we can sing. _Come, write a good fugue. Come, write ^a good fugue. _Come, write a
good fugue. Pay no mind to what we've told you. Just for- get all that we've
told you and the theo- ry * that you've * read, the theo- ry that you've ^read.
* _Pay no * mind, give no heed to * what we've * told you. ^For the on- ly way _to
write * one is just to plunge right in and write * one. So just for- get the
rules * and * write one. Have * a * try, have a try, * have a _try. For the on
ly way to write one is to plunge right _in and write one. Just ig- nore the rules
* and * try. And the fun of it will get you, _And the joy of it will fetch _you,
It's a pleas- ure that ^is bound to sat- is- fy, to sat- is- fy. So why don't you
try? For the on- ly way to write one is to ^plunge right in. * * * * * * * * *
You'll _de- cide that John Se- bas- _tian must have been a ver- y per- son- a-
ble, been a ver- y per- son- a- ble guy. So nev- er be clev- er For the sake of
be- ing clev- er, For the sake of show- ing off. Nev- er be clev- er for the
sake of show- ing off. ^So you want _to write a fugue. * * You've got the urge to
write a fugue. * * _You've got the nerve to write * a * fugue. * You've got ^the
urge to write * a * fugue that we * can * ^sing. _So write a fugue _that ^we can
sing. Why _don't you _try to write _one? _Write a fugue _that we can _sing. * Write
a fugue that we can sing. * Oh, come a long. Well? Yes. Now _We're going to write
a good _one. _We're going to write a fugue _right now.
'''
    bass_lyrics = '''So you want to write a fugue? * * You've got the urge to
write a fugue, * * You've ^got the nerve to write * a * fugue. So go * a- * head,
so go * a- * head, go a- head ^and write a fugue, Go a- head, go a- head, go a-
head and write a fugue, write ^a fugue. Go a- head, write a fugue. You've ^got the
nerve to write ^a fugue. So come a- * long * and * write a * fugue. * Go a- head,
* write ^a fugue. * Oh, come ^a- long and write _a fugue * that * we * can * sing,
that we can sing. Go a- head, write a fugue that we can sing. Go a- head, write
a fugue, write a fugue _that we can sing. Write a good fugue, one that we can
sing, And write a good fugue, one that we can sing. Come a- long, write a fugue,
* that * we can * sing. Write a good fugue, one that we can * sing, that we can
sing. Come, write a fugue, come, write a fugue for sing- ing. Come, write a
fugue, come a- long and write a fugue for sing- ing. Come, write a good fugue.
Come, write a good fugue. Come, write a good fugue. Come, write ^a fugue that we
can sing. * _Come, write a good fugue, Come write a good fugue. _Come write a
fugue that we can sing. Oh, come, * * come, * * come and write one. Come write
^a fugue that * we can * sing. * Come, write ^a fugue that * we can sing. * _Come,
write a fugue that * we can sing. * Come, write ^a fugue, write a fugue that we
can sing, that * we can * sing. _Come, for the on- ly way to write * one is just
to plunge right in and write * one. So just for- get the rules, * and * write
one. Have * a * _try, have a try, have a try. Plunge ^right in, have a try. Try to
write one. Yes, try to write a fugue. Have a try, plunge _right in and write one.
Yes, just for- get all * that we've told you. Yes, plunge right _in, have a try,
and write one. Yes, _plunge right in, have _a try. Oh yes! Why don't you? Why
don't you write a fugue * now? For the on- ly way to write one is to plunge
right in. Just ig- ^nore _the rules ^and write one. _Have a try, * have ^a try. The
fun of it will get ^you, Joy of it will fetch you. You'll de- cide that John Se-
bas- tian was a per- son- a- ble guy. So nev- er be clev- er For the sake of
be- ing clev- er, For the sake of show- ing off. Nev- er be clev- * er for the
sake of show- ing off. So you want to write a fugue? * * _You've got the urge to
write a fugue. * * _You've got the nerve to write * a * fugue. So go * a- * head
and try to * write one, try to * write one. _Write us a good fugue, one that * we
* can * sing. Oh, come * and try. Oh, why don't you try? Oh, _won't you try to
write one * we can sing? Yes, come, let's try. Write us a fugue right now.
(Hope so.) _Well, noth- ^ing ven- tured noth- ing gained, _they say. But still it
is rath- er hard to start. Let us try. Right now? _We're going to write a good
_one. _We're going to write a fugue _right now.
'''

    # rendering parameters of all midi tracks in the midi file
    tracks = [
        {},  # dummy track if first track is just meta events
        {
            'name': "soprano",
            'color': (0.973, 0.129, 0.093),  # red
            'width': 25,
            'z-index': 4,  # higher is on top
            'lyrics': soprano_lyrics
        },
        {
            'name': "alto",
            'color': (0.929, 0.710, 0.137),  # yellow
            'width': 25,
            'z-index': 3,
            'lyrics': alto_lyrics
        },
        {
            'name': "tenor",
            'color': (0.078, 0.659, 0.129),  # green
            'width': 25,
            'z-index': 2,
            'lyrics': tenor_lyrics
        },
        {
            'name': "bass",
            'color': (0.098, 0.443, 1),  # blue
            'width': 25,
            'z-index': 1,
            'lyrics': bass_lyrics
        },
        {
            'name': "vln1",
            'color': (0.917, 0.384, 0.149),  # red
            'width': 25,
            'z-index': 0,
        },
        {
            'name': "vln2",
            'color': (0.776, 0.769, 0.098),  # yellow
            'width': 25,
            'z-index': -1,
        },
        {
            'name': "viola",
            'color': (0.075, 0.568, 0.353),  # green
            'width': 25,
            'z-index': -2,
        },
        {
            'name': "cello",
            'color': (0.188, 0.153, 0.945),  # blue
            'width': 25,
            'z-index': -3,
        },
    ]

    # for changing the block speed in the middle of an animation
    # time is in seconds from first event, speeds are in pixels per second
    speed_map = [
        {
            'time': 0.0,
            'speed': 12
        },
    ]

    # dimensions of generated image files
    dimensions = 1920, 1080
    # the intended fps of the animation
    fps = 29.97
    # pitches to be displayed at bottom and top of screen
    min_pitch, max_pitch = 34, 86

    # debugging options
    first_frame, last_frame = None, None
    every_nth_frame = 1
    do_render = True

    # enough config, let's render that shit
    renderer = MusAnimRenderer()
    renderer.render(input_midi_filename,
                    frame_save_dir,
                    tracks,
                    speed_map=speed_map,
                    dimensions=dimensions,
                    first_frame=first_frame,
                    last_frame=last_frame,
                    every_nth_frame=every_nth_frame,
                    do_render=do_render)
Exemple #6
0
def main():
    # the filename of the midi file to read music from
    input_midi_filename = "shostakovich10/shostakovich10midi01.MID"
    # the directory to save the generated frames to
    frame_save_dir = "shostakovich10/cut01/"

    # rendering parameters of all midi tracks in the midi file
    tracks = [
        {}, # dummy track if first track is just meta events
    	{ 'name': "picc",
          'color': (0.725, 0.871, 1.0), 
          'width': 20,
          'layer': 3,
        },
		{ 'name': "fl",
          'color': (0.475, 0.749, 1.0), 
          'width': 20,
          'layer': 3,
        },
		{ 'name': "ob",
          'color': (0.231, 0.431, 1.0), 
          'width': 20,
          'layer': 2,
        },
		{ 'name': "ebclar",
          'color': (0.31, 0.82, 1.0), 
          'width': 20,
          'layer': 2,
        },
		{ 'name': "bbclar",
          'color': (0.0, 0.643, 0.933), 
          'width': 20,
          'layer': 2,
        },
        { 'name': "bsn",
          'color': (0.098, 0.118, 1.0), 
          'width': 20,
          'layer': 2,
        },
        { 'name': "cbsn",
          'color': (0.102, 0.118, 0.784), 
          'width': 20,
          'layer': 2,
        },
        { 'name': "horn",
          'color': (1, .611, .098), 
          'width': 22,
          'layer': 2,
        },
        { 'name': "horn2",
          'color': (1, .360, .004), 
          'width': 22,
          'layer': 2,
        },
        { 'name': "tpt",
          'color': (1.0, 0.824, 0.176), 
          'width': 22,
          'layer': 2,
        },
        { 'name': "tpt1",
          'color': (0.902, 0.667, 0.0), 
          'width': 22,
          'layer': 2,
        },
        { 'name': "tbn",
          'color': (0.992, 0.157, 0.075), 
          'width': 22,
          'layer': 2,
        },
        { 'name': "tbn2",
          'color': (0.886, 0.0, 0.086), 
          'width': 22,
          'layer': 2,
        },
        { 'name': "timp",
          'color': (0.659, 0.318, 0.212), 
          'width': 36,
          'layer': 0,
        },
        { 'name': "xyl",
          'color': (0.945, 0.671, 1.0), 
          'width': 22,
          'layer': 6,
        },
		{ 'name': "snare",
          'color': (0.816, 0.631, 0.361), 
          'width': 20,
          'layer': 0,
        },
		{ 'name': "vln1",
          'color': (0.725, .796, .043), 
          'width': 12,
          'layer': 5,
        },
		{ 'name': "vln2",
          'color': (0.53, .8, .054), 
          'width': 12,
          'layer': 5,
        },
		{ 'name': "vla",
          'color': (0.164, .67, .082), 
          'width': 12,
          'layer': 5,
        },
		{ 'name': "vc",
          'color': (0.016, .509, .180), 
          'width': 12,
          'layer': 5,
        },
		{ 'name': "cb",
          'color': (0.031, .463, .317), 
          'width': 12,
          'layer': 5,
        },
    ]

    # for changing the block speed in the middle of an animation
    speed_map = [
        {'time': 0.0, 'speed': 10}, # time is in seconds from first event
    ]

    # dimensions of generated image files
    dimensions = 1920, 1080
    # the intended fps of the animation
    fps = 29.97
    # pitches to be displayed at bottom and top of screen
    min_pitch, max_pitch = 28, 108
	
	# debugging options
    first_frame, last_frame = None, None
    every_nth_frame = 1
    do_render = True

    # enough config, let's render that shit
    renderer = MusAnimRenderer()
    renderer.render(input_midi_filename, frame_save_dir, tracks, speed_map=speed_map,
        dimensions=dimensions, first_frame=first_frame, last_frame=last_frame,
		min_pitch=min_pitch, max_pitch=max_pitch,
        every_nth_frame=every_nth_frame, do_render=do_render)
Exemple #7
0
def main():
    tracks = [
    	{ 'name': "track0",
	'color': (0.000, 0.996, 0.000),
	'width': TRACK_WIDTH,
	'z-index': 0
	},
	{ 'name': "track1",
	'color': (0.996, 0.000, 0.000),
	'width': TRACK_WIDTH,
	'z-index': 1
	},
	{ 'name': "track2",
	'color': (0.004, 0.996, 0.992),
	'width': TRACK_WIDTH,
	'z-index': 2
	},
	{ 'name': "track3",
	'color': (0.996, 0.855, 0.398),
	'width': TRACK_WIDTH,
	'z-index': 3
	},
	{ 'name': "track4",
	'color': (0.563, 0.980, 0.570),
	'width': TRACK_WIDTH,
	'z-index': 4
	},
	{ 'name': "track5",
	'color': (0.000, 0.461, 0.996),
	'width': TRACK_WIDTH,
	'z-index': 5
	},
	{ 'name': "track6",
	'color': (0.832, 0.996, 0.000),
	'width': TRACK_WIDTH,
	'z-index': 6
	},
	{ 'name': "track7",
	'color': (0.996, 0.574, 0.492),
	'width': TRACK_WIDTH,
	'z-index': 7
	},
	{ 'name': "track8",
	'color': (0.992, 0.535, 0.000),
	'width': TRACK_WIDTH,
	'z-index': 8
	},
	{ 'name': "track9",
	'color': (0.520, 0.660, 0.000),
	'width': TRACK_WIDTH,
	'z-index': 9
	},
	{ 'name': "track10",
	'color': (0.000, 0.680, 0.492),
	'width': TRACK_WIDTH,
	'z-index': 10
	},
	{ 'name': "track11",
	'color': (0.738, 0.773, 0.996),
	'width': TRACK_WIDTH,
	'z-index': 11
	},
	{ 'name': "track12",
	'color': (0.738, 0.824, 0.574),
	'width': TRACK_WIDTH,
	'z-index': 12
	},
	{ 'name': "track13",
	'color': (0.000, 0.723, 0.090),
	'width': TRACK_WIDTH,
	'z-index': 13
	},
	{ 'name': "track14",
	'color': (0.004, 0.813, 0.996),
	'width': TRACK_WIDTH,
	'z-index': 14
	},
	{ 'name': "track15",
	'color': (0.566, 0.813, 0.793),
	'width': TRACK_WIDTH,
	'z-index': 15
	},
	{ 'name': "track16",
	'color': (0.730, 0.531, 0.000),
	'width': TRACK_WIDTH,
	'z-index': 16
	},
	{ 'name': "track17",
	'color': (0.867, 0.996, 0.453),
	'width': TRACK_WIDTH,
	'z-index': 17
	},
	{ 'name': "track18",
	'color': (0.000, 0.996, 0.773),
	'width': TRACK_WIDTH,
	'z-index': 18
	},
	{ 'name': "track19",
	'color': (0.996, 0.895, 0.008),
	'width': TRACK_WIDTH,
	'z-index': 19
	},
	{ 'name': "track20",
	'color': (0.594, 0.996, 0.320),
	'width': TRACK_WIDTH,
	'z-index': 20
	},
	{ 'name': "track21",
	'color': (0.000, 0.996, 0.469),
	'width': TRACK_WIDTH,
	'z-index': 21
	},
	{ 'name': "track22",
	'color': (0.996, 0.430, 0.254),
	'width': TRACK_WIDTH,
	'z-index': 22
	},
	{ 'name': "track23",
	'color': (0.645, 0.996, 0.820),
	'width': TRACK_WIDTH,
	'z-index': 23
	},
	{ 'name': "track24",
	'color': (0.996, 0.691, 0.402),
	'width': TRACK_WIDTH,
	'z-index': 24
	},
	{ 'name': "track25",
	'color': (0.000, 0.605, 0.996),
	'width': TRACK_WIDTH,
	'z-index': 25
	},
    ]

    if len(sys.argv)<3:
      print("Usage: python MusAnimLauncher.py input.mid outputDirectory")
      sys.exit(1)
      return

    mid=sys.argv[1]

    lexer = MidiLexer()
    lexer.lex(mid)

    frames_dir = sys.argv[2]+os.sep
    os.makedirs(frames_dir)

    speed_map = [{'time': 0.0, 'speed': 4}]

    #dimensions = 426, 240
    dimensions = 720, 480
    #dimensions = 1920, 1080

    fps = 25
    #fps = 29.97

    renderer=MusAnimRenderer()
    renderer.introduction=False
    renderer.render(mid, frames_dir, tracks,
      speed_map=speed_map,
      dimensions=dimensions,
      min_pitch=lexer.minPitch-PITCH_GRACE,
      max_pitch=lexer.maxPitch+PITCH_GRACE,
      fps=fps)