A Cython wrapper for codec2
Project description
Pycodec2
Pycodec2 is a Cython wrapper for Codec 2.
In other words, Pycodec2 allows using the Codec 2 C library from Python.
Installation
Prerequisites
Pycodec2 requires Codec 2.
On Linux, I recommend using the distro's package-manager, e.g., on
Arch/Manjaro: pacman -Syuu codec2
, so that Codec2's assets land in standard
searchable directories for python setup.py
to use.
On macOS, you may use the Homebrew formula.
Instructions
You can install the library using PyPI (the easiest option) or from source.
From PyPI
To install the library from PyPI, run:
pip install pycodec2
From Source
To install the library from source, see building instructions in DEV.md
. You
can then install the wheel with:
pip install dist/*.whl
Codec 2 Compatibility
Pycodec2 3.* is compatible with Codec 2 1.2.*.
Pycodec2 2.* is compatible with Codec 2 1.0.*.
Pycodec2 1.0.* is compatible with Codec 2 at 0.9.2+ versions.
If your Codec 2 version is older than 0.9.2, then try pycodec2-old package.
For more information on potential compatibility problems, check out this issue.
Usage
Example
example.py
implements a basic script that uses Codec 2 to encode and deencode
a sample. Use the following steps to run an end-2-end scenario (dev/rune2etest
implements steps 2-5).
-
Download a sample .wav file, e.g., trashcan.
-
Convert the .wav to a raw mono-channel 8kHz format, e.g.,
sox trashcan.wav -e signed-integer -b 16 trashcan.raw channels 1 rate 8000
-
Compile pycodec2
python setup.py build_ext --inplace
-
Run
example.py
python example.py trashcan.raw
-
Convert
output.raw
sox -r 8000 -e signed-integer -b 16 output.raw output.wav
Now you can listen to output.wav
.
Expected Input Format
Codec 2 assumes that input files use:
- 8kHz bitrate,
- 16-bit width samples,
- a single channel.
Available Modes
For a list of currently supported modes, look for _modes
in
pycodec2/pycodec2.pyx
.
Remarks
This library is considered complete. Please notify me or send a pull request on GitHub if you notice any bugs.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
File details
Details for the file pycodec2-3.0.1.tar.gz
.
File metadata
- Download URL: pycodec2-3.0.1.tar.gz
- Upload date:
- Size: 94.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.12.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4fb11e01ad49796ac492dec1b9805f9acfc2f79cc4bf4a4d4a878fcd353f0d1c |
|
MD5 | ac51887a48fb17ccaef4b861bed27b8f |
|
BLAKE2b-256 | 73e85a0d45312851c34ce0be1117319a289d390e273dd4ff0bd3f5698361e7bb |
File details
Details for the file pycodec2-3.0.1-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: pycodec2-3.0.1-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 1.2 MB
- Tags: PyPy, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.12.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | beda0adb8c1d4bea4b16f8e4955a0d215c2408ca173f414d8af660b5116b9b9b |
|
MD5 | 30bee56bf4d73ad829b9df59a7742a47 |
|
BLAKE2b-256 | c7c92ce7d9a94ad6c0a8780a42646cec566b2c11958d37faa75a10c6f0ef1c28 |
File details
Details for the file pycodec2-3.0.1-pp310-pypy310_pp73-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: pycodec2-3.0.1-pp310-pypy310_pp73-macosx_10_9_x86_64.whl
- Upload date:
- Size: 908.5 kB
- Tags: PyPy, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.12.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 85f85bf91e7bd87dd78e4417bd94236cb97bcffe833dc145abb48b7cd513a0af |
|
MD5 | 081623d0012990fd289fe40a7e817f71 |
|
BLAKE2b-256 | 9f07c61e925f357cdcf257effd58af1b90db20631f471ae75d63fd94d40ae64b |
File details
Details for the file pycodec2-3.0.1-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: pycodec2-3.0.1-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 1.2 MB
- Tags: PyPy, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.12.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8264908bad0937ae5c7f9e67e6a23a0832424602e094dc25fb2a0160557c71fc |
|
MD5 | b81ae8259e76cde5a0d3dcf260c8c3c3 |
|
BLAKE2b-256 | 79eb687b02a70654e7be940f660316ba0a9eb674a8c765fe688456ab5944771d |
File details
Details for the file pycodec2-3.0.1-pp39-pypy39_pp73-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: pycodec2-3.0.1-pp39-pypy39_pp73-macosx_10_9_x86_64.whl
- Upload date:
- Size: 908.5 kB
- Tags: PyPy, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.12.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bcf6d0bf7a5a87f9b47819e4290e4d3ad15050750374ddb6e6e5bfd961a9abdd |
|
MD5 | 1fa11bb987840a01f554d6925a1fe17c |
|
BLAKE2b-256 | 1e0e06edfb2a11e6d59c98c670afce81ecd00aec7fb4db3df0f3a4308014a52a |
File details
Details for the file pycodec2-3.0.1-cp312-cp312-musllinux_1_1_x86_64.whl
.
File metadata
- Download URL: pycodec2-3.0.1-cp312-cp312-musllinux_1_1_x86_64.whl
- Upload date:
- Size: 1.4 MB
- Tags: CPython 3.12, musllinux: musl 1.1+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.12.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | daa11ace0161a0ec2d568a5385eb075f42ab72a7db915cf9a93c1ccb15d369a4 |
|
MD5 | 70fd7585324a3096fa04d72e0ea0e35d |
|
BLAKE2b-256 | 5faa9e7ce8430264a30bf337916922a534262b0c3982a621d5e26f0e24df21f9 |
File details
Details for the file pycodec2-3.0.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: pycodec2-3.0.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 1.4 MB
- Tags: CPython 3.12, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.12.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6a200eda0350aebd25e4d69857c9b1d95b4ea0c63471f8def1f37749d80e01d5 |
|
MD5 | 265e471b92c19a478b8e8601473f61e5 |
|
BLAKE2b-256 | 2de7b3ddb78c620f997a5699c0f14b72463fba4879a91fdccdd7b8e748054fbe |
File details
Details for the file pycodec2-3.0.1-cp312-cp312-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: pycodec2-3.0.1-cp312-cp312-macosx_10_9_x86_64.whl
- Upload date:
- Size: 917.8 kB
- Tags: CPython 3.12, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.12.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | dbf12df554479f8081234876c0e2ed370d75f64a547810dc7dc9f7de74ddddd1 |
|
MD5 | 0372294293c67465b5f554573790e4d1 |
|
BLAKE2b-256 | 5fa554519cad324c69c9b9c3b21fcaef2dc4e2868d3aefa144d80200576dd0f5 |
File details
Details for the file pycodec2-3.0.1-cp311-cp311-musllinux_1_1_x86_64.whl
.
File metadata
- Download URL: pycodec2-3.0.1-cp311-cp311-musllinux_1_1_x86_64.whl
- Upload date:
- Size: 1.4 MB
- Tags: CPython 3.11, musllinux: musl 1.1+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.12.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e3a1b8a7571c8848bd3a5f9ca597697e943e9f372a9e351b45b58018fc8afc13 |
|
MD5 | 33401593d644ed8eac9f2f1e017c09a6 |
|
BLAKE2b-256 | 1e79bfcd581a9e4dc43077d49b69159fad9b3fb0a8c8995a0537619a7162ee99 |
File details
Details for the file pycodec2-3.0.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: pycodec2-3.0.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 1.4 MB
- Tags: CPython 3.11, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.12.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 662b2d272a5709e2bf0f2e32c16110736a06afd1cc8b0c69c7ee1ade66884de6 |
|
MD5 | d95ca3203395691d71394431041e814b |
|
BLAKE2b-256 | 6bd4b53c6428e77ccb2060892879e401f730f048cf8bec1f957c55101617dc8a |
File details
Details for the file pycodec2-3.0.1-cp311-cp311-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: pycodec2-3.0.1-cp311-cp311-macosx_10_9_x86_64.whl
- Upload date:
- Size: 917.3 kB
- Tags: CPython 3.11, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.12.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fe719f9e700b6f83e8f558387648aa2606ede89ed87cd2324eab4727376ccd4e |
|
MD5 | 6a3c9119e402991f8bb5aed01acfb122 |
|
BLAKE2b-256 | 571331c25b39db542b11808a7023db91dca6f1c38eada8611c1635f8187ae799 |
File details
Details for the file pycodec2-3.0.1-cp310-cp310-musllinux_1_1_x86_64.whl
.
File metadata
- Download URL: pycodec2-3.0.1-cp310-cp310-musllinux_1_1_x86_64.whl
- Upload date:
- Size: 1.4 MB
- Tags: CPython 3.10, musllinux: musl 1.1+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.12.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3f62df81ebaca3cb65f9ceaf84a79c3f322013b08a5146c53d5162a019f19f6d |
|
MD5 | 20a27b5958b468c5dee4c1f2353a35f9 |
|
BLAKE2b-256 | 046d1422c1eeb72ae65fda71ae2b74c00cda4a9d440d4fcb10097d0891108da5 |
File details
Details for the file pycodec2-3.0.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: pycodec2-3.0.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 1.4 MB
- Tags: CPython 3.10, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.12.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 118e87b43b7c737adc8b1d4080fa6ff184fcd8720344cf20421be9bd85bbd48e |
|
MD5 | 9fbcfe84d68b0b223aa7f552ede60bd6 |
|
BLAKE2b-256 | d411b4912ba9d872fe030245d81330c8610a17a0ce36febe28bff3e9d2de7d30 |
File details
Details for the file pycodec2-3.0.1-cp310-cp310-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: pycodec2-3.0.1-cp310-cp310-macosx_10_9_x86_64.whl
- Upload date:
- Size: 916.8 kB
- Tags: CPython 3.10, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.12.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 629dbb4657e6012cca823d1945d1a01e4b39f0714a2ae8456d3fb6072ed4890d |
|
MD5 | b401aaecc2a29dbb5096b69991a77509 |
|
BLAKE2b-256 | 691a7563f3afb204926d66db8cda7e5742693b6ccbadfd38cd4ecc0234aa80b3 |
File details
Details for the file pycodec2-3.0.1-cp39-cp39-musllinux_1_1_x86_64.whl
.
File metadata
- Download URL: pycodec2-3.0.1-cp39-cp39-musllinux_1_1_x86_64.whl
- Upload date:
- Size: 1.4 MB
- Tags: CPython 3.9, musllinux: musl 1.1+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.12.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ba9da10113c2a75ccb87936a0070c90349558a01579b654517fb7158d3624900 |
|
MD5 | ca698189b5fba0b2a0db63662b08b172 |
|
BLAKE2b-256 | 3aa18c1603958fab212b0809e4bb5d286becf75982761d6fae02395f2b12f369 |
File details
Details for the file pycodec2-3.0.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: pycodec2-3.0.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 1.4 MB
- Tags: CPython 3.9, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.12.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 02317e5afac703316e6c15db3ef0ff2183df8b6f8505d52769bf0e1bf806a53a |
|
MD5 | b7d16b67134c916f0fb1edcc996e3a48 |
|
BLAKE2b-256 | 9260063f53dab10127995d30d2be729bca0c988fbbd9921d56544fa7cc8a82a0 |
File details
Details for the file pycodec2-3.0.1-cp39-cp39-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: pycodec2-3.0.1-cp39-cp39-macosx_10_9_x86_64.whl
- Upload date:
- Size: 917.5 kB
- Tags: CPython 3.9, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.12.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d7493d2d6170a0efe58ad9d4cbf7ee424b04ac9aa5d27bc9a2c0a1e8db61f76c |
|
MD5 | de1d5e3925107889825785e0680478bc |
|
BLAKE2b-256 | 2949a6286c12b7105e9344ef4f8fd5e47b64d3f8ee7fccfece7ae9a222041087 |