Play the spectral "difference"

kronikle's icon

Hi!

I'm looking for find a way to play the frequencies that are different between 2 sound files.

I tried a lot on spectral filters, pffts and so on... but I had not success... It's quite frustrating so I ask you a big HELP

I'd like to play two sound files simultaneously, analize their frequency spectrum and play the difference between the two . How I should do?

Roman Thilenius's icon

analyzing the spectral history is nothing complicated, and when you have the analysis done, the difference bewtween them c an be found by, well, substracting one from the other with the minus object.

there should be a spectral analyzer somewhere in the examples which is based on FFT.

you can also use all kinds of filters to create a filterbank. the fffb object is probably the easiest way.

regarding "playing" the difference i am not sure what you expect. a frequency/spectrum analysis signal will always be limited to a certain numbers of bands, so this is kind of a control signal, which is usually not very interesting to use as audio material - and it wont be so much be related to the source audio.

kronikle's icon

Sure, I know that the result won't be musically wonderful but that's a starting point for a larger project.

Thank you Roman, I will try again and I will come back for further information!

kronikle's icon

Please excuse my ignorance, I'm trying to learn but this is driving me crazy.

I'm trying to adapt this patch of Jean Francois Charles

08-photo-pvoc.zip
application/zip 13.63 KB

I'd like to create a new single matrix with a reference sound and subtract it from the first sonogram. But anything is working... please tell me why...

this is my bad patch:

san-fed_jitter_1D.maxpat.zip
application/zip 15.62 KB

Roman Thilenius's icon

i pull the fft idea and would advise you to try a filterbank with some 13-20 bands first.

also, there should be very low threshold for finding "there is something in this frequency range", so that you kill the frequency range in both samples as soon as "some" level exists in both source files.

otherwise you would mix sample 1 (which has -10db at 400hz) with sample 2 (which has -16 db at 400 Hz) - and then in the resulting mix, after substracting whats common, there will be still some -16 bd of the 400 hz band of both source files.

more useful seems to ignore gain and find out that "oh, both files have something (=more than -50db) at 400 hz" - and then perform a -90 db at 400 hz filtering on the sum of both.

Roman Thilenius's icon

1. find spectral envelope of channel 1

2. find spectral envelope of channel 2

3. exaggerate both spectral envelopes so that they more or less do only 0 and 1

( [+~ 0.1]-[trunc~] ? )

4. substract one spectral envelope from the other and use this as EQ setting for the sum of both inputs.

once this works you could also make it easily dynamic over time for a realtime mode.

kronikle's icon

In your opinion is it possible with a convolutional EQ?

Roman Thilenius's icon

yes sure, but i would just use biquads.