Comments (12)
That's a great point, and yes, I believe it can! A few people were running into this issue, so definitely a worthwhile change that shouldn't take long to make. I'll put this on the TODO list for the next update.
from midi.js.
Great, thanks!
from midi.js.
The latest release gives the option of XHR or SCRIPT tag. XHR allows for onProgress event to be fired, and the percentage of download left to be calculated (cross domain possible but only with CORS enabled server/browser combo). SCRIPT allows for file:// access and other cross-domain queries.
from midi.js.
w00t!
from midi.js.
Before I dig in further, did you test this in Firefox? (My player seems to have stopped working in FF after this change.)
from midi.js.
Thanks for reporting. It should work now!
from midi.js.
Thanks for the fix. Verified that this works.
It seems that noteOff on HTML5 Audio Tag has the same bug that the WebAudio
one had (incorrect delay setting for realtime audio.)
On Fri, Jan 25, 2013 at 6:34 PM, Michael Deal [email protected]:
Thanks for reporting. It should work now!
—
Reply to this email directly or view it on GitHubhttps://github.com//issues/9#issuecomment-12726151.
Mohit Muthanna [mohit (at) muthanna (uhuh) com]
from midi.js.
Currently noteOff for Audio Tag looks like this:
root.noteOff = function (channel, note, delay) { };
At one point it looked more like this;
root.noteOff = function (channel, note, delay) {
setTimeout(function() {
channels[channel].pause();
}, delay * 1000)
};
(or something like that) but, that really didn't sound great without the linear ramp down...
it sounds like you're saying there is an issue with the noteOn working again, after noteOff?
from midi.js.
It sounds like noteOff doesn't work when playing realtime. Here's what I mean:
Go here: http://my.vexflow.com/playground.html
And paste in the following VexTab:
options stave-distance=30 instrument=brass_section player=true
tabstave notation=true key=A time=4/4
voice
notes :q (5/2.5/3.7/4) :8 7p5h6/3 ^3^ 5h6h7/5 ^3^ :q 7V/4 |
notes :8 t12p7/4 s5s3/4 :8 3s:16:5-7/5 :q p5/4
voice
notes :h 5/6 :q 5/6 :8 3-5/6 | :w 5/5
tabstave notation=true
notes :q (5/4.5/5)s(7/4.7/5)s(5/4.5/5) ^3^
notes :q ## :8 (5/4.5/5)h(7/5) |
notes :8 t(12/5.12/4)s(5/5.5/4) 3b4/5
notes :h (5V/6.5/4.6/3.7/2) $.medium.A13$ $.italic.let ring$
Notice that Chrome correctly switches the note off, while firefox doesn't. If you set the instrument to acoustic_grand_piano
it's all fine, because the tone decays quickly.
Here's how I implement note/chord playing (it's CoffeeScript). playNote
gets called by setInterval based on the note's temporal position on the stave:
playNote: (notes) ->
for note in notes
continue if note.isRest()
keys = note.getPlayNote()
duration = note.getTicks().value() / (@tpm/60)
for key in keys
[note, octave] = key.split("/")
note_value = noteValues[note]
midi_note = (21 + (octave * 12)) + noteValues[note].int_val
MIDI.noteOn(0, midi_note, 127, 0)
MIDI.noteOff(0, midi_note, duration)
from midi.js.
Right, so, what I was saying is the noteOff for HTML5 audio is currently an empty function, so that's why noteOff doesn't do anything. The reason for switching this off, was it was sounding pretty aweful without the linear ramping... I'll post some code for you in a few for you to hear what it sounds like.
from midi.js.
Ok, I've updated the made some slight tweaks and pushed the changes;
Let me know what you think... might be better than nothing?
from midi.js.
Oops, sorry I missed the first part of your message (noteOff has empty implementation).
Thanks for the tweaks. I'll patch in your changes and try.
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
- Is it impossible to pause when using noteon noteoff instead of player HOT 3
- 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.