{"id":42466181,"url":"https://github.com/bleugreen/deeprhythm","last_synced_at":"2026-01-28T09:39:30.191Z","repository":{"id":222224603,"uuid":"754023690","full_name":"bleugreen/deeprhythm","owner":"bleugreen","description":"fast, precise tempo prediction in python","archived":false,"fork":false,"pushed_at":"2026-01-13T11:48:04.000Z","size":25018,"stargazers_count":61,"open_issues_count":1,"forks_count":14,"subscribers_count":5,"default_branch":"main","last_synced_at":"2026-01-13T14:37:28.949Z","etag":null,"topics":["audio","cnn-classification","python","pytorch","signal-processing","tempo","tempo-estimation"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/deeprhythm/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bleugreen.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-02-07T08:50:51.000Z","updated_at":"2026-01-13T11:48:00.000Z","dependencies_parsed_at":null,"dependency_job_id":"201456c8-36a7-47ee-911c-94642bc63748","html_url":"https://github.com/bleugreen/deeprhythm","commit_stats":null,"previous_names":["mitchell57/deeprhythm"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/bleugreen/deeprhythm","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bleugreen%2Fdeeprhythm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bleugreen%2Fdeeprhythm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bleugreen%2Fdeeprhythm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bleugreen%2Fdeeprhythm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bleugreen","download_url":"https://codeload.github.com/bleugreen/deeprhythm/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bleugreen%2Fdeeprhythm/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28843988,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-28T07:39:25.367Z","status":"ssl_error","status_checked_at":"2026-01-28T07:39:24.487Z","response_time":57,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["audio","cnn-classification","python","pytorch","signal-processing","tempo","tempo-estimation"],"created_at":"2026-01-28T09:39:29.554Z","updated_at":"2026-01-28T09:39:30.176Z","avatar_url":"https://github.com/bleugreen.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DeepRhythm: High-Speed Tempo Prediction\n\nDeepRhythm is a convolutional neural network designed for rapid, precise tempo prediction for modern music. It runs on anything that supports Pytorch (I've tested Ubunbu, MacOS, Windows, Raspbian).\n\nAudio is batch-processed using a vectorized Harmonic Constant-Q Modulation (HCQM), drastically reducing computation time by avoiding the usual bottlenecks encountered in feature extraction.\n\n[more details here](https://bleu.green/deeprhythm)\n\n## Classification Process\n\n1. Split input audio into 8 second clips `[len_batch, len_audio]`\n2. Compute the HCQM of each clip\n   1. Compute STFT `[len_batch, stft_bands, len_audio/hop]`\n   2. Sum STFT bins into 8 log-spaced bands using filter matrix `[len_batch, 8, len_audio/hop]`\n   3. Flatten bands for parallel CQT processing `[len_batch*8, len_audio/hop]`\n   4. For each of the six harmonics, compute the CQT `[6, len_batch*8, num_cqt_bins]`\n   5. Reshape `[len_batch, num_cqt_bins, 8, 6]`\n3. Feed HCQM through CNN `[len_batch, num_classes (256)]`\n4. Softmax the outputs to get probabilities\n5. Choose the class with the highest probability and convert to bpm (bpms = `[len_batch]`)\n\n## Benchmarks\n\n| Method                  | Acc1 (%)  | Acc2 (%)  | Avg. Time (s) | Total Time (s) |\n| ----------------------- | --------- | --------- | ------------- | -------------- |\n| DeepRhythm (cuda)       | **95.91** | 96.54     | **0.021**     | 20.11          |\n| DeepRhythm (cpu)        | **95.91** | 96.54     | 0.12          | 115.02         |\n| TempoCNN (cnn)          | 84.78     | **97.69** | 1.21          | 1150.43        |\n| TempoCNN (fcn)          | 83.53     | 96.54     | 1.19          | 1131.51        |\n| Essentia (multifeature) | 87.93     | 97.48     | 2.72          | 2595.64        |\n| Essentia (percival)     | 85.83     | 95.07     | 1.35          | 1289.62        |\n| Essentia (degara)       | 86.46     | 97.17     | 1.38          | 1310.69        |\n| Librosa                 | 66.84     | 75.13     | 0.48          | 460.52         |\n\n- Test done on 953 songs, mostly Electronic, Hip Hop, Pop, and Rock\n- Acc1 = Prediction within +/- 2% of actual bpm\n- Acc2 = Prediction within +/- 2% of actual bpm or a multiple (e.g. 120 ~= 60)\n- Timed from filepath in to bpm out (audio loading, feature extraction, model inference)\n- I could only get TempoCNN to run on cpu (it requires Cuda 10)\n\n## Installation\n\nTo install DeepRhythm, ensure you have Python and pip installed. Then run:\n\n```bash\npip install deeprhythm\n```\n\n## Usage\n\n### CLI Inference\n\n#### Single\n\n```bash\npython -m deeprhythm.infer /path/to/song.wav -cq\n\u003e ([bpm], [confidence])\n```\n\nFlags:\n\n- `-c`, `--conf` - include confidence scores\n- `-d`, `--device [cuda/cpu/mps]` - specify model device\n- `-q`, `--quiet` - prints only bpm/conf\n\n#### Batch\n\nTo predict the tempo of all songs in a directory, run\n\n```bash\npython -m deeprhythm.batch_infer /path/to/dir\n```\n\nThis will create in a jsonl file mapping filepath to predicted BPM.\n\nFlags:\n\n- `-o output_path.jsonl` - provide a custom output path (default 'batch_results.jsonl`)\n- `-c`, `--conf` - include confidence scores\n- `-d`, `--device [cuda/cpu/mps]` - specify model device\n- `-q`, `--quiet` - doesn't print status / logs\n\n### Python Inference\n\nTo predict the tempo of a song:\n\n```python\nfrom deeprhythm import DeepRhythmPredictor\n\nmodel = DeepRhythmPredictor()\n\ntempo = model.predict('path/to/song.mp3')\n\n# to include confidence\ntempo, confidence = model.predict('path/to/song.mp3', include_confidence=True)\n\nprint(f\"Predicted Tempo: {tempo} BPM\")\n```\n\nAudio is loaded with librosa, which supports most audio formats. \n\nIf you have already loaded your audio with librosa, for example to carry out pre-processing steps, you can predict the tempo in the following way:\n\n```python\nimport librosa\nfrom deeprhythm import DeepRhythmPredictor\n\nmodel = DeepRhythmPredictor()\n\naudio, sr = librosa.load('path/to/song.mp3')\n\n# ... other steps for processing the audio ...\n\ntempo = model.predict_from_audio(audio, sr)\n\n# to include confidence\ntempo, confidence = model.predict_from_audio(audio, sr, include_confidence=True)\n\nprint(f\"Predicted Tempo: {tempo} BPM\")\n```\n\n## References\n\n[1] Hadrien Foroughmand and Geoffroy Peeters, “Deep-Rhythm for Global Tempo Estimation in Music”, in Proceedings of the 20th International Society for Music Information Retrieval Conference, Delft, The Netherlands, Nov. 2019, pp. 636–643. doi: 10.5281/zenodo.3527890.\n\n[2] K. W. Cheuk, H. Anderson, K. Agres and D. Herremans, \"nnAudio: An on-the-Fly GPU Audio to Spectrogram Conversion Toolbox Using 1D Convolutional Neural Networks,\" in IEEE Access, vol. 8, pp. 161981-162003, 2020, doi: 10.1109/ACCESS.2020.3019084.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbleugreen%2Fdeeprhythm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbleugreen%2Fdeeprhythm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbleugreen%2Fdeeprhythm/lists"}