Comments (3)
Your question doesn't make any sense. If you are using noteon/noteoff then you are responsible for timing, so you can pause in your code.
from midi.js.
Your question doesn't make any sense. If you are using noteon/noteoff then you are responsible for timing, so you can pause in your code.
Thanks for your reply,I didn't describe it clearly
I add two buttons in my page, play and pause, when click play button ,I put some notes to a notearray, and use noteon/noteoff to play sounds in circle, and when click pause button, I don't know how to pause these sound
Below is logic in play button:
var song = Util.convertToMidiPianoFormat(that.beatArray,that.selectedKey);
var delay = 0;
var velocity = 10; // how hard the note hits
for(let i in song){
MIDI.noteOn(0, song[i][0], velocity, delay);
delay = delay + song[i][1];
MIDI.noteOff(0, song[i][0], delay);
}
from midi.js.
@ysfgmissbless You may try this ugly solution :-). Call this function on click of pause button. If required you can increase the maximum loop value.
`function stop() {
for (var i = 1; i < 9999; i++)
{
window.clearTimeout(i);
window.clearInterval(i);
}
}`
from midi.js.
Related Issues (20)
- very long notes are truncated HOT 2
- pitch bending in webaudio HOT 2
- How can i send a note to specific stereo channel? HOT 1
- tracks
- Audio Mobile App : MIDI.js or Native ? HOT 2
- k
- How to disable sound in Player.js?
- There is no sound when I am playing my own midi file HOT 2
- Question, Piano Layout HOT 1
- Midi files with multi channels doesn't work using MIDI.Player.Loadfile HOT 3
- How to play file.mid HOT 4
- can i use midi.js to create a online piano and guitar? HOT 1
- Color piano not found in chrome web store HOT 2
- Playing midi file with the wrong tempo HOT 1
- ReferenceError: Base64Binary is not defined HOT 1
- Current Position / Event Listener
- Loading all GM instruments for midi file HOT 25
- Slow start of playing HOT 3
- Bug: MIDI events not being fired HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from midi.js.