# macOS script to batch-convert audio files for Polyend Play

**URL:** <https://backstage.polyend.com/t/macos-script-to-batch-convert-audio-files-for-polyend-play/4267>\
**Category:** Play\
**Tags:** play\
**Created:** [August 18, 2023, 5:05am UTC](https://backstage.polyend.com/t/macos-script-to-batch-convert-audio-files-for-polyend-play/4267 "2023-08-18T05:05:45Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![peter-9486](https://backstage.polyend.com/user_avatar/backstage.polyend.com/peter-9486/32/1383_2.png) [@peter-9486](https://backstage.polyend.com/u/peter-9486)\
**Post date:** [August 18, 2023, 5:05am UTC](https://backstage.polyend.com/t/macos-script-to-batch-convert-audio-files-for-polyend-play/4267/1 "2023-08-18T05:05:45Z")

</div>

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](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).

> [@What audio files is Polyend Play working with?](https://backstage.polyend.com/t/what-audio-files-is-polyend-play-working-with/210):
>
> The internal engine works with uncompressed 16-bit mono PCM WAV files with various sample rates. Polyend Play will import mono or stereo WAV files in any sample rate, and with bit depths of 16, 24, or 32. Imported samples will automatically be converted to the supported file format. The converted mono sample files will contain a mix of both left and right stereo channels. The overall per-project sample pool memory allows for 6 minutes of monophonic 16-bit, 44.1 kHz sample files. However, Play c…

---

<div class="post-metadata">

**Author:** ![omi.makarenko](https://backstage.polyend.com/letter_avatar_proxy/v4/letter/o/ba8739/32.png) [@omi.makarenko](https://backstage.polyend.com/u/omi.makarenko)\
**Post date:** [August 18, 2023, 1:07pm UTC](https://backstage.polyend.com/t/macos-script-to-batch-convert-audio-files-for-polyend-play/4267/2 "2023-08-18T13:07:26Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![peter-9486](https://backstage.polyend.com/user_avatar/backstage.polyend.com/peter-9486/32/1383_2.png) [@peter-9486](https://backstage.polyend.com/u/peter-9486)\
**Post date:** [August 18, 2023, 2:36pm UTC](https://backstage.polyend.com/t/macos-script-to-batch-convert-audio-files-for-polyend-play/4267/3 "2023-08-18T14:36:20Z")

</div>

Sums/mixes, using the `—mix` parameter of `afconvert` 🙂

---

<div class="post-metadata">

**Author:** ![hey.erc](https://backstage.polyend.com/user_avatar/backstage.polyend.com/hey.erc/32/3326_2.png) [@hey.erc](https://backstage.polyend.com/u/hey.erc)\
**Post date:** [August 23, 2023, 2:12pm UTC](https://backstage.polyend.com/t/macos-script-to-batch-convert-audio-files-for-polyend-play/4267/4 "2023-08-23T14:12:40Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![peter-9486](https://backstage.polyend.com/user_avatar/backstage.polyend.com/peter-9486/32/1383_2.png) [@peter-9486](https://backstage.polyend.com/u/peter-9486)\
**Post date:** [August 23, 2023, 9:20pm UTC](https://backstage.polyend.com/t/macos-script-to-batch-convert-audio-files-for-polyend-play/4267/5 "2023-08-23T21:20:12Z")

</div>

Hello @hey.erc. 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

---

<div class="post-metadata">

**Author:** ![katzi](https://backstage.polyend.com/letter_avatar_proxy/v4/letter/k/ea666f/32.png) [@katzi](https://backstage.polyend.com/u/katzi)\
**Post date:** [February 25, 2024, 11:35am UTC](https://backstage.polyend.com/t/macos-script-to-batch-convert-audio-files-for-polyend-play/4267/6 "2024-02-25T11:35:32Z")

</div>

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/](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.
