Convert WAV-files to ZCM format

For posting library code and examples.
Post Reply
unartic
Posts: 145
Joined: Sat Oct 28, 2023 3:26 pm

Convert WAV-files to ZCM format

Post by unartic »

I've constructed a small python script to convert (any?) wav-file to a zcm file in which you can specify for the output file:

- mono/stereo
- bit depth: 8 or 16
- sample rate: 0 - 48828.125

You need to install two packages for this to work first:

pip install numpy
pip install pydub

Syntax:
python wav2zcm.py --channels {1,2} --bit_depth {8,16} --sample_rate SAMPLE_RATE input_file output_file

Download python script:
wav2zcm.zip
(1.15 KiB) Downloaded 70 times
User avatar
desertfish
Posts: 1095
Joined: Tue Aug 25, 2020 8:27 pm
Location: Netherlands

Re: Convert WAV-files to ZCM format

Post by desertfish »

ZSound already included such a script, maybe you missed it:

https://github.com/ZeroByteOrg/zsound/b ... zcmtool.py
unartic
Posts: 145
Joined: Sat Oct 28, 2023 3:26 pm

Re: Convert WAV-files to ZCM format

Post by unartic »

desertfish wrote: Sun Jul 21, 2024 7:50 pm ZSound already included such a script, maybe you missed it:

https://github.com/ZeroByteOrg/zsound/b ... zcmtool.py
If I understand correctly, yout tool needs a raw-audio file. So you have to use tools like Audacity to convert an audio file to raw, remember the specifics (channels, bit depth, sample rate) from which your tool can create a zcm file.

The tool I've posted converts any wav-file to zcm. So one big step easier to use I recon :-)
User avatar
desertfish
Posts: 1095
Joined: Tue Aug 25, 2020 8:27 pm
Location: Netherlands

Re: Convert WAV-files to ZCM format

Post by desertfish »

Actually, the tool from ZSound accepts both wav and raw files (and even other sound formats I think it then decodes those first with the sox tool)
unartic
Posts: 145
Joined: Sat Oct 28, 2023 3:26 pm

Re: Convert WAV-files to ZCM format

Post by unartic »

Good to know :-)
Post Reply