All Projects → hendriks73 → tempo-cnn

hendriks73 / tempo-cnn

Licence: AGPL-3.0 license
Framework for estimating temporal properties of music tracks.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to tempo-cnn

tutorial
Tutorial on Tempo, Beat and Downbeat estimation
Stars: ✭ 44 (-29.03%)
Mutual labels:  tempo, mir
libfmp
libfmp - Python package for teaching and learning Fundamentals of Music Processing (FMP)
Stars: ✭ 71 (+14.52%)
Mutual labels:  tempo, mir
DSMRloggerWS
New firmware for the DSMRlogger heavily using WebSockets and Javascript
Stars: ✭ 29 (-53.23%)
Mutual labels:  meter
instance-segmentation
No description or website provided.
Stars: ✭ 40 (-35.48%)
Mutual labels:  fcn
AODamageMeter
Real-time graphical damage meter for the sci-fi MMORPG Anarchy Online.
Stars: ✭ 14 (-77.42%)
Mutual labels:  meter
SmartSpin2k
Transform your spin bike into a Smart Trainer!
Stars: ✭ 88 (+41.94%)
Mutual labels:  meter
metermon
Dockerized rtlamr wrapper that outputs formatted JSON messages over mqtt
Stars: ✭ 19 (-69.35%)
Mutual labels:  meter
Fcn For Semantic Segmentation
Implemention of FCN-8 and FCN-16 with Keras and uses CRF as post processing
Stars: ✭ 155 (+150%)
Mutual labels:  fcn
tf-semantic-segmentation-FCN-VGG16
Semantic segmentation for classifying road. "Fully Convolutional Networks for Semantic Segmentation (2015)" implemented using TF
Stars: ✭ 30 (-51.61%)
Mutual labels:  fcn
domoticz gaspar
Get Gaspar smart meter index to domoticz
Stars: ✭ 23 (-62.9%)
Mutual labels:  meter
prompt-password-strength
Custom mask function for prompt-password that adds a 'strength progress meter' that changes color as the password strength increases. Uses zxcvbn, the popular password strength estimation tool brought to you by dropbox.
Stars: ✭ 18 (-70.97%)
Mutual labels:  meter
SMLReader
ESP8266 based smart meter (SML) to MQTT gateway
Stars: ✭ 170 (+174.19%)
Mutual labels:  meter
greek scansion
Python library for automatic analysis of Ancient Greek hexameter. The algorithm uses linguistic rules and finite-state technology.
Stars: ✭ 16 (-74.19%)
Mutual labels:  meter
Home Assistant EDP Box
Integração das EDP Box com Home Assistant Core
Stars: ✭ 91 (+46.77%)
Mutual labels:  meter
openMIC
Meter Information Collection System
Stars: ✭ 15 (-75.81%)
Mutual labels:  meter
Neural-Tile
A better tiling script for Neural-Style
Stars: ✭ 35 (-43.55%)
Mutual labels:  neural
Fcn
Chainer Implementation of Fully Convolutional Networks. (Training code to reproduce the original result is available.)
Stars: ✭ 211 (+240.32%)
Mutual labels:  fcn
Valley.Net.Protocols.MeterBus
M-Bus (meter bus, meterbus, mbus) C# project for communicating and parsing M-Bus (EN 13757-2 and EN 13757-3)
Stars: ✭ 29 (-53.23%)
Mutual labels:  meter
GaugeMeter
An elegant and dynamic animated graphical gauge meter built with jQuery. GaugeMeter.js is highly customizable and includes full-radial, semi-radial & arch dials.
Stars: ✭ 30 (-51.61%)
Mutual labels:  meter
tensorflow-art
Artwork Classifier based on a Tensorflow Deep Neural Network
Stars: ✭ 14 (-77.42%)
Mutual labels:  neural

Tempo-CNN

Tempo-CNN is a simple CNN-based framework for estimating temporal properties of music tracks featuring trained models from several publications [1] [2] [3] [4].

