How does Audacity instantly change the project sample rate on export?

If I load a .wav file into audacity and then export it with a different sample rate, the conversion between rates happens instantaneously. Nonetheless, in the resulting file, the playback sounds totally the same as the original, so the export hasn’t simply changed the rate of playback.

However, if I choose Tracks > Resample and select a new sample rate, the resampling process takes some time.

The latter makes sense to me. The former is confusing, because it seemingly works somehow via metadata. I’d like to understand the difference between these two procedures, because I’d like to replicate how Audacity’s export function works in a programming project.

You can check the format with MediaInfoOnline.

Or, there are 8 bits in a byte so you can check file size:
File size = Sample Rate x Bit Depth/8 x Number of Channels x Playing Time in seconds.

i.e. CDs are 16-bit , 44,100Hz, 2-channels = 176,000 bytes per second.

Or, try exporting as 8-bits, 8kHz and assuming you are starting with a normal good quality music file, you should hear a loss of quality.

I don’t know but it might have something to do with saving the undo information. I would assume that re-sampling is faster than reading/writing the hard drive.

“Tracks > Resample” and resampling on export use exactly the same method to resample. Both are accomplished using the “libsoxr” resampling library.

When resampling a track, Audacity also needs to calculate the track visuals, which may account for the additional time that you observe.

This topic was automatically closed after 30 days. New replies are no longer allowed.