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

Swing function. #1091

Open
reory opened this issue Aug 23, 2014 · 20 comments · May be fixed by #4232
Open

Swing function. #1091

reory opened this issue Aug 23, 2014 · 20 comments · May be fixed by #4232

Comments

@reory
Copy link

reory commented Aug 23, 2014

Hello new here.

I asked this question on the LMMS forum on facebook, it's not an issue but I was told to come here and sign up.

Is there any chance in the future of having a "swing" function on the bb editor?

http://blog.dubspot.com/swing-creative-use-of-groove-quantization/

Above link explains it better than I can.

Great work by the way on the new LMMS beta and I love all the new sounds from zynaddsubfx.

Thank you.

@diizy
Copy link
Contributor

diizy commented Aug 24, 2014

On 08/23/2014 11:52 PM, reory wrote:

Hello new here.

I asked this question on the LMMS forum on facebook, it's not an issue
but I was told to come here and sign up.

Is there any chance in the future of having a "swing" function on the
bb editor?

There's any chance of having anything, someone just has to implement it.
Know any good coders?

@reory
Copy link
Author

reory commented Aug 25, 2014

Hi Diizy.

Unfortunately I do not know any coders. I suppose if enough ppl want this function the priority would shift to making this happen.

@diizy
Copy link
Contributor

diizy commented Aug 25, 2014

On 08/25/2014 11:36 PM, reory wrote:

Hi Diizy.

Unfortunately I do not know any coders. I suppose if enough ppl want
this function the priority would shift to making this happen.

Well, not really. This isn't a business, no one is paying us... people
work on what they care about personally - which is how it goes for most
open source software.

That said, a swing feature is definitely something that has been
discussed in the past and it's something that may be implemented at some
point. However, there's 101 things that need to be done before that...
and not enough people to do those things.

@drunkenjesus
Copy link

If this is a really important feature you're missing you many wanna just look into a VST step sequencer that has the feature

http://bedroomproducersblog.com/2014/02/25/step-sequencer-vst/ < list of free step sequencer vst's I'm sure a few of them probably have a swing function

@reory
Copy link
Author

reory commented Aug 28, 2014

OK. Thanks guys.

@musikBear
Copy link

And its a relative easy thing to do manually (mark & move notes 64'th to the left in a 4/4 tempo)
Do you need a tutorial?

@reory
Copy link
Author

reory commented Aug 29, 2014

@musikBear
That would be great thanks. How would you showcase this tutorial?

@zonkmachine
Copy link
Member

I've actually implemented swing before but this was on a much simpler hardware sequencer. Since we've seen coding on the MIDI side of LMMS lately, probably the most sane way to go about it would be through groove templates.

Here's an interview with Roger Linn as a bonus :)
http://www.attackmagazine.com/features/roger-linn-swing-groove-magic-mpc-timing/

@zonkmachine
Copy link
Member

probably the most sane way to go about it would be through groove templates.

I change that to: The easiest way is to have swing quantization in the Piano Roll editor. I don't think that would be picked up easily by the arpeggiator though but you wouldn't have to mess with the timing directly but just change the notes. I also had a look at the arpeggiator to see if it was feasible to make a swing knob in there but even if it's doable it would mess up the code pretty much. As I recall it that was the way it was done in Logic when I worked with it some 10+ years ago.

Basically a general algorithm for swing looks something like this:
frames, swing_factor, swing_frames1, swing_frames2
swing_factor = swingKnob * frames
swing_frames1 = frames + swing_factor
swing_frames2 = frames - swing_factor
step_in_beat % 2 ? swing_frames1 : swing_frames2

@teknopaul
Copy link

Hi I've actually done this. I had a version of LMMS locally with variable swing per track and a facility to add different groove functions as well as just simple swing. So far just the swing algo talked about above, I'd need to port it to the new github project.

My algo shifts the notes with more precision than just one 64th, to be honest shifting by 1 64th is pretty good, but I find 1 64th pretty limiting. (BTW technically in LMMS the limit is a 1 192th or a bar)

If there is still demand for this I'll see if I can create a pull request with the changes.

Perhaps one day might be nice to import groves from other tools? I think there are some formats for transferring grooves.

@zonkmachine
Copy link
Member

If there is still demand for this I'll see if I can create a pull request with the changes.

Yes, yes, yeeees!!!

@teknopaul
Copy link

Done, #3296 a bit rough round the edges but its a start.

@teknopaul
Copy link

I finished this, it supports save now, a simple UI and a couple of different groove functions as well as just Swing. I'm using it daily it seems pretty stable. I don't get how to submit the code though.

@BaraMGB
Copy link
Contributor

BaraMGB commented Feb 7, 2017

Step 1: fork lmms on github.
Step 2: clone your fork to your local computer
Step 3: make a new branch (git checkout -b swing)
Step 4: do your changes and test them.
Step 5: git add . And git commit
Step 6: git push origin swing
Step 7: do the pull request on github

@follower
Copy link
Contributor

I've just randomly found @teknopaul's groove support in #3296 via a snippet of diff context in another issue.

Given the interest in this functionality and all @teknopaul's effort implementing it, it seems a shame to stumble at the last hurdle due to source control tooling (believe me, I'm sympathetic on that count :) ).

