All Projects → sevagh → Pitch Detection

sevagh / Pitch Detection

Licence: mit
collection of O(NlogN) pitch detection implementations

Labels

Projects that are alternatives of or similar to Pitch Detection

Kfr
Fast, modern C++ DSP framework, FFT, Sample Rate Conversion, FIR/IIR/Biquad Filters (SSE, AVX, AVX-512, ARM NEON)
Stars: ✭ 985 (+194.03%)
Mutual labels:  fft, dsp
ooura
Javascript port of Ooura FFT implementation
Stars: ✭ 23 (-93.13%)
Mutual labels:  dsp, fft
Fpga Fft
A highly optimized streaming FFT core based on Bailey's 4-step large FFT algorithm
Stars: ✭ 45 (-86.57%)
Mutual labels:  fft, dsp
intfftk
Fully pipelined Integer Scaled / Unscaled Radix-2 Forward/Inverse Fast Fourier Transform (FFT) IP-core for newest Xilinx FPGAs (Source language - VHDL / Verilog). GNU GPL 3.0.
Stars: ✭ 43 (-87.16%)
Mutual labels:  dsp, fft
dsp-kit
A digital signal processing library in Javascript
Stars: ✭ 32 (-90.45%)
Mutual labels:  dsp, fft
Surge
A Swift library that uses the Accelerate framework to provide high-performance functions for matrix math, digital signal processing, and image manipulation.
Stars: ✭ 4,945 (+1376.12%)
Mutual labels:  fft, dsp
lsp-dsp-lib
DSP library for signal processing
Stars: ✭ 37 (-88.96%)
Mutual labels:  dsp, fft
Dsp Theory
Theory of digital signal processing (DSP): signals, filtration (IIR, FIR, CIC, MAF), transforms (FFT, DFT, Hilbert, Z-transform) etc.
Stars: ✭ 437 (+30.45%)
Mutual labels:  fft, dsp
fmcw-RADAR
[mmWave based fmcw radar design files] based on AWR1843 chip operating at 76-GHz to 81-GHz.
Stars: ✭ 41 (-87.76%)
Mutual labels:  dsp, fft
dsp
DSP and filtering library
Stars: ✭ 36 (-89.25%)
Mutual labels:  dsp, fft
Spectro
🎶 Real-time audio spectrogram generator for the web
Stars: ✭ 383 (+14.33%)
Mutual labels:  fft, dsp
math
Useful m-scripts for DSP (CIC, FIR, FFT, Fast convolution, Partial Filters etc.)
Stars: ✭ 15 (-95.52%)
Mutual labels:  dsp, fft
Fourier
Fast Fourier transforms (FFTs) in Rust
Stars: ✭ 206 (-38.51%)
Mutual labels:  fft, dsp
FFTVisualizer
This project demonstrates DSP capabilities of Terasic DE2-115
Stars: ✭ 17 (-94.93%)
Mutual labels:  dsp, fft
dsp-theory
Theory of digital signal processing (DSP): signals, filtration (IIR, FIR, CIC, MAF), transforms (FFT, DFT, Hilbert, Z-transform) etc.
Stars: ✭ 643 (+91.94%)
Mutual labels:  dsp, fft
DTMF-Decoder
A Java program to implement a DMTF Decoder.
Stars: ✭ 28 (-91.64%)
Mutual labels:  dsp, fft
Noaa Apt
NOAA APT weather satellite image decoder, for Linux, Windows, RPi 2+ and OSX
Stars: ✭ 257 (-23.28%)
Mutual labels:  dsp
ad-server
advertising server
Stars: ✭ 31 (-90.75%)
Mutual labels:  dsp
RpiANC
Active Noise Control on Raspberry Pi
Stars: ✭ 49 (-85.37%)
Mutual labels:  dsp
Daisysp
A Powerful, Open Source DSP Library in C++
Stars: ✭ 291 (-13.13%)
Mutual labels:  dsp

