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

Tap Tempo #5181

Closed
ghost opened this issue Sep 9, 2019 · 11 comments · Fixed by #6375
Closed

Tap Tempo #5181

ghost opened this issue Sep 9, 2019 · 11 comments · Fixed by #6375

Comments

@ghost
Copy link

ghost commented Sep 9, 2019

One thing I would love to see in LMMS is the Ability to Tap your own Tempo. It can either be tapped by your spacebar or by your Left Mouse Click. This way you will definitly assign the Tempo you want.

@husamalhomsi husamalhomsi changed the title [Feature Request] Tap Tempo Tap Tempo Sep 9, 2019
@artur-twardowski
Copy link
Contributor

Maybe MIDI clock could also be involved? This way we could synchronize the tempo in LMMS with external clock source, such as MIDI keyboard.

@musikBear
Copy link

FYI @MrTeeXD : http://www.beatsperminuteonline.com/
If you miss it right now 🔍
Imho -if a method for detecting BPM should be added, then it should not rely on user tabbing. That would just move a very abundant provided net-method in LMMS, if LMMS could detect BPM on its own -see that would be useful

@0xf0xx0
Copy link
Contributor

0xf0xx0 commented Oct 11, 2019

...This way we could synchronize the tempo in LMMS with external clock source, such as MIDI keyboard.

Or even the opposite, where the tempo is tapped on the midi controller and LMMS syncs with it :D

@husamalhomsi
Copy link
Member

For simplicity and friendliness, I suggest to tap on any key/mouse press event on the widget.

@0xf0xx0
Copy link
Contributor

0xf0xx0 commented Nov 3, 2019

i agree, would be much better than clicking a button

@husamalhomsi husamalhomsi removed their assignment Dec 8, 2019
@rezbyte
Copy link

rezbyte commented May 30, 2020

Mind if I give this issue a shot?

@husamalhomsi
Copy link
Member

husamalhomsi commented Jul 11, 2020

The following is my GUI vision for the feature:
• Access to it would be through an action in the Tools drop-down of the menu bar, or an action in the context menu of the Tempo LcdSpinBox.
• It would be a small pop-up widget with a button for tapping. The button would show the current tempo and indicate taps.

@musikBear
Copy link

@Sawuare wrote

The following is my GUI vision for the feature:

Not that way. Ergonomically it is quite difficult to finger-click in a consistent way (it has to do with anatomical mehhee ) If you try you will either find your self banging on the mouse, or pressing quite hard. After a while your finger start to hurt ;p (Tendonitis alert..).
No the easy way to keep a steady rhythm, is to tab on space, where the motion is in the wrist, not the finger

@IanCaio
Copy link
Contributor

IanCaio commented Jul 14, 2020

Mind me giving my two cents? It doesn't really matter whether the mouse or space is used (maybe make both a possibility?), but IMHO the BPM calculation would have to take to account an average of many user taps. The difference of the time between beats of 120bpm and 110bpm is 0.045s. Meaning that if you always calculate the difference between the last two taps you'll have a lot of different BPMs on each try. If you store the time difference between the last X beats you'll have a little more accurate and stable BPM read.

@RoxasKH
Copy link
Contributor

RoxasKH commented Jul 14, 2020

@Sawuare wrote

The following is my GUI vision for the feature:

Not that way. Ergonomically it is quite difficult to finger-click in a consistent way (it has to do with anatomical mehhee ) If you try you will either find your self banging on the mouse, or pressing quite hard. After a while your finger start to hurt ;p (Tendonitis alert..).
No the easy way to keep a steady rhythm, is to tab on space, where the motion is in the wrist, not the finger

Go telling that to Image-Line xD

FL one works exactly like that, and you don't really need to be precise, only to get an idea of the tempo you want you can simply adjust later.

@qnebra
Copy link

qnebra commented Jul 14, 2020

Single window with Big Friendly Button with text "Tap Spacebar when active to set tempo" on it.

Or use existing "Tempo" window and add this functionality into it. If textbox in this window was active pressing Spacebar in regular intervals set tempo into desired value.