First and foremost, Tempo-CNN is a tempo estimator. To determine the global tempo of an audio file, simply run the script

tempo -i my_audio.wav

To create a local tempo "tempogram", run

tempogram my_audio.wav

For a complete list of options, run either script with the parameter --help.

For programmatic use via the Python API, please see here.

Installation

In a clean Python 3.6 or 3.7 environment, simply run:

pip install tempocnn

If you rather want to install from source, clone this repo and run setup.py install using Python 3.6 or 3.7:

git clone https://github.com/hendriks73/tempo-cnn.git
cd tempo-cnn
python setup.py install

Models and Formats

You may specify other models and output formats (MIREX, JAMS) via command line parameters.

E.g. to create JAMS as output format and the model originally used in the ISMIR 2018 paper [1], please run

tempo -m ismir2018 --jams -i my_audio.wav

For MIREX-style output, add the --mirex parameter.

DeepTemp Models

To use one of the DeepTemp models from [3] (see also repo directional_cnns), run

tempo -m deeptemp --jams -i my_audio.wav

or,

tempo -m deeptemp_k24 --jams -i my_audio.wav

if you want to use a higher capacity model (some k-values are supported). deepsquare and shallowtemp models may also be used.

Note that some models may be downloaded (and cached) at execution time.

Mazurka Models

To use DT-Maz models from [4], run

tempo -m mazurka -i my_audio.wav

This defaults to the model named dt_maz_v_fold0. You may choose another fold [0-4] or another split [v|m]. So to use fold 3 from the M-split, use

tempo -m dt_maz_m_fold3 -i my_audio.wav

Note that Mazurka models may be used to estimate a global tempo, but were actually trained to create tempograms for Chopin Mazurkas [4].

While it's cumbersome to list the split definitions for the Version folds, the Mazurka folds are easily defined:

  • fold0 was tested on Chopin_Op068No3 and validated on Chopin_Op017No4
  • fold1 was tested on Chopin_Op017No4 and validated on Chopin_Op024No2
  • fold2 was tested on Chopin_Op024No2 and validated on Chopin_Op030No2
  • fold3 was tested on Chopin_Op030No2 and validated on Chopin_Op063No3
  • fold4 was tested on Chopin_Op063No3 and validated on Chopin_Op068No3

The networks were trained on recordings of the three remaining Mazurkas. In essence this means, do not estimate the local tempo for Chopin_Op024No2 using dt_maz_m_fold0, because Chopin_Op024No2 was used in training.

Batch Processing

For batch processing, you may want to run tempo like this:

find /your_audio_dir/ -name '*.wav' -print0 | xargs -0 tempo -d /output_dir/ -i

This will recursively search for all .wav files in /your_audio_dir/, analyze then and write the results to individual files in /output_dir/. Because the model is only loaded once, this method of processing is much faster than individual program starts.

Interpolation

To increase accuracy for greater than integer-precision, you may want to enable quadratic interpolation. You can do so by setting the --interpolate flag. Obviously, this only makes sense for tracks with a very stable tempo:

tempo -m ismir2018 --interpolate -i my_audio.wav

Tempogram

Instead of estimating a global tempo, Tempo-CNN can also estimate local tempi in the form of a tempogram. This can be useful for identifying tempo drift.

To create such a tempogram, run

tempogram -p my_audio.wav

As output, tempogram will create a .png file. Additional options to select different models and output formats are available.

You may use the --csv option to export local tempo estimates in a parseable format and the --hop-length option to change temporal resolution. The parameters --sharpen and --norm-frame let you post-process the image.

Greek Folk

Tempo-CNN provides experimental support for temporal property estimation of Greek folk music [2]. The corresponding models are named fma2018 (for tempo) and fma2018-meter (for meter). To estimate the meter's numerator, run

meter -m fma2018-meter -i my_audio.wav

Programmatic Usage

After installation, you may use the package programmatically.

Example for global tempo estimation:

from tempocnn.classifier import TempoClassifier
from tempocnn.feature import read_features

model_name = 'cnn'
input_file = 'some_audio_file.mp3'

