Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ideas for Midi controller input #17

Open
kylestetz opened this issue Jan 28, 2015 · 2 comments
Open

Ideas for Midi controller input #17

kylestetz opened this issue Jan 28, 2015 · 2 comments

Comments

@kylestetz
Copy link
Owner

I wanted to get down some notes I had on a possible midi controller API. I would love some feedback!

It would be cool to have a midi object, instantiated via var controller = new midi() (perhaps with some arguments to select the correct controller), and then use its functions the same way generators are used on tracks.

controller = new midi()
t = new track()
t.notes( controller.keys.notes() )
t.beat( controller.keys.beat() )
t.vol( controller.cc(20).map(0,1) )

So that controller.keys has several methods that return events from the keys, such as:

  • notes(): returns MIDI note values
  • beat(): returns events that trigger notes
  • map(min, max): returns the key values (0-127) mapped to the min & max

And controller.cc(number) has methods that return events from CC controllers:

  • map(min, max): returns controller values (0-127) mapped to the min & max
  • ?

Philosophy

My thought on this is that new CC and key values will only be read when a beat is triggered. This is consistent with how Lissajous currently interprets parameter sequences. There are two details of the implementation worth mentioning:

  1. schedulers will need to accept event handlers so that controller.keys.beat() can trigger a note, which will be more complicated because they already accept callbacks. This means it might have to be an object that inherits a prototype for the purposes of type checking (if typeof === 'MidiEvent etc).

  2. To avoid reading cc values from the midi controller (which would not be possible if you are mapping key values to a parameter) the last value for a given control will need to be cached. This should be really easy to create, simply saving anything that comes in and using that as the data source for the functions passed into parameters.

@kylestetz kylestetz added this to the Lissajous 1.0.0 milestone Jan 28, 2015
@renaudfv
Copy link

renaudfv commented Feb 3, 2015

I have started writing down the controller class during the WAC hackaton. I will take this issue in consideration and come back to you asap!

@kylestetz
Copy link
Owner Author

Sounds great, can't wait to check it out!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants