1

I have two audio files and want to compare the files with each other in python3.

Here is an example of two audio files with frequency on the x axis:

Audio A

Audio B

Do you know a good approach to create a new audio file, containing the overlapping frequencies only? (Compareable with "innerjoin" in MySQL)

To filter and edit the audiofiles I have been using ThinkDSP (https://github.com/AllenDowney/ThinkDSP)

v0iZz
  • 11
  • 1
  • Is this for denoising sample A with sample B (or vica versa)? Or detecting one sound inside another? – Jon Nordby Oct 14 '19 at 19:54
  • The Goal is to compare alot of Samples to get an Idea of what The average Sample looks Like. After that you can compare The average Sample with News recorded ones. So actually you could it for both – v0iZz Oct 16 '19 at 04:47

1 Answers1

0

step 1 just ignore the freq overlap for now ... and do the work to transform audio (time domain) using a FFT which will give you the data (freq domain) here you have an array of freq bins each with an amplitude and phase shift ... then feed this data into an inverse FFT to once again have your data as audio (time domain) ... a nice way to confirm your code is working is your audio out will match your audio in

step 2 after above code is working OK then enhance your above code to make value 0 the magnitude ( amplitude) of each freq bin (freq domain) which has no overlap ... its as easy as that

During step 2 your data is in the frequency domain ( after audio has been sent into an FFT call ) which is typically an array of complex numbers ... here is some pseudocode to parse this array

You will be hitting the challenge of wanting to use as few a number of audio samples as possible to obtain the greatest degree of temporal specificity as possible ( if you use too many audio samples your audio will sound like mush ) ... however if you use too few audio samples your granularity of freq bins will be low meaning you will have a greater increment between each frequency in your freq domain

Scott Stensland
  • 26,870
  • 12
  • 93
  • 104
  • Thank you for your advice. I'm gonna give it a try, but i am not sure how to achieve step 2 using python. Do you use a certain python library throwing away frequency domains which do not match automatically? – v0iZz Oct 03 '19 at 06:17