Audacity Bug Summary
••• Introduction •••
••• Keywords •••
    Audacity 3.0.3 development began 19th April 2021

Audacity Bugzilla



Bug 1808 - Crash using SBSMS pitch change at low sample rate
Crash using SBSMS pitch change at low sample rate
Status: RESOLVED FIXED
Product: Audacity
Classification: Unclassified
Component: Built-in FX
2.2.2
Per OS All
: P1 RepeatableAll
Assigned To: Default Assignee for New Bugs
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2017-12-20 05:42 UTC by Peter Sampson
Modified: 2018-08-20 11:46 UTC (History)
5 users (show)

See Also:
Steps To Reproduce:
1) Start with a fresh instance 2) Generate a mono noise 0.3s in length 3) Set project rate to 11025Hz 4) Tracks > Resample -> 11025 5) Select all audio 6) Effect -> Sliding Time/Pitch Shift 7) Set Final Pitch Shift to 10%, click OK 8) Crash may need to repeat steps 6&7 to get the crash
Release Note:
First Git SHA:
Group: ---
Workaround:
Closed: 2018-08-20 00:00:00
petersampsonaudacity: Must‑Test‑All‑OS+
petersampsonaudacity: Test‑OK‑Win+
petersampsonaudacity: Test‑OK‑Mac+
stevethefiddle: Test‑OK‑Lin+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Sampson 2017-12-20 05:42:39 UTC
As per steps to reproduce.

This was originally reported by a forum user on W10 (they did not have step 4

I confirmed this in my W10 laptop.  
My first run - on 2.2.2 on Windows 10 Home (December Creator's Update) ran through just fine. As second attempt immediately after cause a crash.

Steve confirmed this on Linux - but needed to add Step 4

I can reproduce this on my Macbook Pro under macOS 10.13.2 High Sierra
a) it needs Steve's extra step to get the failure
b) as with my Windows test it ran OK on first pass - and crashed on second use

See this Forum thread for more details - callstack and backtrace:
https://forum.audacityteam.org/viewtopic.php?f=68&t=98199


The original poster wrote:
"May take more than one attempt, possibly depends on uninitialised memory being in a particular state for the heap allocator to pick up on the problem."
Comment 1 Peter Sampson 2017-12-20 05:53:44 UTC
Not a regression - happens on all vns back to and including 2.1.3
Comment 2 Paul L 2018-01-01 11:44:42 UTC
I see it too in 2.1.2 but intermittently.

Quite possibly and old infrequently encountered bug.

Some bad memory access happens in a stack deep in the SBSMS library, but some callback functions we define are also in the stack.

Suspect stuff in SBSMSEffect.cpp starts at about these lines:

            // SBSMS has a fixed sample rate - we just convert to its sample rate and then convert back
            float srTrack = leftTrack->GetRate();
            float srProcess = bLinkRatePitch ? srTrack : 44100.0;


Perhaps one might figure the but out deductively from what follows.
Comment 3 Paul L 2018-01-05 15:10:54 UTC
I looked a bit at this and found out this much:

Unusual paths are taken through SBSMSEffect, only when there is a rate other than 44100.

The crash is not new in recent Audacity versions.  I reproduced it in 2.1.3, and suspect it can be done in very old versions too.

The crash is not always reproducible.

Peter's steps used a very short sound of 0.3 seconds.  It might happen only in such cases, but even so be intermittent.

The immediate cause of crash is a bad memory access, deep inside the SBSMS library, but the call stack also includes some functions in our own code that were passed as callbacks into SBSMS; these callbacks then called into SBSMS again.

I gave up, sensing deep weeds here that I don't know very well.

The possibility of a bug in the library is not excluded, but neither do I know its API well enough to prove that there is no misuse of it on our part.

Considering that the bug might be ancient and yet the use case so obscure that it evaded detection by us until now -- I suggest a demotion of its priority.
Comment 4 Steve Daulton 2018-01-05 15:26:00 UTC
The bug also appears in "Change Pitch" when using the "High Quality" stretching.

1) Launch Audacity
2) Set Project rate to 11025
3) Generate 0.3 s 440 Hz tone.
4) Apply "Change Pitch" effect:
 % change: 5
 Use High Quality: enabled

Audacity stops responding and is thrashing 1 processor core at 100% until forced to quit.

Updated description.
Comment 5 Peter Sampson 2018-01-06 09:56:19 UTC
(In reply to Paul L from comment #3)
Paul wrote:
>Considering that the bug might be ancient and yet the use case so obscure that 
>it evaded detection by us until now -- I suggest a demotion of its priority.

We cannot downgrade it as it causes a crash - and thus a P1

It may be obscure, but it was not detected by us - it was first reported by a user on the Forum who was trying to use it.
Comment 6 Paul L 2018-01-06 11:39:12 UTC
This may be a very difficult bug to figure out for very little gain.

Who on the Team is most familiar with the SBSMS libraries?

The basic code here goes back before 2010, the horizon of history that is easily read from our GitHub repository.
Comment 7 Paul L 2018-01-06 12:49:35 UTC
As RM I would overrule that.

Unless we find someone with expertise in this old library, which seems ill documented (almost nothing in the header files explaining it) -- then I think there is little hope of figuring it out without much diversion of effort, just to satisfy one user.

We can suggest to the user the workaround, that they resample to 44100, then apply the effect, then resample down to 11025 again.
Comment 8 Peter Sampson 2018-01-06 12:53:39 UTC
But we could use Audacity to block those effects at the extremes that cause the crash, couldn't we?
Comment 9 Paul L 2018-01-06 13:05:37 UTC
In other words, partly hobble the feature.  We could do that.

I don't know the condition we should impose.  Allowing it only for sample rates of 44100 might be too restrictive.  I don't know.
Comment 10 Paul L 2018-01-06 15:42:48 UTC
Here's the one-line eureka fix in lib-src.

https://github.com/audacity/audacity/commit/df1d9a08fe9aa2c62fc98862028ca9371b8f6169
Comment 11 Peter Sampson 2018-01-07 05:29:23 UTC
(In reply to Paul L from comment #10)
Testing on macOS 10.13.2  audacity-macos-nightly-2.2.2-8724a5a.dmg - 26.17 MB | version: 2.2.2--07Jan18

The Steps to reproduce  with "Sliding Time/Pitch Shift" do not fail now on Mac

Steve's additional steps in Comment #4 with "Change Pitch" also now work correctly.

Marked as ok on Mac
Comment 12 Steve Daulton 2018-01-07 11:15:02 UTC
Works OK for me on Linux, and it was previously very easily repeatable.

I'd recommend testing on Windows before closing, simply because it's P1.
Comment 13 Peter Sampson 2018-01-08 06:18:50 UTC
Tested on a 2.2.2 Windows build that James made for me 2.2.2 JC002 07Jan18

The Steps to reproduce  with "Sliding Time/Pitch Shift" do not fail now on W10

Steve's additional steps in Comment #4 with "Change Pitch" also now work correctly.

Marked as ok on Windows