Skip to main content

Extract the envelope of a digital signal

Project description

Envelope

Python module to extract the envelope of signals.

More information in this paper

Functions

This module implements 3 functions:

read_wav("path/to/mono/signal.wav"), that returns a tuple (W, fps), where W is a numpy array and fps is an int with the value of the frame rate of the file.

save_wav(signal, path = "test.wav", fps = 44100), that saves a numpy array as a .wav file

get_frontiers(W), that returns a tuple (pos_idxs, neg_idxs) with the indices of the positive and negative frontiers of a numpy array representing the samples of a discrete function. If this function is called from a compatible setup (currently, Windows 64bit), it computes the frontiers faster via specialized native code. A fall-back version in pure Python is also provided, in which case a warning is printed indicated that a slower mode is being used. In both cases, the usage is the same.

Usage

install the module: pip install signal-envelope

A minimal example would then be:

import signal_envelope as se

W, _ = se.read_wav("path/to/signal.wav")
Xpos, Xneg = se.get_frontiers(W)
print(Xpos)

Two test wav files can be found at the Github repository for the project.

Source

The code for this repository (except, for now, the C++ source code of the envelope.dll) is available at Github

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

signal-envelope-0.1.1.tar.gz (15.2 kB view hashes)

Uploaded Source

Built Distribution

signal_envelope-0.1.1-py3-none-any.whl (13.9 kB view hashes)

Uploaded Python 3

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