export individual partials?

Hey there!

I’ve done a tiny bit of Nyquist scripting, but I couldn’t sort out if there was a way to do this:

I want to create separate WAV files of sine tones for a fundamental frequency, and a set number of harmonics. Seems like something should be possible like:


(start a loop)

Generate tone @ 60 hz, set amplitude, set duration

export to WAV

increment by 60hz to get the next partial,

export

end loop after set amount of partials (maybe 100)?


just can’t sort out from the documentation how to do it. Any help would be greatly appreciated!!!

thanks so much

DGB

The “latest version” plug-in in this post should help with the tone generation. (Ignore the filters - they are just to make the waveforms prettier)
https://forum.audacityteam.org/t/high-quality-no-alias-tone-generator/20889/1

Thanks so much!

The plug-in generates a tone, so then I would have to use it in a macro? Or would I still need to write a nyquist script to create the loop to export the multiple partials, without having to do it all by hand that is?

Thanks!

Exporting directly from Nyquist is “possible” but it’s quite tricky, very “technical”, and not very user friendly. (There’s an example of exporting text files in the “Sample Data Export” plug-in - exporting audio files is even more tricky because you have to also handle file format settings).

I would recommend either using a Macro or generating lots of tones in one project and then using Export Multiple.

One strategy for using Macros could be to create a load of dummy file (they can be multiple copies of 1 second of silence), so that you can batch process those file (though not actually using any audio in the file - the dummy files basically act as a loop counter). You would need some way to change the parameters of the tone generator on each run - perhaps using SCRATCH.

One strategy with “Export Multiple” would be to create a project with say 10 or 20 empty audio tracks - select them all, then generate tones into each of the tracks. A “generate” type plug-in iterates over each selected track. Again you would need to change the tone generator settings on each run. You could for example use (get 'track 'index) as a counter.

Ah, got it!

Thanks so much for trying to help. I’m trying to avoid having to manually type in the hz for each partial, and since it’s simple math i feel like it’s a better job for a computer : )

Gonna try to do it with python or SoX. I’ll see if I can figure that out.

Thanks again!

DGB