Created
December 5, 2023 02:26
-
-
Save No-Eul/57df8bdc27a6e0fee53377aee52e6051 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
var bpm = 165, duration = 273, sampleRate = 44100, sampleOffset = 35600, labelOffset = -2 * 2; | |
var mod = (a, b) => a - b * Math.floor(a / b); | |
var result = [...Array(Math.ceil(bpm * duration * 2 / 60))] | |
.map(($, i) => sampleOffset + Math.round(44100 * 60 * i / bpm / 2)) | |
.map(($, i) => `<point frame="${$}" label="${Math.floor((i + labelOffset) / 8) + 1}.${mod(Math.floor((i + labelOffset) / 2), 4) + 1}${mod(i + labelOffset, 2) + 1}" />`) | |
.join("\n"); | |
copy(result) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment