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.4.2.tar.gz (1.3 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.4.2-py3-none-any.whl (34.4 kB view details)

Uploaded Python 3

File details

Details for the file wave-chunk-parser-1.4.2.tar.gz.

File metadata

  • Download URL: wave-chunk-parser-1.4.2.tar.gz
  • Upload date:
  • Size: 1.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.10.4

File hashes

Hashes for wave-chunk-parser-1.4.2.tar.gz
Algorithm Hash digest
SHA256 9ce98bdf4007488cccfbee5989551c82e7d7f466969fd231b9fdaec71a5b4709
MD5 c6c6060fa2c0d889a20616ab060b8a9e
BLAKE2b-256 59f6e167ed17e5ec5151768714bcc0f3158230bf82e9370177f0d2c38c4a3a25

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for wave_chunk_parser-1.4.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ce235238146543757c211a1a27b72eea8a8f6db6e23e791e0005c0f5efbc40d2
MD5 83b1a0ade62e32c0ad75e778c8727d8c
BLAKE2b-256 bb26c87c3381e9a605de24def873165918419a00e5f5fa36bcc4e83eca3f7a8d

See more details on using hashes here.

Release history Release notifications | RSS feed

1.5.0

1 file

This release

1.4.2 This release

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

1.0.1

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