abcjs icon indicating copy to clipboard operation
abcjs copied to clipboard

Feature request: swing feel setting in midi genetation

Open njouve opened this issue 8 years ago • 11 comments

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 ?

njouve avatar Dec 14 '16 18:12 njouve

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 [email protected] 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

gregdyke avatar Dec 14 '16 18:12 gregdyke

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.

njouve avatar Dec 14 '16 19:12 njouve

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.

paulrosen avatar Dec 14 '16 19:12 paulrosen

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...

njouve avatar Dec 14 '16 20:12 njouve

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.

paulrosen avatar Dec 15 '16 02:12 paulrosen

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 [email protected], 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).

gregdyke avatar Dec 15 '16 13:12 gregdyke

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

chrisfargen avatar Apr 10 '20 17:04 chrisfargen

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

paulrosen avatar May 02 '20 17:05 paulrosen

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.

robinweser avatar Oct 20 '20 11:10 robinweser

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

paulrosen avatar Oct 24 '20 14:10 paulrosen

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.

paulrosen avatar Oct 24 '20 20:10 paulrosen