sakertooth added a commit to sakertooth/lmms that referenced this issue Jun 6, 2022
sakertooth added a commit to sakertooth/lmms that referenced this issue May 30, 2023
sakertooth added a commit to sakertooth/lmms that referenced this issue May 30, 2023
sakertooth added a commit to sakertooth/lmms that referenced this issue May 30, 2023
sakertooth added a commit to sakertooth/lmms that referenced this issue Aug 25, 2023
sakertooth added a commit that referenced this issue Aug 25, 2023
* Add Tap Tempo Feature (#6375)
Resolves #5181

* Update formatting, use namespaces, etc.

* Use Qt Designer .ui file to handle the UI
Thanks to irrenhaus for the idea
Also added a few buttons I will add functionality for

* Play metronome sound when tapped

* Improve stabilization speed by comparing differences in length between intervals
To improve the speed at which the BPM counter stabilizes at a
certain number, we now compare the differences in length between
the last two taps and the most recent two taps and reset the counter
if the threshold is passed.
I made it so that a difference of 500 ms resets the counter.

* Remove duplicate m_ui
An artifact from my battle with Git and merge conflicts..

* Format TapTempoUi header file

* Add lmms namespace in UI file

* Remove taptempo.ui XML file
Not needed

* Add LMMS_EXPORT to SamplePlayHandle

* Use std::chrono::duration<double, std::milli> for intervals
Co-authored-by: irrenhaus3 <[email protected]>

* Use alias for steady_clock
Co-authored-by: irrenhaus3 <[email protected]>

* Speed up convergence by accounting for recent intervals

This uses a combination of keeping track of a more accurate BPM,
while also using a BPM difference threshold to move towards the true BPM
more quickly.

After three taps, a "recent interval" is calculated, which is similar
to the latest interval, but less fluctuating since it accounts for
three taps instead of one. This allows for comparing between
the BPM on the display with the recent BPM more closely.

We then compare the difference in magnitude of both BPM's
with the threshold. If the threshold is passed, the counter gets reset.

* Remove semicolon from "QOBJECT;" in plugins/TapTempo/TapTempo.h

Co-authored-by: Hyunjin Song <[email protected]>

* Add newline between using alias and constructor

* Cleanup header files

* Add // namespace lmms::gui comment

* Rename header guards in plugins/TapTempo/TapTempo.h

Co-authored-by: Dalton Messmer <[email protected]>

* Rename header guards in plugins/TapTempo/TapTempo.h

Co-authored-by: Dalton Messmer <[email protected]>

* Rename header guards in plugins/TapTempo/TapTempoUi.h

Will merge this file with ``TapTempoView`` soon.

Co-authored-by: Dalton Messmer <[email protected]>

* Rename header guards in plugins/TapTempo/TapTempoUi.h

Co-authored-by: Dalton Messmer <[email protected]>

* Update plugins/TapTempo/TapTempo.h

Co-authored-by: Dalton Messmer <[email protected]>

* Replace virtual with override in plugins/TapTempo/TapTempo.h

Co-authored-by: Dalton Messmer <[email protected]>

* Merge UI file into TapTempoView

* Pass TapTempo* directly into constructor in plugins/TapTempo/TapTempoView.h

Co-authored-by: Dalton Messmer <[email protected]>

* Update style in plugins/TapTempo/TapTempoView.h

Co-authored-by: Dalton Messmer <[email protected]>

* Add parameter name for keyPressEvent function in plugins/TapTempo/TapTempoView.h

Also reorder the function declarations to match the order in the source file.

Co-authored-by: Dalton Messmer <[email protected]>

* Remove dynamic_cast to TapTempo* in plugins/TapTempo/TapTempoView.cpp

Co-authored-by: Dalton Messmer <[email protected]>

* Restrict C linkage to only lmms_plugin_main and plugin descriptor
Co-authored-by: Dalton Messmer <[email protected]>

* Simplify algorithm

* Update labels when calling closeEvent

* Add reset button

* Adjust layout

* Format document

* Only allow the tap button to gain focus

* Use icon provided by LMMS

* Add sync button and adjust formatting

* Make the metronome downbeat the first beat

Also simplify code

Co-authored-by: Dalton Messmer <[email protected]>

* Round BPM values when syncing with project tempo

Co-authored-by: Dalton Messmer <[email protected]>

* Change Plugin::Tool to Plugin::Type::Tool

---------

Co-authored-by: Hyunjin Song <[email protected]>
Co-authored-by: Dalton Messmer <[email protected]>
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.

9 participants