Page 11 of 14

Re: NoiseRemoval.cpp

Posted: Sun Sep 07, 2014 9:18 am
by Gale Andrews
Paul L wrote:Try this, to demonstrate that attack times are only half as long as they are supposed to be. (The particular numbers are not very important, we just need tone significantly louder than noise.)

New project. Generate 2 s of white noise, amplitude .5. View it in Waveform dB. Do Noise removal, Get Noise Profile.

Hit right arrow, generate tone, 440 Hz Sine wave amplitude .99, 2 seconds. Ctrl-f, ctrl-j, ctrl-a: Now tone follows noise in a single clip all of which is selected.

Now do noise removal with 48 dB reduction and 1 s attack/decay.

The envelope of the noise should drop from -6 to -54, and does nicely. It should rise in anticipation of the tone -- that is attack time. The rise in the envelope should be exponential, meaning a straight line in dB view, and that appears roughly so.

But the duration of this rise is about .5 seconds, not 1 second.
I've been testing the committed fix for this https://code.google.com/p/audacity/sour ... 23&r=13278 .

I have a question about how the decay and removal should work in noise after the tone in the above steps.

I am also getting weird behaviour (more or less reproducible) on Mac and Windows that seems to be not in 2.0.5.

So after Paul's steps on Mac (2.0.6-alpha), I undo application of Noise Removal and double-click the noise clip from 0s to 2s, Edit > Copy, K, then Edit > Paste.

Then CTRL + A and apply Noise Removal at the same settings by opening the effect. What should happen with the pasted noise after the tone? The noise is only brought down to about -20 dB and there is almost no fade down to that level. There is a short fade down of about 5 dB at the end of the pasted noise. What is the definition of decay?

Edit > Undo, double click the pasted noise and Effect > Repeat 10 times for noise of 22 seconds. CTRL + A, then apply Noise Removal at the same settings by opening the effect. The pasted/repeated noise is still at about -20 dB.

Edit > Undo then select from the right edge of the track to the right edge of the tone and apply Noise Removal at the same settings by opening the effect. There is now 1s of noise at -54 dB, 1s of fade in to about -20 dB, and then noise at -20 dB to the end.

In all cases the pasted or pasted/repeated noise after removal sounds much more phasey than the remaining noise before the tone.

Now I undid the Noise Removal and the Repeat and reapplied Noise Removal at the same settings by opening the effect. Same result. Now I Undo and Effect > Repeat Noise Removal. Same result. Now I undo and I see a white flash in the waveform in the clip between 8s and 10s (looks like envelope pointers) and the waveform does not change and I still see Edit > Undo Noise Removal.

Redo and Undo does not now undo the Noise Removal. Then I Effect > Repeat Noise Removal and Edit > Undo. The noise removal is undone and now I can undo the repeat. Still see the "white flash".

I then quit without saving as a project, but copied the AUTOSAVE file and the data before quit. I can't see an obvious problem with the AUTOSAVE file by looking at the contents.

I repeated all the steps but I used Effect > Repeat Noise Removal at each possible point instead of opening the effect. This time after Undo Noise Removal and Repeat Noise Removal a few times on the repeated noise, I changed to opening the effect to apply noise removal. Then I Edit > Undo Noise Removal and nothing happens until I Effect > Repeat Noise Removal then I can undo Noise Removal. I see no flashes this time.

I quit and reproduced the lockup of Undo in the above paragraph.

Quit and did the same steps except I stayed in Waveform View. Did not get the lockup of Undo.

Testing in 2.0.5, the not fully attenuated noise after the tone is also observed but there is a slightly greater fade of almost 0.5s down to -20 dB after the tone. I can't get the white flashes or locked undo.

On Windows I have tried the same steps several times in different sessions (each time after reboot). I have not seen the lockup of Undo yet, but in either Waveform or Waveform (dB) View, if after the Edit > Undo and Redo of Noise Removal on the repeated noise, I select all and apply Noise Removal from the effect, the entire track is brought down to -54 dB. It may take a few Undo and Redo's on the entire track, but it will happen. 2.0.5 does not do it. I can't reproduce this behaviour on Mac in 2.0.6.

