Sample rate mismatch, 0.001 or shorter silence every batch.

Help for Audacity on Windows.
Forum rules
ImageThis forum is for Audacity on Windows.
Please state which version of Windows you are using,
and the exact three-section version number of Audacity from "Help menu > About Audacity".


Audacity 1.2.x and 1.3.x are obsolete and no longer supported. If you still have those versions, please upgrade at https://www.audacityteam.org/download/.
The old forums for those versions are now closed, but you can still read the archives of the 1.2.x and 1.3.x forums.
Post Reply
Makperson
Posts: 5
Joined: Mon Feb 08, 2021 8:27 am
Operating System: Windows 10

Sample rate mismatch, 0.001 or shorter silence every batch.

Post by Makperson » Mon Feb 08, 2021 8:45 am

Hello,

As the title states, I've recorded podcast episode with accidentally mismatched sample rate between DAW and the hardware, or something like this. I was terrified when after the recording i found, that my 1 hour long episode has this clicking robotic sound effect. I know, that there's nothing much that I could do to fix this. What I've done so far:
I tried de clipping, but it doesn't help at all
Truncate silence doesn't work as well, the silence gaps are in fact not really silence and they're occuring in following pattern:
There's ~0.0008 second long (around 30 samples) silence every 0,01 second and this is constant. Truncate silence doesn't accept silence of that length.
q
I've noticed it by zooming the waveform, which is showed on the screen below. When I've "cleared" part of audio manually (some minutes to get 1 second of audio, so that's not really efficient)

And the question is, if there's a way to clear that audio? The best would be to delete every part of silence, because it can be seen, that when the silence is deleted the wave "before" and "after" it are matched perfectly.

Thanks for any help in advance,
Kuba

There's how it looks at some zoom, it can be seen that is is repeating
z daleka.png
z daleka.png (43.29 KiB) Viewed 173 times
And the'res big zoom, which shows that if we delete the "silence", waveform will "match"
z bliska.png
z bliska.png (42.15 KiB) Viewed 173 times

steve
Site Admin
Posts: 81627
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Sample rate mismatch, 0.001 or shorter silence every batch.

Post by steve » Mon Feb 08, 2021 11:07 am

Makperson wrote:
Mon Feb 08, 2021 8:45 am
mismatched sample rate between DAW and the hardware
When you say "DAW" do you mean Audacity?
If so, which version do you have?

If you have Audacity 2.4.2 there should have been labels added at each of those silences (they are called "dropouts"), unless you disabled "Detect dropouts" in the Recording Preferences.
Are the silences labelled, or is dropout detection disabled?
Makperson wrote:
Mon Feb 08, 2021 8:45 am
And the question is, if there's a way to clear that audio?
I'm not aware of any effect that can fix that, though it may be possible to make one using Nyquist (See; https://manual.audacityteam.org/man/nyquist.html).
Your screenshot shows a mono track, and I assume that is what you want to fix. Is that correct?
Makperson wrote:
Mon Feb 08, 2021 8:45 am
When I've "cleared" part of audio manually
Does your manually repaired part play perfectly? (There's no point in us spending a lot of time on this if the repaired audio still sounds rubbish).
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

Makperson
Posts: 5
Joined: Mon Feb 08, 2021 8:27 am
Operating System: Windows 10

Re: Sample rate mismatch, 0.001 or shorter silence every batch.

Post by Makperson » Mon Feb 08, 2021 11:23 am

Thank You for the reply!
steve wrote:
Mon Feb 08, 2021 11:07 am
When you say "DAW" do you mean Audacity?
If so, which version do you have?

If you have Audacity 2.4.2 there should have been labels added at each of those silences (they are called "dropouts"), unless you disabled "Detect dropouts" in the Recording Preferences.
Are the silences labelled, or is dropout detection disabled?
I have Audacity 2.4.2, but I didn't use it for recording this time. So I Guess that it is not labeled. Is there way to "enable" them or make wisible? (the labels)
steve wrote:
Mon Feb 08, 2021 11:07 am
Your screenshot shows a mono track, and I assume that is what you want to fix. Is that correct?
Yes, my track is mono and that's what I want to fix.
steve wrote:
Mon Feb 08, 2021 11:07 am
Does your manually repaired part play perfectly? (There's no point in us spending a lot of time on this if the repaired audio still sounds rubbish).
And yes, the part that i've cleared manually, which was not super-precise made it good enough to post it with little apology for listeners, but it would save me from recording again.

steve
Site Admin
Posts: 81627
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Sample rate mismatch, 0.001 or shorter silence every batch.

Post by steve » Mon Feb 08, 2021 11:23 am

As a preliminary test, try running this code on a short section of the track that contains dropouts.
To run the code, copy and paste it into the Nyquist Prompt and click the OK button to apply (see: https://manual.audacityteam.org/man/nyquist_prompt.html)

Code: Select all

;version 4
;type process

(setf num 3)

(let ((sil-flag 0)
      (labels ()))
  (do ((i 0 (1+ i))
       (val (snd-fetch *track*) (snd-fetch *track*)))
      ((not val))
    (cond
      ((= val 0)
          (setf sil-flag (1+ sil-flag)))
      (t  (when (> sil-flag num)
            (push (list (/ i *sound-srate*) "") labels))
          (setf sil-flag 0))))
  (if labels
      labels
      "No silences found"))

What happens?
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

Makperson
Posts: 5
Joined: Mon Feb 08, 2021 8:27 am
Operating System: Windows 10

Re: Sample rate mismatch, 0.001 or shorter silence every batch.

Post by Makperson » Mon Feb 08, 2021 11:28 am

Unfortunately, i'm receiving "No silences found". Thank You very much for trying to help - I'm attaching small part of the audio maybe it could help
Attachments
dropouts_sample.wav
(912.91 KiB) Downloaded 11 times

steve
Site Admin
Posts: 81627
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Sample rate mismatch, 0.001 or shorter silence every batch.

Post by steve » Mon Feb 08, 2021 3:19 pm

Unfortunately this does not appear to be possible to automate with that audio.

Here's the problem. Try running this code:

Code: Select all

;version 4
;type analyze

;control num "Minimum run of samples" int "" 10 1 100
;control thresh "Silence threshold (dB)" int "" -80 -120 -20

(setf thresh (db-to-linear thresh))

(let ((sil-flag 0)
      (labels ()))
  (do ((i 0 (1+ i))
       (val (snd-fetch *track*) (snd-fetch *track*)))
      ((not val))
    (cond
      ((< (abs val) thresh)
          (setf sil-flag (1+ sil-flag)))
      (t  (when (> sil-flag num)
            (let ((start (/ (- i sil-flag) *sound-srate*))
                  (end (/ i *sound-srate*)))
            (push (list start end "") labels)))
          (setf sil-flag 0))))
  (if labels
      labels
      "No silences found"))

Notice that if you set the threshold high enough to catch all the dropouts, it also labels sound that should not be deleted.
On the other hand, if you set it low enough to avoid labeling parts that should not be deleted, then the dropouts are not all completely marked.

Dropouts are normally "absolutely" silent, so I'm wondering why they aren't in your audio sample. What app did you use for recording? Was it recorded in MP3 format?
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

Makperson
Posts: 5
Joined: Mon Feb 08, 2021 8:27 am
Operating System: Windows 10

Re: Sample rate mismatch, 0.001 or shorter silence every batch.

Post by Makperson » Mon Feb 08, 2021 3:44 pm

It was recorded in audition into wav format.

Hey, how about this:

I've checked that:
Gap is always 33 samples long
Gap always starts after 479samples since previous one has ended

Could we prepare script which would basically do this:

User selects first gap manually

start := selection Start
end := selection End
interwal:= 479samples


And make loop through whole file doing this:

Delete selection
start += interwal
end += interwal

So it would be based on hardcoded "distance" between dropouts, not the detection mechanism. What do You think? Is it possible to delete in script?

Or maybe we could modify script You provided in last comment to select dropouts exactly with length of 33?
Last edited by Makperson on Mon Feb 08, 2021 4:03 pm, edited 1 time in total.

steve
Site Admin
Posts: 81627
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Sample rate mismatch, 0.001 or shorter silence every batch.

Post by steve » Mon Feb 08, 2021 5:48 pm

Makperson wrote:
Mon Feb 08, 2021 3:44 pm
I've checked that:
Gap is always 33 samples long
Gap always starts after 479samples since previous one has ended

Could we prepare script which would basically do this:

User selects first gap manually

start := selection Start
end := selection End
interwal:= 479samples
Yes, that's quite simple. I think the numbers that we need are 32 samples for the gap, and then skip 480 samples before the next label

This code will create labels that are 32 samples long, starting from the beginning of the selection:

Code: Select all

;version 4
;type analyze

(setf count 32) ;number of samples to label
(setf skip 480) ;number of samples to skip

(setf cycle (+ count skip))

(let ((labels ()))
  (do ((start 0 (+ start cycle))
       (end count (+ end cycle)))
      ((>= end len) labels)
    (push (list (/ start *sound-srate*) (/ end *sound-srate*) "") labels)))

WARNING!
This will create a huge number of labels, which will be very demanding for Audacity and your computer. I would highly recommend that you process your recording a bit at a time rather than all in one go. Audacity should be able to handle a thousand labels or more, but not hundreds of thousands of labels.
Start with a small test section to see how it goes.

Makperson wrote:
Mon Feb 08, 2021 3:44 pm
And make loop through whole file doing this:

Delete selection
start += interwal
end += interwal
Luckily we don't need to do that :)

Once the labels are in the correct place:
1. Select All
2. "Edit menu > Labelled Audio > Delete (see: https://manual.audacityteam.org/man/edi ... audio.html)

The result is not perfect, but it's a big improvement.
repaired.wav
(855.91 KiB) Downloaded 8 times
Tip: You could use the "Repair" effect to improve some of the worst remaining glitches. See: https://manual.audacityteam.org/man/repair.html
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

Makperson
Posts: 5
Joined: Mon Feb 08, 2021 8:27 am
Operating System: Windows 10

Re: Sample rate mismatch, 0.001 or shorter silence every batch.

Post by Makperson » Mon Feb 08, 2021 6:57 pm

Thank You so much for all the professional help.

That's all, take care!

Post Reply