paulrosen / abcjs

javascript for rendering abc music notation
Other
1.91k stars 281 forks source link

Feature request: swing feel setting in midi genetation #73

Open njouve opened 7 years ago

njouve commented 7 years ago

Hi Paul, As you know some kinds of music (jazz , irish hornpipes) are written straight but played "dotted" or swung. The idea would be to add a boolean parameter "swing" to the midiParams that would do this kind of transformation to the tune turning by dotting the first note of each group of two notes and halving the second one before rendering the MIDI giving to the tune the required "swung feel" . What do you think ?

gregdyke commented 7 years ago

I think the swing amount should be configurable. I think abcmidi already has something in place to do that

On Wed, Dec 14, 2016 at 7:27 PM, Nicolas JOUVE notifications@github.com wrote:

Hi Paul, As you know some kinds of music (jazz , irish hornpipes) are written straight but played "dotted" or swung. The idea would be to add a boolean parameter "swing" to the midiParams that would do this kind of transformation to the tune turning by dotting the first note of each group of two notes and halving the second one before rendering the MIDI giving to the tune the required "swung feel" . What do you think ?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/paulrosen/abcjs/issues/73, or mute the thread https://github.com/notifications/unsubscribe-auth/AAJECcD09m5T7k0fRs3jBA656N7MAwkKks5rIDUOgaJpZM4LNQPT .

-- Post-Doc Researcher ICAR / Labex ASLAN Lyon University / CNRS / ENS Lyon http://perso.ens-lyon.fr/gregory.dyke

njouve commented 7 years ago

Thank you Greg for the info but currently my software ( https://play.google.com/store/apps/details?id=nodeslight.tradmusician2&hl=en )relies on abcjs for midi and svg rendering and it would be a pain to switch to a native package only to get this feature.

paulrosen commented 7 years ago

I think what abcmidi does is look at the R: field and has some presets for that. (I might be wrong.) I agree with Greg that it should be configurable. What would that look like? Perhaps it should be a new MIDI parameter, something like:

{ swing: float }

where float is the amount of swing, either a positive or negative number.

And what would be swung? In 4/4, should it be beats 2 and 4? Or should it be all the offbeats, (thinking 8 to the bar?) Or should that be configurable?

And what happens if there is a complicated rhythm? Which notes get moved how much?

Actually implementing this in MIDI is fairly easy. Coming up with a way to describe what should happen might be hard.

njouve commented 7 years ago

The Idea would be to give an option to people knowing what they do and the way the music they have should be played despite the usual "incorrect" way of notating it in their particular style.
So this option might give wrong or unexpected results when applied in the wrong context or wih a wrong setting. I guess it should make some hypothesis upon the homogeneity of the tune and the kind of rythm. For example a swing feel setting appropriate for irish hornpipes would be 1.5;0.5 meaning for every 2 beats make the first one last one half more and the second one last half its original value... I'm not music theory savvy enough to see if can be generalized for all kind of music and time signatures...

paulrosen commented 7 years ago

Well, my intuition says that it would be dumb to try to do that intelligently... The parameter could also be "irish", "swing", etc, which would just be a preset value. I need to find some samples of different types of tunes and play with it. I could judge a few styles but not a wide variety of them.

gregdyke commented 7 years ago

That was my point : abc2midi already has some parameters for describing this. We should follow the same notation as them (to start off with)

On 15 Dec 2016, 03:57 +0100, Paul Rosen notifications@github.com, wrote:

Well, my intuition says that it would be dumb to try to do that intelligently... The parameter could also be "irish", "swing", etc, which would just be a preset value. I need to find some samples of different types of tunes and play with it. I could judge a few styles but not a wide variety of them.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub (https://github.com/paulrosen/abcjs/issues/73#issuecomment-267225368), or mute the thread (https://github.com/notifications/unsubscribe-auth/AAJECSPj5K9Om_3RF0RMrW6Ey6ekk9HMks5rIKyXgaJpZM4LNQPT).

chrisfargen commented 4 years ago

As a musician who plays jazz standards, I can say this functionality would be wonderful. Perhaps this could be implemented to focus on only a few common possibilities.

Swing eighth notes as triplet:
[L:1/8] nn = (3::2 n2n

Swing sixteenth notes as triplet:
[L:1/16] nn = (3::2 n2n

Swing eighth notes as dotted:
[L:1/8] nn = n>n

Swing sixteenth notes as dotted:
[L:1/16] nn = n>n

Scottish eighth notes:
[L:1/8] nn = n<n

Scottish sixteenth notes:
[L:1/16] nn = n<n

None
[L:1/8] nn = nn

thingy1 thingy2

paulrosen commented 4 years ago

I agree that I'd love this feature! I have it on my list but don't know exactly when it will be done.

robinweser commented 3 years ago

Looking at the sequenceCallback option, it says that it's possible to add some swing manually. So now I'm wondering: Is there an example of how to do it? Would be really helpful to see how it's done in general, since I'm still a newbie with Midi/Synth stuff on the web.

paulrosen commented 3 years ago

I'll make an example. Hold on...

paulrosen commented 3 years ago

See https://github.com/paulrosen/abcjs/blob/dev/examples/modify-synth-input.html

It will be in the main branch when I release the next beta.