Can't spend any more time on this now. Can Steve or Paul try this noise - tone - repeated noise setup?


Gale

Re: NoiseRemoval.cpp

Posted: Sun Sep 07, 2014 3:28 pm
by Paul L
Gale Andrews wrote:Edit > Undo, double click the pasted noise and Effect > Repeat 10 times for noise of 22 seconds. CTRL + A, then apply Noise Removal at the same settings by opening the effect. The pasted/repeated noise is still at about -20 dB.
Try 1024 repetitions instead, and I predict the result will have some intervals where correct noise reduction happens. You might need shorter attack time to make that effect undisguised.

It all has to do with how the FFT windows of 2048, staggered by 1024 sample steps, align in the repeated piece of noise. Wait long enough and you happen to get "in phase" with the noise removal profile again sometimes.

Re: NoiseRemoval.cpp

Posted: Sun Sep 07, 2014 3:49 pm
by Paul L
Gale, you mention a lot of things. A few thoughts:

I think I can explain the apparent fade-out at the end of track (and did you notice fade-in at the start too?). Debatable just how we ought to fix those edge effects.

Use zero frequency smoothing and the "phasiness" becomes "chimey" instead. Use spectrogram view instead and you see nonuniformity in the improperly reduced noise.

Use increased sensitivity, and the noise reduction after the tone should improve. Use a longer noise profile than 2 s and things should improved.

All of this relates to how we take statistics from the noise profile, and it is debatable just how to improve that, but none of this ought to be different between versions.

As for the differences you see between operating systems, I wonder if there is a difference in the random number generating library routines that produce the noise. Maybe if you use identical saved data across operating systems, you will no longer see the different behavior.

I have not yet replicated the misbehavior of Undo or the white line (?). Some of these problems might just be graphical?

Re: NoiseRemoval.cpp

Posted: Sun Sep 07, 2014 4:40 pm
by Paul L
Gale Andrews wrote:New project.

(...)

In all cases the pasted or pasted/repeated noise after removal sounds much more phasey than the remaining noise before the tone.
I understand the causes of everything so far and think there is no regression in 2.0.6.
Gale Andrews wrote:
Now I undid the Noise Removal and the Repeat and reapplied Noise Removal at the same settings by opening the effect. Same result.
If I do that literally then only the second interval of noise is selected. Does "same result" mean that this exact 2 s IS correctly reduced? That is what I see and it makes sense because the noise is exactly the same as the profile. Or did you mean, select all of the six seconds in the project first.
Gale Andrews wrote:

Now I Undo and Effect > Repeat Noise Removal. Same result. Now I undo and I see a white flash in the waveform in the clip between 8s and 10s (looks like envelope pointers) and the waveform does not change and I still see Edit > Undo Noise Removal.
Now I am out of sync with you. The project is only 6 s long at this point. I misunderstood or you omitted some steps.

Can you discover a simpler sequence from new project that demonstrates this misbehavior of Undo?

There is nothing in NoiseRemoval.cpp that backs up undo state. That must all be done at some higher level that applies to all kinds of effects. There might be something here specific to Mac and 2.0.6, but general across kinds of effects.

Be aware that with Noise Removal, the initial taking of the profile does nothing to the project but does create an item in the undo history. Undoing and redoing that item is a no-op and does NOT erase or repopulate the Noise Removal effect's own independent memory of noise profile information.
Gale Andrews wrote:
Quit and did the same steps except I stayed in Waveform View. Did not get the lockup of Undo.
Well that dependency on view type sounds really weird. Maybe that was coincidental and this is just "moonphase."
Gale Andrews wrote:
On Windows I have tried the same steps several times in different sessions (each time after reboot). I have not seen the lockup of Undo yet, but in either Waveform or Waveform (dB) View, if after the Edit > Undo and Redo of Noise Removal on the repeated noise, I select all and apply Noise Removal from the effect, the entire track is brought down to -54 dB. It may take a few Undo and Redo's on the entire track, but it will happen. 2.0.5 does not do it. I can't reproduce this behaviour on Mac in 2.0.6.
Here is something I could study on Windows, if I could just get the sequence for replication right. When you "select all" here, what exactly is "all" at this point? 2s noise, 2s sine wave, then how much noise? Are there clip boundaries?

