Skip to main content

Extracts the temporal envelope of a digital signal

Project description

Envelope

Python module to extract the envelope of signals.

More information at Github;

Interactive visualization here.

Functions

This module implements 3 functions:

read_wav("path/to/mono/signal.wav"),

Returns a tuple (W, fps), where W is a numpy array and fps is an integer with the value of the frame rate of the file.

save_wav(signal, path = "test.wav", fps = 44100),

Saves a NumPy array as a .wav file.

get_frontiers(W, mode=0),

When mode=0:

Returns a tuple (pos_ids, neg_ids) of NumPy arrays, with the indices of the positive and negative frontiers of a NumPy array representing a discrete wave W.

When mode=1:

Returns the NumPy array X_envelope with the indices of the envelope of the wave W. Note that, to obtain the values of the envelope at those points, np.abs(W[X_envelope]) is recommended.

If this function is called from a compatible setup (currently, Windows 64bit), it computes the envelope and the frontiers faster via specialized native code. A fall-back version in pure Python is also provided, in which case a warning is printed indicating that a slower mode is being used. In both cases, the usage is the same, as are the results.

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")
X_pos_frontier, X_neg_frontier = se.get_frontiers(W, 0)
print(X_pos_frontier, W[X_pos_frontier])

X_envelope = se.get_frontiers(W, 1)
print(X_envelope, np.abs(W[X_envelope]))

A number of test wav files can be found at the Github repository for the project.

Source

The code for this repository is available at Github.

Used Libraries

Libsndfile Boost Intel Math Kernel Library

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-1.2.tar.gz (16.1 kB view details)

Uploaded Source

Built Distribution

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

signal_envelope-1.2-py3-none-any.whl (15.3 kB view details)

Uploaded Python 3

File details

Details for the file signal-envelope-1.2.tar.gz.

File metadata

  • Download URL: signal-envelope-1.2.tar.gz
  • Upload date:
  • Size: 16.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.8.1

File hashes

Hashes for signal-envelope-1.2.tar.gz
Algorithm Hash digest
SHA256 2738ea858e2e3f66412b9584fcb5b2d80c87c315d57f5b0aa33e4e9a4cce9348
MD5 9cb728badf87be228f1860300b65ad76
BLAKE2b-256 1e23e2a97ce51745e46513153c5458b49e22f8113c96743cb7bfddd589312f7c

See more details on using hashes here.

File details

Details for the file signal_envelope-1.2-py3-none-any.whl.

File metadata

  • Download URL: signal_envelope-1.2-py3-none-any.whl
  • Upload date:
  • Size: 15.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.8.1

File hashes

Hashes for signal_envelope-1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 873f8d9b526cdddc2efefa53f43e4859efec8b1834d5c588f7e9bf3aac1b6df0
MD5 b6d2bcde30f53c633a25ef946748db23
BLAKE2b-256 549da6ee553b8992f7413d379313a18b2330a9b03dd53f540cbca1464d096234

See more details on using hashes here.

Supported by

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