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
File details
Details for the file SpectroMap-1.0.1.tar.gz
.
File metadata
- Download URL: SpectroMap-1.0.1.tar.gz
- Upload date:
- Size: 16.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f156978939f3e8e0772a404646a920c705468b26a855a9ff401343084261a229 |
|
MD5 | 9bfad5e12428b1869362d06ed0faa2d9 |
|
BLAKE2b-256 | 5d1a25a7a743544b25078f316629d81db6c2dbadae4b81ea300a1164583cf2dc |
File details
Details for the file SpectroMap-1.0.1-py3-none-any.whl
.
File metadata
- Download URL: SpectroMap-1.0.1-py3-none-any.whl
- Upload date:
- Size: 16.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bbf7786824a9fa3fe2d7dd645c84b7e4b427143a11a039fd6a41078db2d8219c |
|
MD5 | 1c39c0c4c7fcd7af02656013d0d95171 |
|
BLAKE2b-256 | 08084b3cd613c1703871e457e97d6bb20ab33aa920a5d6ce0561b1f05800584a |
File details
Details for the file SpectroMap-1.0.1-py2.py3-none-any.whl
.
File metadata
- Download URL: SpectroMap-1.0.1-py2.py3-none-any.whl
- Upload date:
- Size: 16.8 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 934af93ed826ec8430217405629a82036fc146eed9630af4cfc77769074b2669 |
|
MD5 | 9a60ec8220e82477fb95ac7ec6d628c2 |
|
BLAKE2b-256 | 6339ac2694987fd0eb882aff4e73c99eb2b9e52295b1bb7ddac95912f0ce664f |