{"id":13520194,"url":"https://github.com/axegon/spectrust","last_synced_at":"2025-04-25T16:31:15.373Z","repository":{"id":57469769,"uuid":"156884606","full_name":"axegon/spectrust","owner":"axegon","description":"Spectrust - blazing fast spectrogram generator for Python in Rust.","archived":false,"fork":false,"pushed_at":"2020-04-20T10:01:37.000Z","size":4521,"stargazers_count":24,"open_issues_count":2,"forks_count":5,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-11-02T03:32:20.490Z","etag":null,"topics":["python3","rust"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/axegon.png","metadata":{"files":{"readme":"README.md","changelog":"HISTORY.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-11-09T15:57:30.000Z","updated_at":"2024-09-19T17:46:26.000Z","dependencies_parsed_at":"2022-09-19T14:00:22.283Z","dependency_job_id":null,"html_url":"https://github.com/axegon/spectrust","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/axegon%2Fspectrust","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/axegon%2Fspectrust/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/axegon%2Fspectrust/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/axegon%2Fspectrust/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/axegon","download_url":"https://codeload.github.com/axegon/spectrust/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224007933,"owners_count":17240294,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["python3","rust"],"created_at":"2024-08-01T05:02:13.744Z","updated_at":"2024-11-10T20:11:20.451Z","avatar_url":"https://github.com/axegon.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"## Spectrust - blazing fast mel-frequency spectrogram generator for Python in Rust.\n\n```\n  ██████  ██▓███  ▓█████  ▄████▄  ▄▄▄█████▓ ██▀███   █    ██   ██████ ▄▄▄█████▓\n▒██    ▒ ▓██░  ██▒▓█   ▀ ▒██▀ ▀█  ▓  ██▒ ▓▒▓██ ▒ ██▒ ██  ▓██▒▒██    ▒ ▓  ██▒ ▓▒\n░ ▓██▄   ▓██░ ██▓▒▒███   ▒▓█    ▄ ▒ ▓██░ ▒░▓██ ░▄█ ▒▓██  ▒██░░ ▓██▄   ▒ ▓██░ ▒░\n  ▒   ██▒▒██▄█▓▒ ▒▒▓█  ▄ ▒▓▓▄ ▄██▒░ ▓██▓ ░ ▒██▀▀█▄  ▓▓█  ░██░  ▒   ██▒░ ▓██▓ ░\n▒██████▒▒▒██▒ ░  ░░▒████▒▒ ▓███▀ ░  ▒██▒ ░ ░██▓ ▒██▒▒▒█████▓ ▒██████▒▒  ▒██▒ ░\n▒ ▒▓▒ ▒ ░▒▓▒░ ░  ░░░ ▒░ ░░ ░▒ ▒  ░  ▒ ░░   ░ ▒▓ ░▒▓░░▒▓▒ ▒ ▒ ▒ ▒▓▒ ▒ ░  ▒ ░░\n░ ░▒  ░ ░░▒ ░      ░ ░  ░  ░  ▒       ░      ░▒ ░ ▒░░░▒░ ░ ░ ░ ░▒  ░ ░    ░\n░  ░  ░  ░░          ░   ░          ░        ░░   ░  ░░░ ░ ░ ░  ░  ░    ░\n      ░              ░  ░░ ░                  ░        ░           ░\n```\n\n![spectrogram](https://raw.githubusercontent.com/axegon/spectrust/master/images/hello_world.jpg)\n\n### Motivation\n\nThis package was originally made as a supplement to a tensorflow application.\nIt's sole goal is to generate audio mel spectrograms from wav files as a JPEG\nin large volume in as little time as possible and getting consistent results\nwith ease. The package is a python API to a lower level implementation\nin Rust with moderate flexibility: The API provides the ability to\nspecify the size of the output, as well as control over the gradient ranges\nfor better results according to your needs.\n### Installation\n\nPackage is now available in PyPI\n\n ```\t\npip3 install spectrust\t\n```\n\nIf you want to compile from source, you will need to have a running Rust nightly installation,\nplease visit [https://www.rust-lang.org/en-US/install.html](https://www.rust-lang.org/en-US/install.html).\n\nOnce you have installed rust run:\n\n```\npip3 install git+https://github.com/axegon/spectrust.git\n```\n\n### Usage\n\nThe API is fairly straightforward:\n\n```python\n\u003e\u003e\u003e import spectrust\n\u003e\u003e\u003e spect = spectrust.Spectrogram(width=800, height=600)\n\u003e\u003e\u003e spect.generate('/home/alex/Downloads/step-5000-wav.wav', '/tmp/hello_world.jpg')\n\u003cspectrust.Result(\n\tinputfile=/home/alex/Downloads/step-5000-wav.wav,\n\toutputfile=/tmp/hello_world.jpg,\n\terror=None\n)\u003e\n```\n\nGenerating the following output:\n\nIn addition you can pass `r`, `g` and `b` arguments to the `Spectrogram` constructor,\nranging from 0 to 255 each to achieve different results that may be more desirable\nin your case. Keep in mind those values **must** be floats:\n\n```python\n\u003e\u003e\u003e import spectrust\n\u003e\u003e\u003e spect = spectrust.Spectrogram(width=800, height=600, r=255., g=255., b=150.)\n\u003e\u003e\u003e spect.generate('/home/alex/Downloads/step-5000-wav.wav', '/tmp/hello_world.jpg')\n\u003cspectrust.Result(\n\tinputfile=/home/alex/Downloads/step-5000-wav.wav,\n\toutputfile=/tmp/hello_world.jpg,\n\terror=None\n)\u003e\n```\n\nIn a similar fashion you can operate on batch wav files recursively:\n\n```python\n\u003e\u003e\u003e import spectrust\n\u003e\u003e\u003e with spectrust.Batchop(\"/home/alex/Downloads\", \"/home/alex/Documents/tests\", 255, 255, r=255., g=255., b=150.) as s:\n...     res = s\n[\u003cspectrust.Result(\n\tinputfile=/home/alex/Downloads/demo.wav,\n\toutputfile=/home/alex/Documents/tests/04ee269d-23a1-4577-a6a3-735ba00ed0f7.jpg,\n\terror=None\n)\u003e, \u003cspectrust.Result(\n\tinputfile=/home/alex/Downloads/demo (1).wav,\n\toutputfile=/home/alex/Documents/tests/a73cab0c-754a-4256-af35-be713eb3d5d6.jpg,\n\terror=None\n)\u003e, \u003cspectrust.Result(\n\tinputfile=/home/alex/Downloads/step-5000-wav.wav,\n\toutputfile=/home/alex/Documents/tests/a0b087be-18d9-4dce-8485-f61b75ffec8c.jpg,\n\terror=None\n)\u003e]\n```\n\nThe `outputfile` is automatically generated using a UUID4 but it can be changed according to your needs by\nextending the `Batchop` class and overriding the generate_output_path method.\n\n### Contribution\n\nPull requests are welcome but please respect PEP-8 and Numpy docstrings.\n\n### Future development\n\n* Proper documentation.\n* Add support for more audio formats and output image formats.\n* Tests.\n* CI.\n* Benchmarking\n* Add spectrograms other then mel perhaps...?\n\nContributions are very much welcome. The entire package was built from scratch in\na rush in a matter of several hours saying there are things to be improved\nwould be an understatement. Please check the contribution guide.\n\n\n### Support\n\nAs of now the library only supports Linux but it should (in theory)\nbe working on other UNIX-based systems as well. Running well on\nOpenSuSe 15.0 as well as Debian 9.0. It will probably not work\non Windows as it is, but may potentially work with [this](https://docs.microsoft.com/en-us/windows/wsl/about).\n*It's a wild guess to say the least...*\n\nOnly Python 3.4 and above will be supported. There are no guarantees\nthe code will run on earlier versions and wheels will not be provided.\n\n### Performace\n\nNot a whole lot of benchmarking has been done for a number of reasons,\ntime(or the absence of it) being a major contributor.\nTo give a general idea, 100 spectrograms were generated in ~11 seconds\non a Dual core Intel® Core™ i7-5500U and SanDisk X300s on xfs\nfilesystem (OpenSuSe). Each of the files was roughly 15 seconds long\nand ~300kb.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faxegon%2Fspectrust","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faxegon%2Fspectrust","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faxegon%2Fspectrust/lists"}