I might speculate about some kind of off by one error compounded by the repetition until some sort of "phase shift" causes the noise to reduce... but my speculation is probably running too far ahead.

Re: NoiseRemoval.cpp

Posted: Mon Sep 08, 2014 12:40 am
by Gale Andrews
Paul L wrote:
Gale Andrews wrote:New project.
(...)

In all cases the pasted or pasted/repeated noise after removal sounds much more phasey than the remaining noise before the tone.
I understand the causes of everything so far and think there is no regression in 2.0.6.
Gale Andrews wrote:
Now I undid the Noise Removal and the Repeat and reapplied Noise Removal at the same settings by opening the effect. Same result.
If I do that literally then only the second interval of noise is selected. Does "same result" mean that this exact 2 s IS correctly reduced? That is what I see and it makes sense because the noise is exactly the same as the profile. Or did you mean, select all of the six seconds in the project first.
Sorry if that was confusing but time was short and I needed to get something posted about it.

Those problems on Mac occurred when the pasted and repeated noise was present and I selected from 26s (end of project) to 4s (end of the tone). I'm sure I redid Repeat, applied Noise Removal from the effect, then undid Noise Removal and hit the problem.

I also saw the issue if (with the pasted/repeated noise present) I changed from doing Effect > Repeat Noise Removal and Undo Noise Removal to applying Noise Removal from the effect then trying to Undo.
Paul L wrote:Can you discover a simpler sequence from new project that demonstrates this misbehavior of Undo?
I'll test that, but as above it (probably) requires the pasted and repeated noise to be present. And I have only seen this on Mac, so you may not see it either on Windows.
Paul L wrote:There is nothing in NoiseRemoval.cpp that backs up undo state. That must all be done at some higher level that applies to all kinds of effects. There might be something here specific to Mac and 2.0.6, but general across kinds of effects.
Quite possibly so, Paul. I don't obviously see (as a layman) why the fix for attack/decay should have caused this.
Paul L wrote:
Gale Andrews wrote: Quit and did the same steps except I stayed in Waveform View. Did not get the lockup of Undo.
Well that dependency on view type sounds really weird. Maybe that was coincidental and this is just "moonphase."
In this post http://forum.audacityteam.org/viewtopic ... 50&t=79650 and one other report I saw by e-mail, it's been claimed that changing view causes different levels of Noise Reduction to be applied.
Paul L wrote:
Gale Andrews wrote: On Windows I have tried the same steps several times in different sessions (each time after reboot). I have not seen the lockup of Undo yet, but in either Waveform or Waveform (dB) View, if after the Edit > Undo and Redo of Noise Removal on the repeated noise, I select all and apply Noise Removal from the effect, the entire track is brought down to -54 dB. It may take a few Undo and Redo's on the entire track, but it will happen. 2.0.5 does not do it. I can't reproduce this behaviour on Mac in 2.0.6.
Here is something I could study on Windows, if I could just get the sequence for replication right. When you "select all" here, what exactly is "all" at this point? 2s noise, 2s sine wave, then how much noise?
All is the entire track, always including some pasted noise. I have seen it with both "2s noise, 2s sine wave plus 2s noise" and "2s noise, 2s sine wave plus 22s noise".
Paul L wrote:Are there clip boundaries?
Always. The Generate of the tone creates a clip boundary, the paste of the noise creates a clip boundary, and the Repeat creates clip boundaries. There are then 13 clips in the track.

