Giter Club home page Giter Club logo

spectromap's Introduction

SpectroMap

python-version pypi-version license CodeFactor

Downloads Downloads Downloads

SpectroMap is a peak detection algorithm that computes the constellation map (or audio fingerprint) of a given signal.

img

An example of the SpectroMap implementation and its properties can be found in our research paper:

Further research papers are listed as follows:

  • López-García, A., Martínez-Rodríguez, B., Liern, V. (2022). A Proposal to Compare the Similarity Between Musical Products. One More Step for Automated Plagiarism Detection? In: Montiel, M., Agustín-Aquino, O.A., Gómez, F., Kastine, J., Lluis-Puebla, E., Milam, B. (eds) Mathematics and Computation in Music. MCM 2022. Lecture Notes in Computer Science(), vol 13267. Springer, Cham. https://doi.org/10.1007/978-3-031-07015-0_16

  • López-García, A. (2024). A Fingerprinting-Based Strategy for Musical Genre Similarity. In: Noll, T., Montiel, M., Gómez, F., Hamido, O.C., Besada, J.L., Martins, J.O. (eds) Mathematics and Computation in Music. MCM 2024. Lecture Notes in Computer Science, vol 14639. Springer, Cham. https://doi.org/10.1007/978-3-031-60638-0_26

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.spectromap import *

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.spectromap import *

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}
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.