Set waveform rate (not project rate) via macro?

The “Rate” settings for individual waveforms has been one of my favorite functions for many years now for a wide veriety of things, such at losslessly “correcting” slightly off-standard sampling rates (22047Hz–to->22050Hz; 32006Hz–to->32000Hz) found in some retro console video games without the need to resample.

I’ve also used the same function when paired with a high quality resampler like SoX to work as what is quite possibly the highest quality method for altering audio pitch if you’re OK with the audio being slightly sped up or slow down. Such high quality pitch alteration is extremely useful in various music editing tasks and I’ve long held the belief that more people would use this method if they were aware of its existence and benefits.

But let’s be honest, manually changing the waveform “Rate” for 20 to 30 songs at a time can get old really fast, so imagine my excitement when I recently discovered Audacity’s macro function!

…and imagine my disappointment when I discovered that setting the waveform “Rate” is not something included in the macro function. Considering my long-held believe that this function overall has largely flown under the radar, I’d be lying if I said that the lack of its inclusion surprised me.

So yeah…is there any chance for setting the waveform rate to be added? Please? Pretty please? :frowning:

Speaking of it being a function that I believe has largely flown under the radar, I’ve noticed for several years now that “32000Hz” is missing from the default listed waveform rates, yet it is listed for the default project rates. This seems like quite the unusual discrepancy, but then again, I kind of feel like I’m the only person in the world that actually uses the waveform rate function in the first place, so I guess I should be surprised…

Just happen to be working on a similar problem. Managed to write a macro that does the job. It first gets rid of the right channel, so I guess you want to remove the first lines to fit your case:

Select:End=“0” Mode=“Set” RelativeTo=“Project” Start=“0” Track=“0” TrackCount=“0.5”
Select:End=“0” Mode=“Set” RelativeTo=“Project” Start=“0” Track=“0” TrackCount=“1”

It uses the project rate, but after saving via exportwav this should be the rate of your tracks as well.

Errr…I’m no software guru, but AFAICT that’s still just changing the project rate, not what I’ve been calling the waveform rate.

In other words, you’re just resampling - you’re altering the amount of samples in order to retain the same length of time.

What I’ve been calling the waveform rate does the opposite - it retains the amount of samples but alters the length of time. If the project rate and the waveform rate are the same, then exporting is actually completely lossless and you can then even import the new waveform, set the waveform and project rate back to their original sampling rate, and you’ll get a 100% identical waveform compared to your source - you can even invert and mix together and see that it’s 100% silent if you try to then amplify it.

In the actual GUI itself, this elusive ‘waveform rate’ is the thing that used to be called “Set rate” in older versions of Audacity (though in newer versions like the newest v2.3.2 it is now just called “Rate”):

Sorry to double-post, but I can’t edit (presumably because I’m too new and/or have too few posts).

Anyway, looking closer at some of the options in that waveform drop-down menu, it would seem that most if not all of the options there are unable to be ran via a macro, such as swapping the stereo tracks, splitting stereo tracks to mono, etc.

Now many of these could be done without macros if one could apply them as an effect to all of the tracks like one can do with “amplify”, “mix stereo down to mono”, etc, and then just use the “export multiple” function…but obviously this is currently not possible as otherwise I wouldn’t be making this post. :stuck_out_tongue:

BTW, I also can’t help but notice that there’s no way to export as a 32bit floating point WAV via a macro.

That’s no good for me since some of my sources have been converted to 32bit floating point before being imported into Audacity, and I can’t use Audacity for the final export to 16bit either since I not only need to export to a format that Audacity currently does not support (Opus), but I also still need to keep an archival copy in 32bit floating point lossless (which I typically save as WavPack).