Also remember I only test in release builds on principle, not debug.

Thanks, Paul.


Gale

Re: NoiseRemoval.cpp

Posted: Mon Sep 08, 2014 1:14 am
by steve
Gale Andrews wrote:In this post http://forum.audacityteam.org/viewtopic ... 50&t=79650 and one other report I saw by e-mail, it's been claimed that changing view causes different levels of Noise Reduction to be applied.
We have no details of that e-mail report, only the one on the forum. Even the original poster was unable to verify the original claim. When following a clear testing procedure, the alleged bug did not occur. In the absence of further evidence, the most likely explanations imo for that "phenomena" are either; flawed testing method, or misinterpretation of the test results.

Without repeatable steps I don't see how we can investigate that further. Whatever the actual reason, I don't see any connection between the alleged bug and Paul's fix for attack/decay time. However, we do know that there are bugs in the Noise Removal code, many of which Paul has addressed in his recent (not yet committed) patches.

Fixing and improving Noise Removal is certainly something that should be pursued in 2.0.7 alpha (or whatever it will be called).

Re: NoiseRemoval.cpp

Posted: Mon Sep 08, 2014 2:28 am
by Paul L
Gale Andrews wrote: In this post http://forum.audacityteam.org/viewtopic ... 50&t=79650 and one other report I saw by e-mail, it's been claimed that changing view causes different levels of Noise Reduction to be applied.

Gale
I read through that thread, it looks like the issue was dropped and reporter couldn't produce a reproducible test case. The reporter might very easily have been mistaken about identity of inputs to the two trials.

Re: NoiseRemoval.cpp

Posted: Mon Sep 08, 2014 2:32 am
by Paul L
steve wrote:However, we do know that there are bugs in the Noise Removal code, many of which Paul has addressed in his recent (not yet committed) patches.

Fixing and improving Noise Removal is certainly something that should be pursued in 2.0.7 alpha (or whatever it will be called).
I am eager to learn how that process goes... I have a lot of ideas, and I don't know whether they will be accepted incrementally or in a big bang. Who will review? Some things are mostly UI like separating attack from decay and error messages for too short selection or mismatch of project sample rates. Others are more mathematical, but not too deeply so.

Re: NoiseRemoval.cpp

Posted: Mon Sep 08, 2014 2:56 am
by steve
Paul L wrote:I am eager to learn how that process goes...
The formal process is along the lines of:
1) Log bug/enhancement on bugzilla. This should clearly define the issue. If it is not clear, then it may require discussion (possibly on the QA mailing list) to clarify the issue.
2) Post a patch to bugzilla and add the keyword "patch".
3) Patch tested by QA. If it appears to fix the stated bug / achieve the stated enhancement, then it will be marked "patch_ready".
4) One of the developers will then review the patch and if they are happy with it they will commit it.

Re: NoiseRemoval.cpp

Posted: Mon Sep 08, 2014 3:23 am
by Gale Andrews
steve wrote:
Gale Andrews wrote:In this post http://forum.audacityteam.org/viewtopic ... 50&t=79650 and one other report I saw by e-mail, it's been claimed that changing view causes different levels of Noise Reduction to be applied.
We have no details of that e-mail report
It basically said the same thing, with a bit more detail.

Both users were adamant they had not been fooled by the different appearance of the waveform in each view. The one who wrote to me said he had checked the levels in "Amplify".

The e-mail reporter said he would write steps to reproduce the issue, but I did not hear from him again.

If there is some moonphase report that "none of us" can make happen, I don't usually add such a report to bugzilla until there has been five or six reports.
steve wrote:Whatever the actual reason, I don't see any connection between the alleged bug and Paul's fix for attack/decay time.
The only connection I was intending to draw was that the Mac issue I saw only occurred in Waveform (dB) view (so far). Just something to be aware of if in case there is some moonphase issue that causes different behaviour between views.

I know you have already said there is no direct relationship in the Noise Removal code that could explain that.


Gale