From looking at https://github.com/LMMS/lmms/pull/3296/commits it seems like (in comparison to https://github.com/teknopaul/lmms/commits/master) only the 3 required commits now appear in the PR?

The Qt5 Travis builds seem to fail due to this error (e.g.):

/Users/travis/build/LMMS/lmms/include/Groove.h:29:10: fatal error: 'QtGui/QWidget' file not found

#include <QtGui/QWidget> 

Which seems to be related to a Qt 4 vs Qt 5 change (see).

I realise these things come down to available time but I thought I'd add this "current status" summary in case someone was inspired to take a look to get some cool functionality over the line (without, you know, having to implement the functionality themselves :D ) and/or to have some notes for myself if I get back to it first (unlikely in the near term due to how many yaks I'm in the middle of shaving currently :) ).

Thanks for your efforts getting it this far @teknopaul. :)

@tresf
Copy link
Member

tresf commented Nov 13, 2017

@follower thanks for resurrecting this. The issue is that @teknopaul closed his PR before the feature was tested and merged. I've reopened it for work to continue. If you are comfortable working on this, we'd happily add you to the dev team to nudge it along. Being on the dev team will give you access to push to his fork and get the feature implemented. (This statement is true for anyone that's willing to help us with PRs, BTW).

@tresf
Copy link
Member

tresf commented Nov 13, 2017

@follower I've rebased #3296 against master, fixed build errors.

@rulatir
Copy link

rulatir commented Dec 16, 2023

"Swing" is a very limited model. We need to be able to warp the timing of events using different, pluggable mathematical models. The "delay every second note by a fixed amount" model is just one of dozens that various musical systems around the planet actually need.

sjaehn/BSchaffl#19 (comment)

@teknopaul
Copy link

"Swing" is a very limited model. We need to be able to warp the timing of events using different, pluggable mathematical models. The "delay every second note by a fixed amount" model is just one of dozens that various musical systems around the planet actually need.

sjaehn/BSchaffl#19 (comment)

I think it always has been pluggable with different models

@teknopaul
Copy link

I have another implementation that is based on a simpler approach with offsets in samples

https://github.com/teknopaul/lmms

This is very fast but does not survive large BPM changes very well. Also this code does not have a global groove always applied per song, it has groove that can be assigned per note select Ctrl + G.

All the different "Swing" algorithms are re implemented.

Same approach could be used with offset as a float in fractions of a tick which would survive BPM changes. I have not tried that but the same principal applies and each alog would need to be tweaked.

Both thesee approaches have the same feature that you can have different swing models in the same song.

The offset approach also allows for simple huamnization, and tuplets, flam and other tricks that require delays to not positioning.

Screenshot from 2023-12-20 16-55-40

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

Successfully merging a pull request may close this issue.