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
Release files for signal-envelope 1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| signal-envelope-1.3.tar.gz | 15.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| signal_envelope-1.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 30.7 kB
Release files / signal-envelope-1.3.tar.gz
| Download URL | signal-envelope-1.3.tar.gz |
|---|---|
| Size | 15.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a8018922e7ebe73f6c06b784660ec33fa48fafad185d87bc832581362de6862a
|
|
BLAKE2b-256 checksum How to use checksums |
4750bdaf282b6d2aaedc7572a2570d7c81fc2f8f633dd78747f81acdd7d66f2f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|
Release files / signal_envelope-1.3-py3-none-any.whl
| Download URL | signal_envelope-1.3-py3-none-any.whl |
|---|---|
| Size | 14.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9531f32b7eb8c276e9ac529024e694f57fdecaaf91ef53839109af6ae63bcc40
|
|
BLAKE2b-256 checksum How to use checksums |
f09932677de46e11a635e801462bfb4bb7170cf7cf92649059c8ae5cc9a0d384
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|