Giter Club home page Giter Club logo

Comments (4)

tambien avatar tambien commented on September 10, 2024

Seems like the right API. PRs welcome!

from midi.

motifn avatar motifn commented on September 10, 2024

See pull request. Note that I didn't add any tests, but see some existing tests are failing for presumably passive reasons (where the mere presence of the new pitchBends field on Track makes existing tests fail). Should be straightforward for you to address.

Also, one simple tweak you could make to the pull request: rather than set the raw pitch value, set it like this:

value: Math.floor(pb.value * 8191.5)

This will translate incoming values where:

  • -1 = the maximum lowest bend
  • 1 = maximum highest bend
  • 0 = no bend

Then, whether you additionally want to truncate values not between -1 and 1,or error? Your call.

Haven't considered setting pitch wheel ranges; maybe leave that as a future feature for now?

References:

The underlying midi-file implementation:

	 case 'pitchBend':
	      eventTypeByte = 0xE0 | event.channel
	      if (eventTypeByte !== lastEventTypeByte) w.writeUInt8(eventTypeByte)
	      var value14 = 0x2000 + event.value
	      var lsb14 = (value14 & 0x7F)
	      var msb14 = (value14 >> 7) & 0x7F
	      w.writeUInt8(lsb14)
	      w.writeUInt8(msb14)

An article explaining the pitch bend encoding:
https://sites.uci.edu/camp2014/2014/04/30/managing-midi-pitchbend-messages/

from midi.

stale avatar stale commented on September 10, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

from midi.

tambien avatar tambien commented on September 10, 2024

closed by #82

from midi.

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.