Skip to content

How to transpose MIDI? #33

Answered by cifkao
skepsys asked this question in Q&A
Discussion options

You must be logged in to vote

All the notes in the file are accessible through player.noteSequence.notes (player.noteSequence is a NoteSequence object from the Magenta.js library). So you can loop through them and change their pitches:

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;

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by skepsys
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants