Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
2nd January 2019, 13:45 | #1 | Link |
Registered User
Join Date: Nov 2003
Posts: 365
|
Unusual audio damage - every 3rd sample
BACKGROUND: Sometimes my DVR creates a strange artifact on the audio output that is inaudible to me. It's not til after I capture the video and extract the video and .wav files for Avisynth processing that I discover the problem. (And I worked hard to trace down that it was the DVR causing it, which is solved temporarily by rebooting the DVR. But eventually it slips into artifact mode again without warning.) If I catch it before I've erased the program from the DVR, I can simply recapture. However, I've capped and done a bunch of deleting, so I cannot go back and recapture.
THE NEED: What I need is a way to massage the audio. I need to subtract the value 16,384 from every 3rd sample in the right channel, starting at a specified offset (which will be 0, 1 or 2). Is there some way in Avisynth to do this with my audio track??? I open my audio like this: audio=wavsource("myvideo.wav") Last edited by TCmullet; 2nd January 2019 at 14:11. |
2nd January 2019, 15:33 | #3 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
BeFa English doc:- http://web.archive.org/web/200711050...sROOM.htm#Befa
Linked from wiki, External filters:- http://avisynth.nl/index.php/Externa...#Audio_Filters
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? |
2nd January 2019, 15:40 | #4 | Link |
Registered User
Join Date: Nov 2003
Posts: 365
|
Stainless, yes I saw that. But I discovered that Chrome's real-time (when I tell it to) translation of the original reads a lot better. But it's still cryptic. Have you or anyone ever used BeFa?
Every 3rd sample of my 48khz audio equates to a tone of 16000 cycles per second. By looking at the waveform in Audacity is how I determined that whatever is causing this is adding a fixed value to my signal. And it looks very closely like the value is 16384. I'm worried that the only practical way to solve this is to write a C++ program to read the bad wave file as input and write out a new one with 16384 subtracted from every 3rd sample in the right channel. |
2nd January 2019, 15:49 | #5 | Link |
Registered User
Join Date: Nov 2003
Posts: 365
|
I posted a graphic of the view in Audacity here:
https://forum.audacityteam.org/viewt...?f=46&t=102710 The solution that I reported there was to recapture from the DVR after rebooting. But now I'm dealing with files old enough that they no longer can be recaptured. So I DO need a way to fix the corrupted waveform. |
2nd January 2019, 17:35 | #6 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
Cant speak for anyone, just for me, no never even heard of it.
Give me a little time to finish a few other things and I'll see what I can do.
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? |
2nd January 2019, 20:06 | #7 | Link |
Formerly davidh*****
Join Date: Jan 2004
Posts: 2,492
|
What happens when the underlying samples have a high enough value that adding 16384 would push them over the top?
By the way I'd say your left channel needs a smaller amount (2000) adding every three samples as well. And I don't think the offset on the right channel is 16384 - it's more like 20000. StainlessS: I've got this one covered if you don't want to spend any (more) time on it Just waiting on an answer to the above question before finalising. Last edited by wonkey_monkey; 2nd January 2019 at 20:17. |
2nd January 2019, 20:16 | #8 | Link | |
Registered User
Join Date: Nov 2003
Posts: 365
|
Quote:
Also I just learned today it's not happening immediately and at 16384, but starts gradually after audio starts, taking a few seconds to reach max value. (16384 is my educated guess.) |
|
2nd January 2019, 20:48 | #10 | Link | |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
Quote:
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? |
|
2nd January 2019, 21:18 | #11 | Link |
Registered User
Join Date: Nov 2003
Posts: 365
|
No, after a couple seconds audio, it's stable the rest of the recording, even hours long. I think it ties to the DVR's start of playback. It takes 2-3 sec. maybe to ramp up to it's normal constant of ~16384. (I could probably measure it.)
|
3rd January 2019, 04:36 | #13 | Link |
Registered User
Join Date: Nov 2003
Posts: 365
|
Longer sample? You mean a sample longer than the one I didn't send or include? Uh, well I guess you must be talking about the 300 sample file I put up on the Audacity board earlier. Okay, I can give 10 sec. if I leave it in the captured AAC format, then you can decompress to .wav to view it. It (the aac file) is contained in a zip file attached. This is the 1st 10 seconds of audio in the capture.
I think I was wrong about it taking 2+ seconds for the amplitude of introduced 16k tone (which shows as every 3rd sample being boosted by a fixed large amount, 16k-20k). It's not 2 sec, but rather .02 seconds. After that time, the amplitude is the constant value (16k or 20k) Before that, the amplitude starts at 0 and rapidly (over .02 sec.) ramps up to the high value constant thru the rest. I'm not try to stop the ramp up. I'd simply skip over it to apply whatever fix to everything BUT the 1st .02 or .03 seconds. |
3rd January 2019, 04:41 | #14 | Link |
Registered User
Join Date: Nov 2003
Posts: 365
|
A reason I'd like an Avisynth solution is that I don't discover the problem until I have set up a script for processing and I SEE the boosted right channel. If I had nothing to do to the audio, I could let it go unchanged. But you can see that if I need to do something as simple as normalizing, the normalizing won't work as those inaudible spikes every 3 samples max out the normalizing logic, that is, normalizer cannot boost it any more as the louder ones are already maxed out.
Edit: Also, I have a lot of files to process, and adding a line of code in the Avisynth script (if there is such a line) is much faster than doing an Audacity step to process and fix the audio file before finalizing (and running) my Avisynth script. Plus I'm not crazy about notching out something. Last edited by TCmullet; 3rd January 2019 at 15:31. |
3rd January 2019, 13:04 | #15 | Link | |
Join Date: Mar 2006
Location: Barcelona
Posts: 5,034
|
Quote:
Working on this problem in the time domain seems rather error prone, not to mention that there is no software or Avisynth plugin (of which I am aware) that can do this.
__________________
Groucho's Avisynth Stuff |
|
3rd January 2019, 15:25 | #16 | Link |
Registered User
Join Date: Nov 2003
Posts: 365
|
Let's call the amount by which the signal is erroneously boosted every 3rd sample "boosted value" or BV. My thought process when I first saw this close up was, if I follow the path of the waveform and when one of the 3rd-samples would cross the x-axis (the time domain) if it had not been boosted, then the value of that boosted sample would be BV. I could see that subtracting BV from every 3rd sample would restore all the boosted samples to their original values. So, what could be error-prone about that? It's exactly every 3rd sample, and once we nail down the value of BV, it is constant throughout (except for the first fraction of second where it is ramping up).
Last edited by TCmullet; 3rd January 2019 at 15:28. |
4th January 2019, 18:36 | #17 | Link |
Formerly davidh*****
Join Date: Jan 2004
Posts: 2,492
|
Okay, the start is a bit more complicated because it looks like there's another aberrant signal at a different offset which fades in and then fades out, but this should help for the rest of the audio:
http://horman.net/avisynth/download/audiofix.zip If you're not sure which DLL you need, you're probably using 32-bit Avisynth so you want audiofix(x86).dll Parameters: Code:
offset - bad sample offset step - defaults to 3 add - amount to add to selected samples channels - AF_LEFT, AF_RIGHT, or AF_BOTH (default) ramp - number of samples to ramp up over at start Code:
convertaudioto16bit # it only works with 16-bit audio audiofix(offset=2,add=-20000,channels=AF_RIGHT,ramp=1000) audiofix(offset=2,add=2000,channels=AF_LEFT,ramp=1000) |
4th January 2019, 19:30 | #19 | Link |
Registered User
Join Date: Nov 2003
Posts: 365
|
I was puzzled why you did something in left channel. but on looking more closely, it appears that yes, the left DOES have a disruption, albeit much smaller in amplitude that the right channel disruption.
If I start my frames of concern far into the clip, can I set the ramp to zero? In most cases, I don't need the footage at the start. But in at least one case, I probably do. (It was something where no audio started until the real audio for the program did.) I was puzzled at first by "offset", but I think that is the means to sync processing to where it's now every 3rd (the step parameter) sample. Also, how accurate are your BV values (-20000 for the right, 2000 for the left)? Do you feel they're the best possible estimates, or do I need to work to get them more accurate? Last edited by TCmullet; 4th January 2019 at 19:48. |
4th January 2019, 20:28 | #20 | Link |
Formerly davidh*****
Join Date: Jan 2004
Posts: 2,492
|
Yes, you can set ramp to zero so it has no effect. The BV values are pretty accurate as far as I can tell, probably within 1% for the right channel. Ideally you should check a recording which has a period of complete silence (on an ad break, if there are any, for example) so you can be certain of the value.
|
Thread Tools | Search this Thread |
Display Modes | |
|
|