-
I'm looking for an ability to adjust the tonic of a melody being loaded into a player (+/- halftone). Any ideas and workarounds on how can I transpose a MIDI file? |
Beta Was this translation helpful? Give feedback.
Answered by
cifkao
Oct 19, 2021
Replies: 1 comment
-
All the notes in the file are accessible through for (const note of player.noteSequence.notes) {
note.pitch += 1;
} Then you will want to assign the note sequence back to the player (and visualizer, if you have one) to make sure it gets updated immediately: player.noteSequence = player.noteSequence;
visualizer.noteSequence = player.noteSequence; |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
skepsys
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
All the notes in the file are accessible through
player.noteSequence.notes
(player.noteSequence
is aNoteSequence
object from the Magenta.js library). So you can loop through them and change their pitches:Then you will want to assign the note sequence back to the player (and visualizer, if you have one) to make sure it gets updated immediately: