Bugzilla – Bug 1502
VST and AU: effects preview incorrectly if track rate not 44100 Hz or project rate differs from track rate
Last modified: 2018-08-20 11:45:57 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.
Created attachment 704 [details] Demo WAV file at -23 LUFS
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.
(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?
(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.
Fixed at https://github.com/audacity/audacity/commit/ddf236993ffa06a2e22cb5a33425f88d585bfa97
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.
(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.
(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.
(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.