SpectroMap is a peak detection algorithm that computes the constellation map for a given signal
Project description
SpectroMap
SpectroMap is a peak detection algorithm that computes the constellation map (or audio fingerprint) of a given signal.
Installation
You can install the SpectroMap library from GitHub:
git clone https://github.com/Aaron-AALG/spectromap.git python3 -m pip install -e spectromap
You can also install it directly from PyPI:
pip install spectromap
Usage
This packages contains the spectromap object that manages the full process of audio fingerprinting extraction. Given a signal Y, we just have to instantiate the class with Y and the corresponding kwargs (if needed).
spectrogram object
An example to apply SpectroMap over a signal is:
import numpy as np
from spectromap.functions import spectromap
y = np.random.rand(44100)
kwargs = {'fs': 22050, 'nfft': 512, 'noverlap':64}
# Instantiate the SpectroMap object
SMap = spectromap(y, **kwargs)
# Get the spectrogram representation plus its time and frequency bands
f, t, S = SMap.get_spectrogram()
# Extract the topological prominent elements from the spectrogram, known as "Peak detection".
# We get the coordinates (time, freq) of the peaks and the matrix with just these peaks.
fraction = 0.15 # Fraction of spectrogram to compute local comparisons
condition = 2 # Axis to analyze (0: Time, 1: Frequency, 2: Time+Frequency)
id_peaks, peaks = SMap.peak_matrix(fraction, condition)
# Get the peaks coordinates as as (s, Hz, dB)-array.
extraction_t_f_dB = SMap.from_peaks_to_array()
peak_search function
In case you desire to compute the spectrogram by yourself, then you can make use of the peak search function instead.
from spectromap.functions import peak_search
fraction = 0.05 # Fraction of spectrogram to compute local comparisons
condition = 2 # Axis to analyze (0: Time, 1: Frequency, 2: Time+Frequency)
id_peaks, peaks = peak_search(spectrogram, fraction, condition)
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
Built Distribution
File details
Details for the file spectromap-0.1.1.tar.gz
.
File metadata
- Download URL: spectromap-0.1.1.tar.gz
- Upload date:
- Size: 2.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2cfd0bd4917661eb75f6f477e82defec74f9c0ffdae5d32fc5d7e6f0a9c305ad |
|
MD5 | ad43302143a94c0937cd6a78c0687820 |
|
BLAKE2b-256 | b56476fc3baf9dbe9c5011637cd8f499fa2f11c6f8efd90b59406ba96462fac3 |
File details
Details for the file spectromap-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: spectromap-0.1.1-py3-none-any.whl
- Upload date:
- Size: 2.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a85a48860ba3d26f5c935e52201582dd69d681c7e4213d576828e1c625f3347b |
|
MD5 | 0380574f57fb5921ba18a78ac248930e |
|
BLAKE2b-256 | 90589e68f97cc099d35beb23b350064e412ecbdab59fc3b1ea993a571b65f2f0 |