audacity / audacity

Audio Editor
https://wiki.audacityteam.org/wiki/For_Developers
Other
12.58k stars 2.27k forks source link

Unable to import song at correct tempo if wrong tempo detected #6425

Open SteveDaulton opened 6 months ago

SteveDaulton commented 6 months ago

Bug description

I have a music track with a tempo of 200 BPM. When I try to import it, the tempo is incorrectly detected as 100 BPM. It seems to be impossible to import the track at the correct tempo.

Steps to reproduce

  1. Generate a click track using "Rhythm Track", all default settings except for "Tempo" which should be set at 200 BPM. This is to simulate my music track. Export the project as "click.wav"
  2. Close and restart Audacity.
  3. Set the tempo and time signature to 200 BPM, 4/4
  4. Import "click.wav".
  5. When prompted "Audacity detected this file to be 100 bpm. Would you like to enable music view and set the project tempo to 100?" , click "NO" (we already have the tempo set correctly and we do not want Audacity to change it).

Expected behavior

The file will be imported into the project without changing the tempo or time signature.

Actual behavior

The file is imported at double speed.

Audacity Version

current master / alpha / nightly build

Operating system

Linux, macOS, Windows

SteveDaulton commented 6 months ago

Even worse - if I change the Preference setting "Import / Export > Music Imports" to "Do Nothing", the track is imported at double speed without any indication that Audacity has changed the tempo.

DavidBailes commented 6 months ago

The behaviour for automatic tempo detection can be found in the pull request: https://github.com/audacity/audacity/pull/5570

In the steps to reproduce, in step 5, instead of clicking No, if you click Yes, and then press Ctrl+Z to undo, this will result in the desired outcome.

Note that if you're importing into a non-empty project, with the timeline view set to beats and measures, and the automatic tempo detection is incorrect, then the speed adjustment of the clip will be incorrect.

If the timeline view is set to beat and measures, then there is no way of turning automatic tempo detection off, despite what is stated in the current documentation for automatic tempo detection: https://support.audacityteam.org/additional-resources/changelog/audacity-3.5#automatic-tempo-detection

dozzzzer commented 6 months ago

FWIW I believe this is the exact same issue as #6285

DavidBailes commented 6 months ago

FWIW I believe this is the exact same issue as #6285

That issue was that automatic tempo detection was failing in an apparently simple case. I think that the current issue is about the user experience when automatic detection fails (which is will, at least occasionally).

SteveDaulton commented 6 months ago

FWIW I believe this is the exact same issue as #6285

No, it's a different issue. #6285 is about the accuracy of tempo detection. This issue is about the problem caused when tempo detection gets it wrong (as it inevitably will on occasion).

In the steps to reproduce, in step 5, instead of clicking No, if you click Yes, and then press Ctrl+Z to undo, this will result in the desired outcome.

Thanks David. A useful, though counterintuitive workaround for some cases.

saintmatthieu commented 6 months ago

@DavidBailes if you answer "No" or have settings saying "never", the auto-stretch happens only in Beats and Measures view. (Confusing probably is that if you're already in B&M view, the dialog will still says "enable music view and ...") It's important to realize that the automation is only about reconfiguring the view and tempo of the project, not about auto-stretching. The auto-stretching choice would need a separate question, which at the moment is not asked explicitly and decided upon the view instead.

DavidBailes commented 6 months ago

It's important to realize that the automation is only about reconfiguring the view and tempo of the project

I assume that by that you mean that the preference is only about reconfiguring the view and the temp of the project? The automatic tempo detection is used either for changing a clip's tempo or the project's tempo, depending on context and sometimes on user input. If the timeline view is already set to beats and measures, and the tempo is autodetected, then the preference (plus possible user input) determines whether the tempo of the clip or the project is changed. As Steve has already pointed out, the "do nothing" option doesn't do nothing. Your specification of the behaviour in your PR does define what is expected to happen. However, the current user documentation does not.

SteveDaulton commented 6 months ago

I think that users will typically expect import behavior to be consistent regardless of the display mode of the timeline.

saintmatthieu commented 6 months ago

If the timeline view is already set to beats and measures, and the tempo is autodetected, then the preference (plus possible user input) determines whether the tempo of the clip or the project is changed. As Steve has already pointed out, the "do nothing" option doesn't do nothing.

I have a different experience. My timeline is B&M, I import the previously exported 200bpm rhythm track, and this gets the clip stretched. Consistently with the preference, nothing happened with respect to project view or tempo.

Your specification of the behaviour in your PR does define what is expected to happen. However, the current user documentation does not.

That's another problem, isn't it?

DavidBailes commented 6 months ago

If the timeline view is already set to beats and measures, and the tempo is autodetected, then the preference (plus possible user input) determines whether the tempo of the clip or the project is changed. As Steve has already pointed out, the "do nothing" option doesn't do nothing.

I have a different experience. My timeline is B&M, I import the previously exported 200bpm rhythm track, and this gets the clip stretched. Consistently with the preference, nothing happened with respect to project view or tempo.

The preference is "When audacity detects music in file imported on empty project: option: do nothing - I read this to mean do nothing. (The option is not: do nothing to the timeline view or the project tempo, but change the clip's tempo if the timeline view is beats and measures.)

I guess our takes on this are different.

Your specification of the behaviour in your PR does define what is expected to happen. However, the current user documentation does not.

That's another problem, isn't it?

It probably is.

SteveDaulton commented 6 months ago

The auto-stretching choice would need a separate question, which at the moment is ... decided upon the view

Schrödinger would be proud.

professorbeautiful commented 2 months ago

I paste a music track from one project to another. Both at 44100, both timeline set to Minutes and Seconds. In the Source, the clock icon for Speed and Pitch at the right of the clip view is NOT present. If I click ... and select Speed and Pitch, Speed is at 100%. Now paste into an empty track in the Destination project. The clock is there, and the Speed is at 93%. Try to change it to 100%. Nope. Most of the time on clicking the Speed up/down arrows it jumps immediately to 1000% and won't budge. The clip disappears. Now it seems ok... in the sense up arrowing goes to 100.5, then changing the 5 to a zero. Works sometimes.