Created
January 6, 2014 05:32
-
-
Save lattejed/8278706 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int fromPPQ15360TicksToSamples (int ticks, int tempo, int sampleRate) | |
{ | |
// ticks -> samples | |
// 3.9025 = 60000 (milliseconds / min) / 15360 (ticks per quarter note) | |
return (3.9025 * sampleRate * ticks) / (double)tempo; | |
} | |
int fromSamplesToPPQ15360Ticks (int sampleOffset, int tempo, int sampleRate) | |
{ | |
// samples -> ticks | |
// 3.9025 = 60000 (milliseconds / min) / 15360 (ticks per quarter note) | |
return (sampleOffset * tempo) / (3.9025 * sampleRate); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment