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.spectromap 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.spectromap 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)
Cite this work
If you use SpectroMap in your research I would appreciate a citation to the following paper:
@misc{https://doi.org/10.48550/arxiv.2211.00982,
doi = {10.48550/ARXIV.2211.00982},
url = {https://arxiv.org/abs/2211.00982},
author = {López-García, Aarón},
title = {SpectroMap: Peak detection algorithm for audio fingerprinting},
publisher = {arXiv},
year = {2022},
copyright = {Creative Commons Attribution 4.0 International}
}
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 Distributions
Hashes for spectromap-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bdbffa83b3c7364110ee589732356908c54652eaa0a6ac49d52c82d3327c9659 |
|
MD5 | 0b66c95b687a04da5fc9155194144e74 |
|
BLAKE2b-256 | 6f59ea01ce20404423b9124d7ebd513d362707f6f55101e7cd71460b24e87aef |
Hashes for spectromap-1.0.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 48b9902247cd95ed3ce1c384ab02d5e5be08b6845e3bbe88546a6d92b469b029 |
|
MD5 | 1f092be790276bc0fc76ba9f330fc2cb |
|
BLAKE2b-256 | 488e91e2d8eda4ac7796a25d7b61baeb20e5dd1672c4651bf7180134677caf10 |
Hashes for SpectroMap-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d2f93fa717c4ddb41b4ed2e89042c4c16e49349837dbe04dd47532fa1dbecb3d |
|
MD5 | 41fd3086bf0509701399be89b5f5db4b |
|
BLAKE2b-256 | d586474e02a5e7cacddc70f9111da202908728fd8f42e4afdf343c888e42d4bc |
Hashes for SpectroMap-1.0.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 717a1e557254ca4db828566dcc240047d021fb8d797a14abab16eb8cefb5f0c1 |
|
MD5 | ddcc4975dddf6afc9d5e18608445744d |
|
BLAKE2b-256 | 1a810d114a8c82c7086a9381979adb6225c28ac5ea18adb1b7399b8cba7ad6ef |