Skip to main content

A pure python module for working with WAVE files with support for all common file formats for both RIFF and RIFX.

Project description

https://travis-ci.org/acelletti/wavy.svg?branch=master https://coveralls.io/repos/github/acelletti/wavy/badge.svg?branch=travisci https://img.shields.io/appveyor/tests/acelletti/wavy.svg https://img.shields.io/github/license/acelletti/wavy.svg https://readthedocs.org/projects/wavy/badge/?version=latest

Introduction

A pure python module for working with WAVE files with support for all common file formats for both RIFF and RIFX.

When working with WAVE files, there are two main pure python modules available:

  • builtin.wave

    Python built-in module, lacks support for float and 24bit integer. Provides raw data instead of an array of values.

  • scipy.wave

    Scipy does not support 24bit integer files. The module strength and weakness is its simplicity, if all you need to do is read and write, this might be for you.

The wave module provides a fully featured dedicated module that can be used as an alternative to the above if flexibility and ease of use are desirable.

Comparison

The following table shows a comparison of supported functionality:

Functionality

builtin.wave

scipy.wave

wavy

RIFF Format Support

check-circle

check-circle

check-circle

RIFX Format Support

times-circle

check-circle

check-circle

Read Audio Information

check-circle

times-circle

check-circle

Read Data As Array

times-circle

check-circle

check-circle

Read Tag Information

times-circle

times-circle

check-circle

The following table shows a comparison of supported formats for uncompressed WAVE files:

Sample Width

Format Tag

builtin.wave

scipy.wave

wavy

8 bit

PCM

check-circle

check-circle

check-circle

EXTENSIBLE

times-circle

check-circle

check-circle

16 bit

PCM

check-circle

check-circle

check-circle

EXTENSIBLE

times-circle

check-circle

check-circle

24 bit

PCM

check-circle

times-circle

check-circle

EXTENSIBLE

times-circle

times-circle

check-circle

32 bit

PCM

check-circle

check-circle

check-circle

EXTENSIBLE

times-circle

check-circle

check-circle

FLOAT

times-circle

check-circle

check-circle

64 bit

FLOAT

times-circle

check-circle

check-circle

Installation

The latest stable version is available on PyPI.

Either add wavy to your requirements.txt file or install with pip:

pip install wavy

Usage

Read File

Open a file using the module use wavy.read:

>>> import wavy
>>> file = wavy.read("audio.wav")
>>> file
WaveFile(sample_width=16, framerate=44100, n_channels=2, n_frames=286653)

Get the data for the file:

>>> rate, data = file.framerate, file.data

>>> rate
44100

>>> data.shape
(286653, 2)

>>> data.dtype
int16

Get File Info

To read the file information without loading the data use wavy.info:

>>> wavy.info("audio.wav")
WaveFileInfo(sample_width=16, framerate=44100, n_channels=2, n_frames=286653, tags=None)

Authors

License

This project is licensed under the MIT License - see the LICENSE file for details.

Project details


Download files

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

Source Distribution

wavy-1.0.1.tar.gz (28.0 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page