macOS script to batch-convert audio files for Polyend Play

Hello, kia ora.

I created a simple macOS Python script to recursively convert AIFF and WAV files to 44.1kHz 16bit mono PCM, using Python.

Ideal for use with Polyend Play.

Only files that are not already in the right format will be converted.

https://gist.github.com/PeterDekkers/30e5fc85b756c9079c3b58a6158439c2

Feedback or questions welcome.

For reference, some more information about Play’s native sample playback capabilities. Note that it can play back different sample rates (other than 44.1kHz).

8 Likes

Does it keep one of the channels, os summs both?

Sums/mixes, using the —mix parameter of afconvert :slight_smile:

Thanks for this. I thought a wav file was already uncompressed? What does this do beyond that?

I moved some wav files into the Samples dir on the SD Card and they seemed to work fine.

Hello @eric.brookfield. Yep, WAV files are indeed uncompressed. The script also makes them:

  • mono
  • 44.1kHz
  • 16 bit
  • use PCM encoding

These attributes can vary for WAV files. And the above is the native format that Play plays its samples back at.

I moved some wav files into the Samples dir on the SD Card and they seemed to work fine.

Yeah, Play will automatically convert files when you load them, if they’re not already in its native format. This script just skips the need to perform that step, which means you:

  • save on SD storage space
  • load your files a little faster on Play, as it doesn’t need to potentially convert them
2 Likes

For anyone interested in how to do this on Windows: foobar2000. You can load a folder with samples (recursively!) there and batch convert them with different DSP components, including functions like downsampe to 44.1khz, downmix to mono, hard limit to -6db, skip silence. if you want to keep original folder structure, check this out: https://www.reddit.com/r/foobar2000/comments/q48jlj/convert_music_and_keep_folder_structure/
This way I made my samples folder three times and a half lower in size.

2 Likes