question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Correct way to play sequence of notes

See original GitHub issue

I have a sequence of notes with delay data. I trigger this sequence of notes using noteOn function and I loop function noteOn for number of notes.

Manytimes, result is not good and notes do not play as they come in sequence. Some ending notes and some starting notes start playing together when loop is started, because of this result is not good for few seconds in the starting.

Can anybody guide what is correct way to play sequence of notes

Here is code sample

var notes = [67, 78, 67 ,67,90, 56,..,...,....]
var delay = [.........]
for(var i=0; l < notes.length; i++)
{
MIDI.noteOn(channel, notes[i], velocity, delay[i]);
}

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6

github_iconTop GitHub Comments

2reactions
DoomTaycommented, Jun 11, 2017

How is delay determined?

I’ve found that if delay is replaced with i or i + MIDI.getContext().currentTime, that will cause the notes to play in sequence

1reaction
shivrajsacommented, Aug 29, 2017

Thanks @DoomTay , your solutions works. Here is how I have implemented it.

var notes = [67, 78, 67 ,67,90, 56,..,...,....];
var delay = [.........],tmpdelay=0;
var ctxtime = MIDI.getContext().currentTime;
for(var i=0; l < notes.length; i++)
{
MIDI.noteOn(channel, notes[i], velocity, ctxtime+tmpdelay);
tmpdelay = tmpdelay + delay[i]
}

@rbdedu hope this helps you too.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Sequence Numbers – Game Instructions - JAX Games
PLAY : Beginning with the player to the left of the dealer and moving in a clockwise direction, he/she selects a card of...
Read more >
SEQUENCE NUMBERS · GAME INSTRUCTIONS
The dealer should shuffle the cards and deal out the same number of cards to each player (see below for proper number of...
Read more >
javascript - AudioContext how to play the notes in a sequence
This way you can control start time and end time for each note in the sequence. var context = new AudioContext(); var notes...
Read more >
Sequence (music) - Wikipedia
For the means of triggering musical notes, see Music sequencer. In music, a sequence is the restatement of a motif or longer melodic...
Read more >
Beginning Melodic Sequences | StudyBass
To play a melodic sequence you take a short melodic phrase and play it off of each note of a scale or chord...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found