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

Make Nyquist effects more memory efficient #1734

Open
petersampsonaudacity opened this issue Sep 24, 2021 · 2 comments
Open

Make Nyquist effects more memory efficient #1734

petersampsonaudacity opened this issue Sep 24, 2021 · 2 comments
Labels
Effects (EGATs) Effects, Generators, Analyzers and Tools Enhancement Request Or feature requests. Open-ended requests are better suited for discussions. minor feature low impact feature

Comments

@petersampsonaudacity
Copy link

Describe the bug
Many Nyquist plug-ins will fail or may be sluggish if the track selection is too long, or could cause Audacity to crash. This is because the maximum selection length is limited by the amount of available ram, up to a maximum of 2 GB. '''Workaround:''' Unless you know that a particular Nyquist plug-in is safe to use with long selections, do not select more than about 1 hour of audio (44100 Hz sample rate) at a time. For higher sample rates the limit is proportionally less. If necessary, apply the effect to sections of 1 hour or less.

Originally logged in 2015 on Bugzilla as 1285
https://bugzilla.audacityteam.org/show_bug.cgi?id=1285

To Reproduce
Steps to reproduce the behavior:

  1. Select 2 hrs of Audio
  2. Apply a Nyquist effect.
  3. Observe: Audacity gets very slow and uses lots of RAM.

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Additional information (please complete the following information):

  • OS: all OS
  • Version: all Audacity

Additional context
@SteveDaulton wrote on the Bugzilla thread

Many Nyquist effects load the entire selection into ram, which is limited to a maximum of 2 GB. This is the old "can't normalize big files" problem that has been discussed many times over the years.

The only reason that I don't consider it to be P1 is that there are no reports of this bug affecting plug-ins that are shipped as standard (but it does affect many plug-ins that are hosted on the Audacity wiki).

@petersampsonaudacity petersampsonaudacity added bug An error, undesired behaviour, or missed functionality P3 Medium Priority labels Sep 24, 2021
@petersampsonaudacity petersampsonaudacity added this to To Do (Dev) in Effects and Plugins via automation Sep 24, 2021
@petersampsonaudacity
Copy link
Author

@SteveDaulton later wrote in the Bugzilla thread

A side effect of this issue is that after processing a long selection, Audacity may appear to be frozen while the large amount of memory is released.

Example:
To find the value of the final sample of a 1 hour mono selection:
(sref track (- 1 (/ 1.0 len)))

On my machine, processing takes about 36 seconds, then a message box pops up with the value of the final sample.
On clicking "OK", Audacity appears to be frozen for about 7 seconds (about 600 MB of ram is being released).
(Some plug-ins "in the wild" may take over 40 seconds to release ram.)

Ideally, Nyquist should be able to request the audio data that it needs (in this case, the final sample of the selection), which would make finding the value of the final sample virtually instant with negligible ram requirements.

@LWinterberg LWinterberg added the Effects (EGATs) Effects, Generators, Analyzers and Tools label Jan 14, 2022
@werame
Copy link

werame commented Jan 17, 2022

FYI, Nyquist.cpp makes a copy even of the input buffers it passes to nyx.c. #2396 (comment)

More precisely at

And by "even" I mean despite the fact that the output buffers are entirely separate. But the present design permits clean undo recovery in the case where nyx.c were to corrupt its input buffers somehow.

There's also this compile-time hardcoded limitation on how much Nyquist is allowed to process

"Selection too long for Nyquist code.\nMaximum allowed selection is %ld samples\n(about %.1f hours at 44100 Hz sample rate).")

I'm a bit surprised you didn't run into that. Ok, you actually did and filed that separately #1607

But one indeed usually runs into memory limits with Nyquist before running into the 13.5 hrs limit. Mind you, at higher sampling rate, one runs into the limit sooner. (Aside: still it's way better than SuperCollider's 6 minute limit in its BufRd before it starts making popping noises,
due to fp phasor imprecision 🙄 )

@LWinterberg LWinterberg added Enhancement Request Or feature requests. Open-ended requests are better suited for discussions. and removed bug An error, undesired behaviour, or missed functionality P3 Medium Priority labels May 17, 2022
@LWinterberg LWinterberg added the minor feature low impact feature label Jun 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Effects (EGATs) Effects, Generators, Analyzers and Tools Enhancement Request Or feature requests. Open-ended requests are better suited for discussions. minor feature low impact feature
Projects
Status: Out of scope - technical
Development

No branches or pull requests

3 participants