Extract specific frequency from audio and draw a sine wave

Hey there,

just wanted to share another acoustic tool in case someone needed it. Basically, what the python script and the TD project as such does is taking a defined frequency from a complex (i.e. composite sine waves) CHOP signal and drawing the frequency as a sine wave with the appropriate amplitude (that is also extracted from the signal).

The whole thing is done with FFT/audio spectrum CHOP and some python script. By default the code takes the frequency with maximum amplitude and draws it, i.e. it basically tells you what the loudest frequency right now is. But you can change this so the script picks up a different frequency instead (lowest? local and not global maximum? or just the same frequency, hence showing its amplitude progression?).

As I’ve said, this is a tool, not a final product. Feel free to use it to pursue your projects. Hope it helps.



Sine waves.toe (57.8 KB)

3 Likes

Thank you !! Interesting work!

Hi @OnBoc,

really nice and a great example to look into the Script TOP.

You might be able to optimize the script a bit by skipping the conversion to a DAT and instead fetching all channel values at ones using the Channel Class’ .vals member which returns all values of a channel as a list:

so something like op('mychop')['chan1'].vals should work.

Also just if interested, i took the liberty to convert it all to CHOPs so no scripting is required. Utilizing the Analyze CHOP you can get the maximum value of a channel as well as the index of the maximum value which corresponds to the frequency when using the Spectrum CHOP.

cheers
Markus
sineWavesVersion.toe (21.3 KB)