-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
generatePatternSeqs features #21
base: master
Are you sure you want to change the base?
Changes from all commits
7219115
0ed1169
4bd8c60
0dd6d5e
0d1f5c9
513a888
11ede42
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
TestSimpleMIDIFile : UnitTest { | ||
*getFixturesPath { | ||
^( | ||
this.class.filenameSymbol.asString.dirname | ||
+/+ "test_fixtures" | ||
); | ||
} | ||
|
||
test_generatePatternSeqs_withVelocity { | ||
var m, pat; | ||
m = SimpleMIDIFile.new( | ||
this.class.getFixturesPath() +/+ "two-notes-w-velocity.mid" | ||
); | ||
|
||
m.read(); | ||
|
||
pat = m.generatePatternSeqs(true)[0]; | ||
|
||
this.assertEquals(pat, [ | ||
[60, 1.0, 75/127.0], | ||
[\rest, 1.0, 0.0], | ||
[60, 1.0, 100/127.0] | ||
]); | ||
|
||
} | ||
|
||
test_generatePatternSeqs_noPaddingBeginningStart { | ||
var m, pat; | ||
m = SimpleMIDIFile.new( | ||
this.class.getFixturesPath() +/+ "two-notes-beginning-start.mid" | ||
); | ||
|
||
m.read(); | ||
|
||
pat = m.generatePatternSeqs()[0]; | ||
|
||
this.assertEquals(pat, [ | ||
[60, 1.0], | ||
[\rest, 1.0], | ||
[60, 1.0] | ||
]); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the default / previous behavior. |
||
|
||
} | ||
|
||
test_generatePatternSeqs_noPaddingOffsetStart { | ||
var m, pat; | ||
m = SimpleMIDIFile.new( | ||
this.class.getFixturesPath() +/+ "two-notes-offset-start.mid" | ||
); | ||
|
||
m.read(); | ||
|
||
pat = m.generatePatternSeqs()[0]; | ||
|
||
this.assertEquals(pat, [ | ||
[60, 1.0], | ||
[\rest, 1.0], | ||
[60, 1.0] | ||
]); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Default / previous behavior. |
||
} | ||
test_generatePatternSeqs_padStart { | ||
var m, pat; | ||
m = SimpleMIDIFile.new( | ||
this.class.getFixturesPath() +/+ "two-notes-offset-start.mid" | ||
); | ||
|
||
m.read(); | ||
|
||
pat = m.generatePatternSeqs(false, true)[0]; | ||
|
||
this.assertEquals(pat, [ | ||
[\rest, 1.0], | ||
[60, 1.0], | ||
[\rest, 1.0], | ||
[60, 1.0] | ||
]); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Pads the start of the pattern with a rest, because the first note is a beat in. |
||
} | ||
test_generatePatternSeqs_padEnd { | ||
var m, pat; | ||
m = SimpleMIDIFile.new( | ||
this.class.getFixturesPath() +/+ "two-notes-beginning-start.mid" | ||
); | ||
|
||
m.read(); | ||
|
||
pat = m.generatePatternSeqs(false, true, 4.0)[0]; | ||
|
||
this.assertEquals(pat, [ | ||
[60, 1.0], | ||
[\rest, 1.0], | ||
[60, 1.0], | ||
[\rest, 1.0] | ||
]); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Pads the end of the pattern with a rest, because the last note ends at |
||
|
||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
3-tuple when velocity flag is set.