Skip to main content
Help us improve Python packaging – donate today!

No project description provided

Project Description

Build Status Coverage Status PyPI Docs

Motivation

Zounds is a python library for working with sound. Its primary goals are to:

Audio processing graphs and machine learning pipelines are defined using featureflow.

A Quick Example

import zounds

Resampled = zounds.resampled(resample_to=zounds.SR11025())


@zounds.simple_in_memory_settings
class Sound(Resampled):
    """
    A simple pipeline that computes a perceptually weighted modified discrete
    cosine transform, and "persists" feature data in an in-memory store.
    """

    windowed = zounds.ArrayWithUnitsFeature(
        zounds.SlidingWindow,
        needs=Resampled.resampled,
        wscheme=zounds.HalfLapped(),
        wfunc=zounds.OggVorbisWindowingFunc(),
        store=True)

    mdct = zounds.ArrayWithUnitsFeature(
        zounds.MDCT,
        needs=windowed)

    weighted = zounds.ArrayWithUnitsFeature(
        lambda x: x * zounds.AWeighting(),
        needs=mdct)

if __name__ == '__main__':

    # produce some audio to test our pipeline, and encode it as FLAC
    synth = zounds.SineSynthesizer(zounds.SR44100())
    samples = synth.synthesize(zounds.Seconds(5), [220., 440., 880.])
    encoded = samples.encode(fmt='FLAC')

    # process the audio, and fetch features from our in-memory store
    _id = Sound.process(meta=encoded)
    sound = Sound(_id)

    # grab all the frequency information, for a subset of the duration
    start = zounds.Milliseconds(500)
    end = start + zounds.Seconds(2)
    snippet = sound.weighted[start: end, :]

    # grab a subset of frequency information for the duration of the sound
    freq_band = slice(zounds.Hertz(400), zounds.Hertz(500))
    a440 = sound.mdct[:, freq_band]

    # produce a new set of coefficients where only the 440hz sine wave is
    # present
    filtered = sound.mdct.zeros_like()
    filtered[:, freq_band] = a440

    # apply a geometric scale, which more closely matches human pitch
    # perception, and apply it to the linear frequency axis
    scale = zounds.GeometricScale(50, 4000, 0.05, 100)
    log_coeffs = scale.apply(sound.mdct, zounds.HanningWindowingFunc())

    # reconstruct audio from the MDCT coefficients
    mdct_synth = zounds.MDCTSynthesizer()
    reconstructed = mdct_synth.synthesize(sound.mdct)
    filtered_reconstruction = mdct_synth.synthesize(filtered)

    # start an in-browser REPL that will allow you to listen to and visualize
    # the variables defined above (and any new ones you create in the session)
    app = zounds.ZoundsApp(
        model=Sound,
        audio_feature=Sound.ogg,
        visualization_feature=Sound.weighted,
        globals=globals(),
        locals=locals())
    app.start(9999)

Find more inspiration in the examples folder, or on the blog.

Installation

Libsndfile Issues

Installation currently requires you to build lbiflac and libsndfile from source, because of an outstanding issue that will be corrected when the apt package is updated to libsndfile 1.0.26. Download and run this script to handle this step.

Numpy and Scipy

The Anaconda python distribution is highly recommended.

Zounds

Finally, just:

pip install zounds

Release history Release notifications

This version
History Node

0.46.0

History Node

0.45.0

History Node

0.44.0

History Node

0.43.0

History Node

0.42.0

History Node

0.41.12

History Node

0.40.12

History Node

0.39.12

History Node

0.38.12

History Node

0.37.12

History Node

0.36.12

History Node

0.35.12

History Node

0.34.12

History Node

0.33.12

History Node

0.32.12

History Node

0.31.12

History Node

0.30.12

History Node

0.29.12

History Node

0.28.12

History Node

0.27.12

History Node

0.26.12

History Node

0.25.12

History Node

0.24.12

History Node

0.23.12

History Node

0.22.12

History Node

0.21.12

History Node

0.20.11

History Node

0.20.10

History Node

0.20.9

History Node

0.19.9

History Node

0.18.9

History Node

0.17.9

History Node

0.16.9

History Node

0.15.9

History Node

0.14.9

History Node

0.13.9

History Node

0.11.9

History Node

0.10.9

History Node

0.10.8

History Node

0.10.7

History Node

0.9.7

History Node

0.8.7

History Node

0.8.6

History Node

0.8.5

History Node

0.8.4

History Node

0.7.4

History Node

0.6.4

History Node

0.5.4

History Node

0.4.4

History Node

0.4.3

History Node

0.4.2

History Node

0.4.1

History Node

0.3.1

History Node

0.3.0

History Node

0.2.9

History Node

0.2.8

History Node

0.2.7

History Node

0.1.6

History Node

0.1.3

History Node

0.1.2

History Node

0.1.1

History Node

0.1

Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
zounds-0.46.0.tar.gz (182.5 kB) Copy SHA256 hash SHA256 Source None Apr 11, 2018

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page