WavPack - numcodecs implementation
Numcodecs wrapper to the WavPack audio codec.
This implementation enables one to use WavPack as a compressor in Zarr.
Requirements
To install wavpack-numcodecs on MacOS, you need to install wavpack with brew:
brew install wavpack
For Linux and Windows, the package comes with pre-built binaries of the most recent version Wavpack version.
On Windows, you need to have the "Microsoft C++ Build Tools" installed. You can download it and install it from here.
On Linux, if an existing wavpack installation is found, the package will use it. Otherwise, it will use the pre-built binaries available in the wavpack_numcodecs/libraries folder.
WAVPACK_VERSION=5.8.0
wget "https://www.wavpack.com/wavpack-${WAVPACK_VERSION}.tar.bz2"
tar -xf wavpack-$WAVPACK_VERSION.tar.bz2
cd wavpack-$WAVPACK_VERSION
./configure
sudo make install
cd ..
Installation
Install via pip:
pip install wavpack-numcodecs
Or from sources:
git clone https://github.com/AllenNeuralDynamics/wavpack-numcodecs.git
cd wavpack_numcodecs
pip install .
Usage
This is a simple example on how to use the WavPackCodec with zarr:
from wavpack_numcodecs import WavPack
data = ... # any numpy array
# instantiate WavPack compressor
wv_compressor = WavPack(level=2, bps=None)
# v2
group = zarr.group()
z = group.create_dataset(name="wv_dset", data=data, compressor=wv_compressor)
# v3
zarr.config.set({"default_zarr_version": 3})
group = zarr.group()
z = group.create_array(name="wv_dset3", data=data, serializer=wv_compressor)
data_read = z[:]
Available **kwargs can be browsed with: WavPack?
NOTE 1: In order to reload in zarr an array saved with the
WavPack, you just need to have thewavpack_numcodecspackage installed.
NOTE 2: The Zarr v3 implementation is an
ArrayBytesCodec. Thezarr.create_arrayfunction only supportsArrayArrayCodecobjects forfiltersandBytesBytesCodecsforcompressors. Hence, we need to use theWavPackcodec as aserializer, which is expected to be anArrayBytesCodecobject.
Developmers guide
How to upgrade WavPack installation and make a new release
To upgrade the WavPack installation, you need to:
- Download the latest version of WavPack from the official website.
- Extract the content of the downloaded file.
- Create a new folder in the
src/wavpack_numcodecs/librariesfolder with the name of the version of the WavPack you are installing. - Add the Windows .dll and .lib files to the
windows-x86_32andwindows-x86_64folders, respectievely. - Update the version of the CI workflows in the
.github/wavpack_latest_version.txtfile and set theLATEST_WAVPACK_VERSIONvariable in thesetup.pyto match the version of the WavPack you are installing. - Make a PR with the changes and merge it.
- Manually trigger the
Build wavpack binariesworkflow in the Actions tab of the repository. This will automatically build the binaries for different Linux versions and make PRs with the changes to themainbranch. - Merge the automated PRs to update the Linux binaries.
- Update the version of the package in the
pyproject.tomlfile and tag the repo to automatically make a new release.
Metadata
Release files for wavpack-numcodecs 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| wavpack_numcodecs-0.3.0.tar.gz | 3.6 MB | Details |
Release files / wavpack_numcodecs-0.3.0.tar.gz
| Download URL | wavpack_numcodecs-0.3.0.tar.gz |
|---|---|
| Size | 3.6 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1af7b7be155f86abdb5c85e00563c6fab874c0e9f120f9e99d600346b999fcd5
|
|
BLAKE2b-256 checksum How to use checksums |
4c4a0131c736f00064488c479b50a4a4f556795fd280dcf18073871c4b82e09c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.17
|