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

Any other tech-related topics
Post Reply
Message
Author
User avatar
vevy
Posts: 795
Joined: Tue Sep 10, 2019 11:17 am

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

#1 Post 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?

User avatar
webfork
Posts: 10821
Joined: Wed Apr 11, 2007 8:06 pm
Location: US, Texas
Contact:

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

#2 Post 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.

User avatar
juverax
Posts: 368
Joined: Mon Jun 11, 2018 5:19 am

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

#3 Post 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 1007 times

User avatar
vevy
Posts: 795
Joined: Tue Sep 10, 2019 11:17 am

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

#4 Post 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

User avatar
juverax
Posts: 368
Joined: Mon Jun 11, 2018 5:19 am

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

#5 Post by juverax »

https://audioz.download/software/win/ has many audio processing tools.

User avatar
juverax
Posts: 368
Joined: Mon Jun 11, 2018 5:19 am

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

#6 Post 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.

User avatar
vevy
Posts: 795
Joined: Tue Sep 10, 2019 11:17 am

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

#7 Post 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.

User avatar
lintalist
Posts: 436
Joined: Sat Apr 19, 2014 12:52 am
Contact:

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

#8 Post 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.

User avatar
vevy
Posts: 795
Joined: Tue Sep 10, 2019 11:17 am

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

#9 Post 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!

Post Reply