CREPE notes
===========
<!-- .. image:: https://img.shields.io/pypi/v/crepe_notes.svg -->
<!-- :target: https://pypi.python.org/pypi/crepe_notes -->
<!-- .. image:: https://img.shields.io/travis/xavriley/crepe_notes.svg -->
<!-- :target: https://travis-ci.com/xavriley/crepe_notes -->
<!-- .. image:: https://readthedocs.org/projects/crepe-notes/badge/?version=latest -->
<!-- :target: https://crepe-notes.readthedocs.io/en/latest/?version=latest -->
<!-- :alt: Documentation Status -->
Post-processing for CREPE to turn f0 pitch estimates into discrete notes (MIDI)
https://github.com/xavriley/crepe_notes/assets/369527/4cc895f5-9bfe-47af-809d-0152933dc4c9
[Demo video for pypi users also available here](https://www.youtube.com/watch?v=vFvbedBgLKg)
Features
--------
* outputs midi notes for monophonic audio
* include MIDI velocity information
* includes options to filter notes that are too quiet or too short
Installation
------------
```
pip install tensorflow # if you haven't already
pip install crepe-notes
```
> **Warning**
> Python 3.10 and above will fail to run, due to [this long running issue](https://github.com/CPJKU/madmom/issues/509) with madmom.
>
> As a workaround, please run `!pip install -e git+https://github.com/CPJKU/madmom#egg=madmom` after installation
Basic Usage
-----------
```
crepe_notes [path_to_original_audio]
```
A '.mid' file will be created in the location of the audio file with the name `[audio_file_stem].transcription.mid`.
For additional options check out `crepe_notes --help`.
## Min duration, min velocity and sensitivity
These are the three params you may need to tweak to get optimal results.
* `--min-duration` is specified in seconds (e.g. `0.03` is `30ms`). For fast, virtuosic music this is a reasonable default but for things like vocals and double bass lines a longer min duration (`50ms` or higher) may reduce the number of errors in your transcription.
* `--min-velocity` is expressed as in MIDI e.g. `0 - 127`. The default is `6` which removes any notes with velocities at or below that value, but you may find recordings with a higher noise floor benefit from a higher threshold.
* `--sensitivity` relates to the peak picking threshold used on the combined signal (see paper for details) and defaults to `0.001`. If the source material has an unstable pitch profile which results in a lot of short notes either side of a longer target note, increasing the sensitivity to `0.002` may help.
## Caching data files
If you are running `crepe_notes` over an entire dataset, we recommend using the `--save-analysis-files` flag. This will write the following results:
* crepe to `[audio_file_stem].f0.csv`.
* madmom onset activations to `[audio_file_stem].onsets.npz`
* amplitude envelope calculations to `[audio_file_stem].amp_envelope.npz`
This will speed up run times at the expense of some disk space.
About
-----
This repo is the code to accompany the following paper:
> X. Riley and S. Dixon, “CREPE Notes: A new method for segmenting pitch contours into discrete notes,” in Proceedings of the 20th Sound and Music Computing Conference, Stockholm, Sweden, 2023, pp. 1–5.
In the paper we propose a method of combining two things:
a) the gradient of the pitch contour from CREPE
b) the (inverse) confidence of the pitch estimate from CREPE
This gives us a new signal which is a reliable indicator of note onsets, which we can then use to segment the pitch contour into discrete notes. For more details please see the paper or the demo video above.
Results
-------
How good is it? For the datasets we've tested so far it looks promising.
* FiloSax (24 hrs solo saxophone audio) - 90% F-measure (no offsets)
* ITM GT Flute 99 - (20mins Irish trad flute) - 74% F-measure (no offsets) +7% over Basic Pitch
* FiloBass (4 hrs double bass source separated stems) - 72% F-measure (no offsets) +10% over Basic Pitch
Please open a Github issue if you get results for any other public datasets - we'll try to include them in this repo.
Caveats
-------
CREPE only works for monophonic audio, which means CREPE Notes only works for monophonic audio too. If you need polyphonic transcription, check out [Basic Pitch](https://basicpitch.spotify.com/).
Due to the way the algorithm works, repeated notes at the same pitch are treated as a special case and have to fall back to using a standard onset detector (madmom). The results might vary depending on the type of music you want to transcribe. For example, in a jazz saxophone solo it's relatively uncommon to repeat the same note. In a rock bass line however the opposite is true.
The onset detection library we use ([madmom](https://github.com/CPJKU/madmom)) has a licence which restricts commercial use. This restrictions is conferred onto CREPE Notes as a result - if you have a commercial use case please contact the madmom authors to discuss this.
Roadmap
-------
- [ ] (Distant goal) Add UI to aid with picking thresholds for velocity and note length
- [x] Experiment with edge preserving smoothing on the confidence thresholds to reduce spurious grace notes/glissandi
Credits
-------
This package was created with Cookiecutter_ and the `audreyr/cookiecutter-pypackage`_ project template.
* _Cookiecutter_: https://github.com/audreyr/cookiecutter
* _`audreyr/cookiecutter-pypackage`_: https://github.com/audreyr/cookiecutter-pypackage
History
=======
0.1.0 (2023-07-12)
------------------
* First release on PyPI.
Raw data
{
"_id": null,
"home_page": "https://github.com/xavriley/crepe_notes",
"name": "crepe-notes",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": "",
"keywords": "crepe_notes",
"author": "Xavier Riley",
"author_email": "xavriley@hotmail.com",
"download_url": "https://files.pythonhosted.org/packages/d2/14/5c44bea21e2e19f7a4acc04104d8e1fa9f7a14d24768e667f2a4432e92d5/crepe_notes-0.1.3.tar.gz",
"platform": null,
"description": "CREPE notes\n===========\n\n\n<!-- .. image:: https://img.shields.io/pypi/v/crepe_notes.svg -->\n<!-- :target: https://pypi.python.org/pypi/crepe_notes -->\n\n<!-- .. image:: https://img.shields.io/travis/xavriley/crepe_notes.svg -->\n<!-- :target: https://travis-ci.com/xavriley/crepe_notes -->\n\n<!-- .. image:: https://readthedocs.org/projects/crepe-notes/badge/?version=latest -->\n<!-- :target: https://crepe-notes.readthedocs.io/en/latest/?version=latest -->\n<!-- :alt: Documentation Status -->\n\nPost-processing for CREPE to turn f0 pitch estimates into discrete notes (MIDI)\n\nhttps://github.com/xavriley/crepe_notes/assets/369527/4cc895f5-9bfe-47af-809d-0152933dc4c9\n\n[Demo video for pypi users also available here](https://www.youtube.com/watch?v=vFvbedBgLKg)\n \nFeatures\n--------\n\n* outputs midi notes for monophonic audio\n* include MIDI velocity information\n* includes options to filter notes that are too quiet or too short\n\nInstallation\n------------\n\n```\npip install tensorflow # if you haven't already\npip install crepe-notes\n```\n\n> **Warning**\n> Python 3.10 and above will fail to run, due to [this long running issue](https://github.com/CPJKU/madmom/issues/509) with madmom.\n>\n> As a workaround, please run `!pip install -e git+https://github.com/CPJKU/madmom#egg=madmom` after installation\n\nBasic Usage\n-----------\n\n```\ncrepe_notes [path_to_original_audio]\n```\n\nA '.mid' file will be created in the location of the audio file with the name `[audio_file_stem].transcription.mid`.\n\nFor additional options check out `crepe_notes --help`.\n\n## Min duration, min velocity and sensitivity\n\nThese are the three params you may need to tweak to get optimal results.\n\n* `--min-duration` is specified in seconds (e.g. `0.03` is `30ms`). For fast, virtuosic music this is a reasonable default but for things like vocals and double bass lines a longer min duration (`50ms` or higher) may reduce the number of errors in your transcription.\n\n* `--min-velocity` is expressed as in MIDI e.g. `0 - 127`. The default is `6` which removes any notes with velocities at or below that value, but you may find recordings with a higher noise floor benefit from a higher threshold.\n\n* `--sensitivity` relates to the peak picking threshold used on the combined signal (see paper for details) and defaults to `0.001`. If the source material has an unstable pitch profile which results in a lot of short notes either side of a longer target note, increasing the sensitivity to `0.002` may help. \n\n\n## Caching data files\n\nIf you are running `crepe_notes` over an entire dataset, we recommend using the `--save-analysis-files` flag. This will write the following results:\n\n* crepe to `[audio_file_stem].f0.csv`.\n* madmom onset activations to `[audio_file_stem].onsets.npz`\n* amplitude envelope calculations to `[audio_file_stem].amp_envelope.npz`\n\nThis will speed up run times at the expense of some disk space.\n\nAbout\n-----\n\nThis repo is the code to accompany the following paper:\n\n> X. Riley and S. Dixon, \u201cCREPE Notes: A new method for segmenting pitch contours into discrete notes,\u201d in Proceedings of the 20th Sound and Music Computing Conference, Stockholm, Sweden, 2023, pp. 1\u20135.\n\nIn the paper we propose a method of combining two things:\n\na) the gradient of the pitch contour from CREPE\nb) the (inverse) confidence of the pitch estimate from CREPE\n\nThis gives us a new signal which is a reliable indicator of note onsets, which we can then use to segment the pitch contour into discrete notes. For more details please see the paper or the demo video above.\n\nResults\n-------\n\nHow good is it? For the datasets we've tested so far it looks promising.\n\n* FiloSax (24 hrs solo saxophone audio) - 90% F-measure (no offsets)\n* ITM GT Flute 99 - (20mins Irish trad flute) - 74% F-measure (no offsets) +7% over Basic Pitch\n* FiloBass (4 hrs double bass source separated stems) - 72% F-measure (no offsets) +10% over Basic Pitch\n\nPlease open a Github issue if you get results for any other public datasets - we'll try to include them in this repo.\n\nCaveats\n-------\n\nCREPE only works for monophonic audio, which means CREPE Notes only works for monophonic audio too. If you need polyphonic transcription, check out [Basic Pitch](https://basicpitch.spotify.com/).\n\nDue to the way the algorithm works, repeated notes at the same pitch are treated as a special case and have to fall back to using a standard onset detector (madmom). The results might vary depending on the type of music you want to transcribe. For example, in a jazz saxophone solo it's relatively uncommon to repeat the same note. In a rock bass line however the opposite is true.\n\nThe onset detection library we use ([madmom](https://github.com/CPJKU/madmom)) has a licence which restricts commercial use. This restrictions is conferred onto CREPE Notes as a result - if you have a commercial use case please contact the madmom authors to discuss this.\n\nRoadmap\n-------\n\n- [ ] (Distant goal) Add UI to aid with picking thresholds for velocity and note length\n- [x] Experiment with edge preserving smoothing on the confidence thresholds to reduce spurious grace notes/glissandi\n\nCredits\n-------\n\nThis package was created with Cookiecutter_ and the `audreyr/cookiecutter-pypackage`_ project template.\n\n* _Cookiecutter_: https://github.com/audreyr/cookiecutter\n* _`audreyr/cookiecutter-pypackage`_: https://github.com/audreyr/cookiecutter-pypackage\n\n\nHistory\n=======\n\n0.1.0 (2023-07-12)\n------------------\n\n* First release on PyPI.\n\n\n",
"bugtrack_url": null,
"license": "GNU General Public License v3.0 license",
"summary": "Post-processing for CREPE to turn f0 pitch estimates into discrete notes e.g. MIDI",
"version": "0.1.3",
"project_urls": {
"Homepage": "https://github.com/xavriley/crepe_notes"
},
"split_keywords": [
"crepe_notes"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "3945447a094c5ab685bb1e8adc144934e59e82b4d79b6e6fae43950ac6c65371",
"md5": "08b614210300a44f2df259b2191de661",
"sha256": "0340b45e2c6b510abf55e958e292e39086b2aa03a620463cdd77428ea67b270e"
},
"downloads": -1,
"filename": "crepe_notes-0.1.3-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "08b614210300a44f2df259b2191de661",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": ">=3.6",
"size": 22290,
"upload_time": "2023-08-14T08:18:14",
"upload_time_iso_8601": "2023-08-14T08:18:14.944725Z",
"url": "https://files.pythonhosted.org/packages/39/45/447a094c5ab685bb1e8adc144934e59e82b4d79b6e6fae43950ac6c65371/crepe_notes-0.1.3-py2.py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "d2145c44bea21e2e19f7a4acc04104d8e1fa9f7a14d24768e667f2a4432e92d5",
"md5": "433fc34edd12528e2fd6ecb432a49e04",
"sha256": "6554b2de6b1a9b46caf3f91f2514ee99e133cf7d8ba84cca991a640782b2de2a"
},
"downloads": -1,
"filename": "crepe_notes-0.1.3.tar.gz",
"has_sig": false,
"md5_digest": "433fc34edd12528e2fd6ecb432a49e04",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 29586,
"upload_time": "2023-08-14T08:18:16",
"upload_time_iso_8601": "2023-08-14T08:18:16.301522Z",
"url": "https://files.pythonhosted.org/packages/d2/14/5c44bea21e2e19f7a4acc04104d8e1fa9f7a14d24768e667f2a4432e92d5/crepe_notes-0.1.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-08-14 08:18:16",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "xavriley",
"github_project": "crepe_notes",
"travis_ci": true,
"coveralls": false,
"github_actions": false,
"tox": true,
"lcname": "crepe-notes"
}