Page 1 of 1

Is there really no way to mute/cut audio by pattern?

Posted: Sun Feb 11, 2024 11:02 pm
by vevy
I have an audio file where an annoying segment of few seconds is repeated at different times in the file.

I want to feed a copy of this annoying segment to a tool to recognize all instances and remove them, but I couldn't find a way.

This seems like a simple enough idea. Is there really no way to do that in Windows?

Re: Is there really no way to mute/cut audio by pattern?

Posted: Mon Feb 12, 2024 6:55 pm
by webfork
vevy wrote: Sun Feb 11, 2024 11:02 pm I have an audio file where an annoying segment of few seconds is repeated at different times in the file.
Great question, I don't even know how I would find a similar audio element inside a file, much less delete multiple instances.

Re: Is there really no way to mute/cut audio by pattern?

Posted: Mon Feb 12, 2024 8:02 pm
by juverax
Suggestion (manual method, not very sophisticated):
Use your favorite audio editor e.g. Audacity ( https://www.portablefreeware.com/index.php?id=648 ), locate, select and cut the unwanted parts of the audio file.
Then export the resulting audio file.
Audacity_Select_Cut.jpg
Audacity_Select_Cut.jpg (5.99 KiB) Viewed 1573 times

Re: Is there really no way to mute/cut audio by pattern?

Posted: Tue Feb 13, 2024 5:54 am
by vevy
webfork wrote: Mon Feb 12, 2024 6:55 pm Great question, I don't even know how I would find a similar audio element inside a file, much less delete multiple instances.
That's what I though must have existed already. It seems easily doable without AI or such.

@juverax

Thanks for the tip, but I really don't want to do it the tedious way. That's a computer's job if you get what I mean. :D

Re: Is there really no way to mute/cut audio by pattern?

Posted: Wed Feb 14, 2024 7:21 am
by juverax
https://audioz.download/software/win/ has many audio processing tools.

Re: Is there really no way to mute/cut audio by pattern?

Posted: Wed Feb 14, 2024 8:11 am
by juverax
Vevy said: "I have an audio file where an annoying segment of few seconds is repeated at different times in the file"

Question: Is this "annoying segment" exactly the SAME, I mean the sequence of bytes encoding this segment is repeated at different places in the audio file?

1 - If YES, then IMO it is relatively trivial to write an app that parses the RAW audio file, identifies the identical sequences and deletes/replaces them with something else.
Note that conversion between a raw file and a compressed file may introduce spurious bytes.
However the problem is formally similar to "finding a string inside a string" which is a classic algorithm, and there are many web sites where you could look for a solution:
https://www.codeproject.com/
https://www.geeksforgeeks.org/
https://stackoverflow.com/ . . . etc.


2 - If NO, well it depends whether these annoying segments occur at regular intervals - even if the spectrum is slightly different - then all it takes is to remove the bytes at the appropriate positions. Consult the web sites mentioned above, and alike.


3 - If the "annoying segments" are not identical and occur at different places in the audio file, then IMO this is a more difficult problem, because technically you don't have a simple way of "specifying" the annoying segments. Maybe this is a problem for AI enthusiasts :roll: .
Once, I had a similar problem: I was trying to transfer an old 78 rpm vinyl disk that was badly scratched. Each peak caused by the scratch had a slightly different envelope and occurred at slightly different intervals.

Re: Is there really no way to mute/cut audio by pattern?

Posted: Thu Feb 15, 2024 5:08 am
by vevy
Thanks a lot for the detailed reply juverax

The answer is yes. It is the same recording inserted every 7-8 minutes (interval varies a bit). The same recording, but I don't know if it will be byte-perfect. There are a lot of image deduplication tools that work even on similar, non-identical images. I just can't find one that does the same for audio signal.

Re: Is there really no way to mute/cut audio by pattern?

Posted: Sat Feb 17, 2024 12:55 am
by lintalist
Is the segment the same length? If so you would "only" have to identify the starting timestamps e. 6.58 13.23 etc and then use a (cli) tool to split the file in to sections, say the fragment is 10 seconds:
0-6.58; 7.08-13.23; 13.33-... and join them back
still requires manual processing of course

I don't know what file it is but perhaps if you can find a audio-to-text program, and if the repeating section has a clear identifiable word in it e.g. "You're listening to TPFC Radio" that might help you automate finding the timestamps.

Re: Is there really no way to mute/cut audio by pattern?

Posted: Sat Feb 17, 2024 1:59 am
by vevy
lintalist wrote: Sat Feb 17, 2024 12:55 am Is the segment the same length?
The annoying segment is the same length (same recording), but occurs at variable intervals.
I don't know what file it is but perhaps if you can find a audio-to-text program, and if the repeating section has a clear identifiable word in it e.g. "You're listening to TPFC Radio" that might help you automate finding the timestamps.
That's a great idea! I have speech-to-text software that can output to srt.

That gets us to semi-automation. Getting closer!