e4 = bass c5 = snare g5 = hihat e5 = tom1 d5 = tom2 a5 = tom3 g4 = tom4 #parsing from shitty human tab bar = list of hit hit = list of note, duration note = instrument, type for each measuredata Same system as before |o-------o---o-o-| |o-----o-o---o-o-| = 4(a,b) 2() 2(b) 4(a,b) 2(a,b) 2(a,b) for each 4 beats in 4/4, or 4 beats in 3/4, or 8 beats in 12/8, etc. same as before add to bar.hits #parsing to MUSICXML for hit in hits: if hit.instruments is empty type = rest; else hit.instruments[0], duration for i = 1; i < length(hit.instruments); i++: hit.instruments[i], duration, chord = true #MUSICXML from instrument & duration measure.add(""" <note> <unpitched> <display-step>{instrument.step}</display-step> <display-octave>{instrument.octave}</display-octave> </unpitched> <duration>bar.divisions * bar.beats * (duration - FRACTION)</duration> <voice>1</voice> <type>type(duration)</type> <notehead>note.type.notehead</notehead> </note> """
Run
Reset
Share
Import
Link
Embed
Language▼
English
中文
Python Fiddle
Python Cloud IDE
Follow @python_fiddle
Browser Version Not Supported
Due to Python Fiddle's reliance on advanced JavaScript techniques, older browsers might have problems running it correctly. Please download the latest version of your favourite browser.
Chrome 10+
Firefox 4+
Safari 5+
IE 10+
Let me try anyway!
url:
Go
Python Snippet
Stackoverflow Question