Bugzilla – Bug 2517
Mix Stereo To Mono incorrectly changes sample rate to Project Rate without resampling - it should resample to the project rate
Last modified: 2021-01-28 15:19:39 UTC
If a stereo track has a different sample rate to the "Project Rate", "Mix Stereo to Mono" incorrectly resamples the track to the project rate. The "track rate" remains unchanged, so the resultant mono mix track plays at the wrong speed. Example: 1. Stereo Track has sample rate of 48 kHz and is 10 seconds long. 2. Project Rate is 44100 Hz. 3. Mix Stereo Track to Mono 4. The mono mix track is now only 9.188 seconds long and plays too fast and higher pitch. The track sample rate still indicates 48000 Hz sample rate. Observed on Mac and Linux. Expected to be "All" but not tested on Windows. This is a regression against 2.3.3.
Fixed in: https://github.com/audacity/audacity/commit/1d9a78b8c8ad5d1e81f1b90aed23b19bff436468
Tested on W10 with Audacity 3.0.0 1d9a78b This now appears to be fixed properly (I tested versus the previous alpha to confirm).
Also tested on macOS 10.15.6 Catalina works properly now on Mac too.
Fine on Linux.
As per the first comment on https://github.com/audacity/audacity/commit/1d9a78b "Mix Stereo down to mono" fails if left and right channels have different sample rates. Also, I'm not convinced that mixing down to the track rate is correct. For the other two "Tracks menu > Mix" commands we use the project rate. Surely we should be consistent? The title of this bug could be clearer. I think the sample rate should be changed to the project rate, but should be done correctly (that is, the track should be resampled, not simply changing the rate without resampling.
(In reply to Steve Daulton from comment #5) > As per the first comment on > https://github.com/audacity/audacity/commit/1d9a78b > "Mix Stereo down to mono" fails if left and right channels have different > sample rates. > > Also, I'm not convinced that mixing down to the track rate is correct. For > the other two "Tracks menu > Mix" commands we use the project rate. Surely > we should be consistent? > > The title of this bug could be clearer. I think the sample rate should be > changed to the project rate, but should be done correctly (that is, the > track should be resampled, not simply changing the rate without resampling. My fix in: https://github.com/audacity/audacity/commit/1d9a78b8c8ad5d1e81f1b90aed23b19bff436468 fixes the regression which was caused by commit: e8f9f4a. Prior to that, and going back at least to Audacity 1.3.7: 1. If the two channels had the same rate, they were mixed down to that rate. 2. If the two channels had different rates, then the command had no effect. I think it would be clearer if the bug where the channels have different rates, and the enhancement to change the rate for the mix were logged as separate bug/enhancements, and this bug was closed. e8f9f4a
(In reply to David Bailes from comment #6) > I think it would be clearer if the bug where the channels have > different rates, and the enhancement to change the rate for the > mix were logged as separate bug/enhancements, and this bug was closed. On the other hand, on Linux, Mix Stereo Track to Mono fails on Linux in Audacity 2.3.2 in a different way (nothing happens at all if the channels have different sample rates). It was "fixed" in 2.3.3 but still produced the wrong result. It has now been fixed again, but is still not producing the "correct" result, so I thought it reasonable to say that it isn't actually "fixed". I have now updated the bug title. Try these steps: 1. Launch Audacity 2. Add New > Mono Track 3. Set the track sample rate to 22050 4. Generate 10 seconds, 1000 Hz tone 5. Add New > Mono Track 6. Set the track sample rate to 48000 7. Generate 10 seconds, 12000 Hz tone 8. Join the two mono tracks to make a stereo track 9. Ensure that the Project Rate is 44100 10. Mix Stereo Down to Mono Expected result, the stereo track is mixed down to a mono track with a sample rate of 44100. Actual result - nothing happens. It silently fails. This also happens in Audacity 2.3.2 on Linux, though it is obviously not the correct behaviour.
(In reply to Steve Daulton from comment #7) > (In reply to David Bailes from comment #6) > > I think it would be clearer if the bug where the channels have > > different rates, and the enhancement to change the rate for the > > mix were logged as separate bug/enhancements, and this bug was closed. > > On the other hand, on Linux, Mix Stereo Track to Mono fails on Linux in > Audacity 2.3.2 in a different way (nothing happens at all if the channels > have different sample rates). It was "fixed" in 2.3.3 but still produced the > wrong result. It has now been fixed again, but is still not producing the > "correct" result, so I thought it reasonable to say that it isn't actually > "fixed". > > I have now updated the bug title. Changing the title and the nature of the bug makes following the comments almost impossible. I still think I fixed the bug as originally specified, and further work on this is not a priority for me. > > Try these steps: > 1. Launch Audacity > 2. Add New > Mono Track > 3. Set the track sample rate to 22050 > 4. Generate 10 seconds, 1000 Hz tone > 5. Add New > Mono Track > 6. Set the track sample rate to 48000 > 7. Generate 10 seconds, 12000 Hz tone > 8. Join the two mono tracks to make a stereo track > 9. Ensure that the Project Rate is 44100 > 10. Mix Stereo Down to Mono > > Expected result, the stereo track is mixed down to a mono track with a > sample rate of 44100. > > Actual result - nothing happens. It silently fails. > This also happens in Audacity 2.3.2 on Linux, though it is obviously not the > correct behaviour.
(In reply to David Bailes from comment #8) > Changing the title and the nature of the bug makes following > the comments almost impossible. I apologise for not being clear originally about what the correct behaviour should be. "incorrectly changes" was ambiguous. I believe the new description is less ambiguous.
**** STEPS UPDATED **** Demoting residual to P3. It's pretty rare that people will make stereo tracks in this way, and this residual does not merit the P2 rating.
Fix in: https://github.com/audacity/audacity/commit/e9d4a8e Try it with 1 hour tracks and watch the progress dialog. There will 1 to 3 stages for each stereo track. 1 if the channels have the same sample rate 2 if the channels don't have the same sample rate and 1 of them matches the project rate 3 if both channels do not match the project rate
(In reply to Leland Lucius from comment #11) Testing on W10 with Audacity 3.0.0 4e6e3c2 This works properly on Windows
(In reply to Leland Lucius from comment #11) Testing on macOS 11.1 Big Sur with Audacity 3.0.0 4e6e3c2 This works properly on Mac with Leland's latest change
Examing the commit for this shows that it is plarform-indeoendent https://github.com/audacity/audacity/commit/e9d4a8e53804c9800631e9a69b2e0eee8abc5b92 So as this works OK on Win and Mac I shall close this as FIXED