Pitch detection algorithms

Autocorrelation-based C++ pitch detection algorithms with O(nlogn) or lower running time:

*: SWIPE' appears to be O(n) but with an enormous constant factor. The implementation complexity is much higher than MPM and YIN and it brings in additional dependencies (BLAS + LAPACK).

**: There's a parallel version of SWIPE, Aud-SWIPE-P.

Suggested usage of this library can be seen in the utility wav_analyzer, which divides a wav file into chunks of 0.01s and checks the pitch of each chunk. Sample output of wav_analyzer:

At t: 0.5
        mpm: 162.529
        yin: 162.543
        swipe: 162.183
        pmpm: 162.529
        pyin: 162.543

Degraded audio tests

All testing files are here - the progressive degradations are described by the respective numbered JSON file, generated using audio-degradation-toolbox. The original clip is a Viola playing E3 from the University of Iowa MIS.

The results come from parsing the output of wav_analyzer to count how many 0.1s slices of the input clip were in the ballpark of the expected value of 164.81 - I considered anything 160-169 to be acceptable:

Degradation level MPM # correct YIN # correct SWIPE' # correct
0 26 22 5
1 23 21 13
2 19 21 9
3 18 19 7
4 19 19 6
5 18 19 5

Build and install

Using this project should be as easy as make && sudo make install on Linux with a modern GCC - I don't officially support other platforms.

This project depends on ffts, BLAS/LAPACK, and mlpack. To run the tests, you need googletest, and run make -C test/ && ./test/test. To run the bench, you need google benchmark, and run make -C test/ bench && ./test/bench.

Build and install pitch_detection, run the tests, and build the sample application, wav_analyzer:

# build libpitch_detection.so
make clean all

# build tests and benches
make -C test clean all

# run tests and benches 
./test/test
./test/bench

# install the library and headers to `/usr/local/lib` and `/usr/local/include`
sudo make install

# build and run C++ sample
make -C wav_analyzer clean all
./wav_analyzer/wav_analyzer

Docker

To simplify the setup, there's a Dockerfile that sets up a Ubuntu container with all the dependencies for compiling the library and running the included tests and benchmarks. You can build the image or pull it from DockerHub (esimkowitz/pitchdetection):

# build
$ docker build --rm --pull -f "Dockerfile" -t pitchdetection:latest "."
$ docker run --rm --init -it pitchdetection:latest

# pull
$ docker pull esimkowitz/pitchdetection:latest
$ docker run --rm --init -it esimkowitz/pitchdetection:latest

Once you're in the container, run the tests and benches:

./test/test
./test/bench

Usage

Read the header and sample wav_analyzer.

The namespaces are pitch and pitch_alloc. The functions and classes are templated for <double> and <float> support.

The pitch namespace functions perform automatic buffer allocation, while pitch_alloc::{Yin, Mpm} give you a reusable object (useful for computing pitch for multiple uniformly-sized buffers):

#include <pitch_detection.h>

std::vector<double> audio_buffer(8092);

double pitch_yin = pitch::yin<double>(audio_buffer, 48000);
double pitch_mpm = pitch::mpm<double>(audio_buffer, 48000);
double pitch_pyin = pitch::pyin<double>(audio_buffer, 48000);
double pitch_pmpm = pitch::pmpm<double>(audio_buffer, 48000);
double pitch_swipe = pitch::swipe<double>(audio_buffer, 48000);

pitch_alloc::Mpm<double> ma(8092);
pitch_alloc::Yin<double> ya(8092);

for (int i = 0; i < 10000; ++i) {
        auto pitch_yin = ya.pitch(audio_buffer, 48000);
        auto pitch_mpm = ma.pitch(audio_buffer, 48000);
        auto pitch_pyin = ya.probabilistic_pitch(audio_buffer, 48000);
        auto pitch_pmpm = ma.probabilistic_pitch(audio_buffer, 48000);
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].