Page 1 of 1

Convert WAV-files to ZCM format

Posted: Sun Jul 21, 2024 7:24 pm
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

Re: Convert WAV-files to ZCM format

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

https://github.com/ZeroByteOrg/zsound/b ... zcmtool.py

Re: Convert WAV-files to ZCM format

Posted: Tue Jul 23, 2024 10:02 am
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 :-)

Re: Convert WAV-files to ZCM format

Posted: Tue Jul 23, 2024 4:13 pm
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)

Re: Convert WAV-files to ZCM format

Posted: Tue Jul 23, 2024 4:29 pm
by unartic
Good to know :-)