# initialize the model (may be re-used for multiple files)
classifier = TempoClassifier(model_name)

# read the file's features
features = read_features(input_file)

# estimate the global tempo
tempo = classifier.estimate_tempo(features, interpolate=False)
print(f"Estimated global tempo: {tempo}")

Example for local tempo estimation:

from tempocnn.classifier import TempoClassifier
from tempocnn.feature import read_features

model_name = 'cnn'
input_file = 'some_audio_file.mp3'

# initialize the model (may be re-used for multiple files)
classifier = TempoClassifier(model_name)

# read the file's features, specify hop_length for temporal resolution
features = read_features(input_file, frames=256, hop_length=32)

# estimate local tempi, this returns tempo classes, i.e., a distribution
local_tempo_classes = classifier.estimate(features)

# find argmax per frame and convert class index to BPM value
max_predictions = np.argmax(local_tempo_classes, axis=1)
local_tempi = classifier.to_bpm(max_predictions)
print(f"Estimated local tempo classes: {local_tempi}")

License

Source code and models can be licensed under the GNU AFFERO GENERAL PUBLIC LICENSE v3. For details, please see the LICENSE file.

Citation

If you use Tempo-CNN in your work, please consider citing it.

Original publication:

@inproceedings{SchreiberM18_TempoCNN_ISMIR,
   Title = {A Single-Step Approach to Musical Tempo Estimation Using a Convolutional Neural Network},
   Author = {Schreiber, Hendrik and M{\"u}ller Meinard},
   Booktitle = {Proceedings of the 19th International Society for Music Information Retrieval Conference ({ISMIR})},
   Pages = {98--105},
   Month = {9},
   Year = {2018},
   Address = {Paris, France},
   doi = {10.5281/zenodo.1492353},
   url = {https://doi.org/10.5281/zenodo.1492353}
}

ShallowTemp, DeepTemp, and DeepSquare models:

@inproceedings{SchreiberM19_CNNKeyTempo_SMC,
   Title = {Musical Tempo and Key Estimation using Convolutional Neural Networks with Directional Filters},
   Author = {Hendrik Schreiber and Meinard M{\"u}ller},
   Booktitle = {Proceedings of the Sound and Music Computing Conference ({SMC})},
   Pages = {47--54},
   Year = {2019},
   Address = {M{\'a}laga, Spain}
}

Mazurka models:

@inproceedings{SchreiberZM20_LocalTempo_ISMIR,
   Title = {Modeling and Estimating Local Tempo: A Case Study on Chopin’s Mazurkas},
   Author = {Hendrik Schreiber and Frank Zalkow and Meinard M{\"u}ller},
   Booktitle = {Proceedings of the 21th International Society for Music Information Retrieval Conference ({ISMIR})},
   Pages = {773--779},
   Year = {2020},
   Address = {Montreal, QC, Canada}
}

References

[1](1, 2) Hendrik Schreiber, Meinard Müller, A Single-Step Approach to Musical Tempo Estimation Using a Convolutional Neural Network, Proceedings of the 19th International Society for Music Information Retrieval Conference (ISMIR), Paris, France, Sept. 2018.
[2](1, 2) Hendrik Schreiber, Technical Report: Tempo and Meter Estimation for Greek Folk Music Using Convolutional Neural Networks and Transfer Learning, 8th International Workshop on Folk Music Analysis (FMA), Thessaloniki, Greece, June 2018.
[3](1, 2) Hendrik Schreiber, Meinard Müller, Musical Tempo and Key Estimation using Convolutional Neural Networks with Directional Filters, Proceedings of the Sound and Music Computing Conference (SMC), Málaga, Spain, 2019.
[4](1, 2, 3) Hendrik Schreiber, Frank Zalkow, Meinard Müller, Modeling and Estimating Local Tempo: A Case Study on Chopin’s Mazurkas, Proceedings of the 21st International Society for Music Information Retrieval Conference (ISMIR), Montréal, QC, Canada, Oct. 2020.
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].