Git Product home page Git Product logo

Comments (12)

mudcube avatar mudcube commented on July 17, 2024

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.

0xfe avatar 0xfe commented on July 17, 2024

Great, thanks!

from midi.js.

mudcube avatar mudcube commented on July 17, 2024

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.

0xfe avatar 0xfe commented on July 17, 2024

w00t!

from midi.js.

0xfe avatar 0xfe commented on July 17, 2024

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.

mudcube avatar mudcube commented on July 17, 2024

Thanks for reporting. It should work now!

from midi.js.

0xfe avatar 0xfe commented on July 17, 2024

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.

mudcube avatar mudcube commented on July 17, 2024

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.

0xfe avatar 0xfe commented on July 17, 2024

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.

mudcube avatar mudcube commented on July 17, 2024

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.

mudcube avatar mudcube commented on July 17, 2024

Ok, I've updated the made some slight tweaks and pushed the changes;

1513dda

Let me know what you think... might be better than nothing?

from midi.js.

0xfe avatar 0xfe commented on July 17, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.