grimmdude / MidiWriterJS

♬ A JavaScript library which provides an API for programmatically generating and creating expressive multi-track MIDI files and JSON.
MIT License
560 stars 60 forks source link

Allow notes of zero length #17

Closed benbelow closed 8 years ago

benbelow commented 8 years ago

The use case being if I want to add just a rest, without necessitating a following note (as the current implementation of wait implies). A duration of 0 and non-zero wait should now allow this.

grimmdude commented 8 years ago

Hi Ben,

Thanks a lot for your pull request. What would be an example of a case where you would want a rest without a following note? Wouldn't that be the end?

-Garrett

benbelow commented 8 years ago

Hi Garrett,

I'm using the library to attempt to procedurally generate melodies, and there re a few cases where I'd like to be able to add a rest without yet knowing the next note in the sequence - for example, if I'm trying to exactly write one bar, and the last beat is a rest.

Cheers, Ben

grimmdude commented 8 years ago

Hi Ben,

Got it, this has been merged. Thanks for your help. Your project sounds interesting, let me know if it's somewhere I can check out.

-Garrett

benbelow commented 8 years ago

Hi Garrett,

the project should be publicly available on my Github here https://github.com/benbelow/MidiGenerator

I'm writing it as part of a song a week challenge I'm doing (this week's theme is 'experimental' :P) , so I don't expect to work on it as much after this week.

Cheers! Ben

lplume commented 8 years ago

@grimmdude this makes me think a refactor of the duration computation, both notes and rests. What do you think to centralize and generalize to allow any types of duration? Think of tuple families, long rest (a track could wait a long before start)

-mauro

grimmdude commented 8 years ago

Hi Mauro,

Couldn't these durations be accomplished with the existing method of computation?

-Garrett

lplume commented 8 years ago

@grimmdude aw, sorry, forgot its the same calculation as notes duration. After all it is fine, there are few duration that could be implemented (32th) and tuplets in general (tuplets of quarters, 16th as an example), finally the double dot. Let me know what you think, and maybe open a related issue. Thanks

-Mauro