Skip to main content

Wave Chunk Parser

Parses wave files chunks in order to extract metadata and audio. Also provides an option to write a bunch of given chunks back into a coherent file.

Installation

pip install wave-chunk-parser

Reading a file / IO stream

from wave_chunk_parser.chunks import RiffChunk

with open("file.wav", "rb") as file:
    riff_chunk = RiffChunk.from_file(file)

From there you can access the sub chunks from riff_chunk.sub_chunks. The data chunk uses a numpy array to hold the vectors of audio samples.

Format (fmt) and data chunks are critical. Cart chunk is optional but provides those markers we need for handling broadcast audio.

Writing a file / IO stream

You will need to build the chunks individually and supply them in a list of:

chunks = [FormatChunk, DataChunk, CartChunk]

The format chunk must come before the data chunk (we need to know how to en/decode it). Cart chunk can appear anywhere in the list or even not exist at all.

To get a blob for writing to disk (or wherever), simply:

riff_chunk = RiffChunk(chunks)
blob = riff_chunk.to_bytes()

The to_bytes function exists on every chunk type. So, if you particularly desire, you can turn a standalone format chunk into a blob.

Numpy on macOS

We need openblas to make Numpy work on macOS:

pip uninstall numpy
brew install openblas
OPENBLAS="$(brew --prefix openblas)" pip install numpy --no-cache-dir

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

wave_chunk_parser-1.0.1.tar.gz (1.2 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

wave_chunk_parser-1.0.1-py3-none-any.whl (22.6 kB view details)

Uploaded Python 3

File details

Details for the file wave_chunk_parser-1.0.1.tar.gz.

File metadata

  • Download URL: wave_chunk_parser-1.0.1.tar.gz
  • Upload date:
  • Size: 1.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.9.0

File hashes

Hashes for wave_chunk_parser-1.0.1.tar.gz
Algorithm Hash digest
SHA256 85067237cbe73536ac7a9149e80bf66b6310c5845354a4592d5ff76044a36488
MD5 02226048f500d7d69a11786f20f529f9
BLAKE2b-256 380409c56d5a1de9de72766a4ebfdc4c4e145c171fb0ef183b01e65ca464649f

See more details on using hashes here.

File details

Details for the file wave_chunk_parser-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: wave_chunk_parser-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 22.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.9.0

File hashes

Hashes for wave_chunk_parser-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7a2658013c41ec6e0ddeede79c0d82e66b1db2f0d7f5a9cf3e60a8e05c7e0402
MD5 b047b5fe962f12c45f2db048b3031b3e
BLAKE2b-256 3ab81be1aa6894bce4cbba33e149215d40e0a3127b647bab60099a35dcbc196c

See more details on using hashes here.

Release history Release notifications | RSS feed

1.5.0

1 file

1.4.2

2 files

1.4.1

2 files

1.4.0

2 files

1.3.0

2 files

1.2.2

2 files

1.2.1

2 files

1.2.0

2 files

1.1.1

2 files

1.1.0

2 files

1.0.4

2 files

1.0.3

2 files

1.0.2

2 files

This release

1.0.1 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page