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

Audacity Bugzilla



Bug 1502 - VST and AU: effects preview incorrectly if track rate not 44100 Hz or project rate differs from track rate
VST and AU: effects preview incorrectly if track rate not 44100 Hz or project...
Status: RESOLVED FIXED
Product: Audacity
Classification: Unclassified
Component: VST
2.1.3
Per OS All
: P2 Repeatable
Assigned To: Default Assignee for New Bugs
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2016-08-28 13:58 UTC by Gale Andrews
Modified: 2018-08-20 11:45 UTC (History)
9 users (show)

See Also:
Steps To Reproduce:
1 Import or create audio with a sample rate other than 44100 Hz for example, use the attached "1kHz_sine_-23_LUFS_16bit_96kHz.wav". 2 Open a plugin that reports the sample rate, e.g. Reaktor by Native Instruments or a modified version of LUFS Meter that can display sample rate (Gale can supply this for MacOS offlist). Observe that the plugin does not report 96000 Hz. 3 Opening the modded LUFS Meter with the attached WAV file. Observe displayed fs=44100. Play the audio if it is not already playing and observe an incorrect loudness measurement of -23.6 LUFS. 4 Press "Apply" in the effect then the correct fs=96000 and -23 LUFS will display. If necessary (it wasn't for Gale), press the "Reset" button in the effect to display the correct rate. 5 Close LUFS Meter. Set Project Rate to 44100 Hz, Tracks > Resmple... to 44100 Hz, set Project Rate to other than 44100 Hz e.g. 16000 Hz. 6 Open LUFS Meter. Play the audio and the level is wrongly reported as -19.9 LUFS. Apply or Reset does not change that. 7 Stop the audio, change Project Rate to 44100 Hz, then press Reset and Play in the effect. The correct LUFS level is now reported. PRL: You can also observe incorrect results in spectral displays, such as I saw in Voxengo SPAN and Melda MAnalyze.
Release Note:
GROUP: Effects (VST and Audio Units) * '''If the track rate or project rate is other than 44100 Hz, metering, equalization and time-based effects such as delay or reverb may give unexpected real-time preview results.''' Providing the project rate matches the track rate, then as a '''Workaround:''' click "Apply" in the effect, Edit > Undo in the Audacity menus, then preview.
First Git SHA:
Group: ---
Workaround:
Closed: 2018-08-20 00:00:00
billwh: Test‑OK‑Mac+


Attachments
Demo WAV file at -23 LUFS (721.86 KB, audio/x-wav)
2016-08-28 14:05 UTC, Gale Andrews
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Gale Andrews 2016-08-28 13:58:28 UTC
Not a recent regression. 2.1.0 does the same. 

Assumed all platforms, as identified on Windows and Mac.  

Could be P2 or P3, but will go for P2 so it is higher in pecking order if not fixed for 2.1.3.  

According to the developer of Klangfreund LUFS Meter, on the initialisation of a plugin, Audacity calls VST AudioEffect::setSampleRate() multiple times. If the audio is not at 441000 Hz, then Audacity will report the wrong sample rate to the plugin, which will be a problem for metering, EQ and delay/reverb plugins. 

For example if the rate of the audio is 96000 Hz, then Audacity will report the wrong sample rate to the plugin, twice with the wrong sample rate of 48000 Hz, followed by another wrong sample rate of 44100 Hz. This last rate gets through to the LUFS Meter via the  AudioEffectX::resume() call. 

When "Apply" is hit in the effect, VST AudioEffect::setSampleRate() gets called again, finally with the correct rate of 96000 Hz. But many plugins don't set themselves to this rate immediately. They need something like resume() to set themselves to the correct rate. 

Audio Unit effects are similarly misinformed about sample rate if the rate is other than 44100 Hz.
Comment 1 Gale Andrews 2016-08-28 14:05:19 UTC
Created attachment 704 [details]
Demo WAV file  at -23 LUFS
Comment 2 Gale Andrews 2016-08-28 14:36:39 UTC
Further testing with the LUFS meter shows that the LUFS is incorrect when project rate differs from track rate, even if project rate is 44100 Hz, so title changed from 

"VST and AU: effects preview incorrectly if track rate or project rate is not 44100 Hz"

to 

"VST and AU: effects preview incorrectly if track rate not 44100 Hz or project rate differs from track rate".

Is it legitimate to regard mismatched track and project rate as user error? Bug 1284 suggests our Equalization effect's preview should handle mismatched track and project rate.
Comment 3 Steve Daulton 2016-12-26 06:29:40 UTC
(In reply to Gale Andrews from comment #0)
Gale wrote:
> Audacity calls VST AudioEffect::setSampleRate() multiple times.

Could that be 
VSTEffect::SetSampleRate(double rate)

I don't see a function called AudioEffect::setSampleRate()

There is a more general problem of effects using the Project Rate rather than the track sample rate (example: bu 1284, bug 852, bug 660). Is this bug just a specific case of the general problem, or something else?
Comment 4 Gale Andrews 2016-12-26 19:40:25 UTC
(In reply to Steve Daulton from comment #3)
> Audacity calls VST AudioEffect::setSampleRate() multiple times.
> Could that be 
> VSTEffect::SetSampleRate(double rate)
> I don't see a function called AudioEffect::setSampleRate() 

That information was copied verbatim from what the LUFS Meter developer said, but I see a comparable AudioUnitEffect::SetSampleRate(double rate) in AudioUnitEffect.cpp.   

> There is a more general problem of effects using the Project Rate rather than the 
> track sample rate (example: bu 1284, bug 852, bug 660). Is this bug just a specific 
> case of the general problem, or something else?

Something else, hence it is listed separately. Steps 1 - 3 reproduce if project rate is other than 44100 Hz, even if project rate and track rate match. 

Unmatching project rate and track rate does reproduce too, but according to said developer, the problem Audacity has that other software does not is misreporting of the sample rate of the audio transport.
Comment 6 Bill Wharrie 2017-08-29 10:16:45 UTC
Mac 10.11.4, Audacity 2.2.0-alpha Aug 28
I'm not sure what I'm meant to find, given that I can't test with the modified LUFS Meter. I did this:
1) Import stereo WAV 44100 file
2) Tracks > Resample > 96000
Project rate remains at 44100
3) Effect > BCFreqAnalyst 2 (Stereo) (a VST real-time analyzer effect)
4) Click Play in the effect window
Audio plays normally and display in effect seems reasonable.
5) Close BCFreqAnalyst
6) Effect > AUMatrixReverb
7) Click Play in the effect window
Audio plays normally and the effect is applied correctly.
8) Close AUMatrixReverb
9) Change Project Rate to 32000
10) Repeat the above two effects.
They seem to work correctly.
I also tried Voxengo SPAN but can't see where it reports the sample rate.

I'd say this is fixed.
Comment 7 Paul L 2017-08-29 13:40:23 UTC
(In reply to Bill Wharrie from comment #6)

Bill, see what I added to steps:  Some plug-ins display a sound spectrum.  Before the bug fix I could display the spectrum of a pure tone and see the peak at the wrong frequency.
Comment 8 Bill Wharrie 2017-08-29 14:14:56 UTC
(In reply to Paul L from comment #7)
Paul, I've tested again with a 1000Hz tone. 
1) Create 1000Hz tone in 44100 project
2) Resample track to 96000
3) Effect > SPAN
With project rate at: 
44100, the peak value reported is -28.1
22050, the peak value reported is -24.8
96000, the peak value reported is -19.9
In all cases the peak is displayed at about 1000Hz.
But, the spectra look different: at lower project rates the lobes are closer together. 
The original steps to reproduce seems to imply that an incorrect level is reported, and I get different levels for different project rates.
Comment 9 Paul L 2017-08-29 14:26:28 UTC
(In reply to Bill Wharrie from comment #8)

The frequency of the peak is the concern, and it is right.

The spacing of lobes or variation of level is not important.