{"id":13564319,"url":"https://github.com/aiXander/Realtime_PyAudio_FFT","last_synced_at":"2025-04-03T21:30:43.990Z","repository":{"id":37492109,"uuid":"263412964","full_name":"aiXander/Realtime_PyAudio_FFT","owner":"aiXander","description":"Realtime audio analysis in Python, using PyAudio and Numpy to extract and visualize FFT features from streaming audio.","archived":false,"fork":false,"pushed_at":"2024-04-30T09:48:16.000Z","size":6428,"stargazers_count":965,"open_issues_count":15,"forks_count":186,"subscribers_count":30,"default_branch":"master","last_synced_at":"2024-11-04T17:47:25.135Z","etag":null,"topics":["audio-visualizer","fft","pyaudio","realtime-audio","spectral-analysis"],"latest_commit_sha":null,"homepage":"","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/aiXander.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}},"created_at":"2020-05-12T18:03:28.000Z","updated_at":"2024-11-01T14:18:21.000Z","dependencies_parsed_at":"2024-08-01T13:20:18.835Z","dependency_job_id":"a0547d3f-8429-42bb-b596-9061266b8d15","html_url":"https://github.com/aiXander/Realtime_PyAudio_FFT","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/aiXander%2FRealtime_PyAudio_FFT","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aiXander%2FRealtime_PyAudio_FFT/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aiXander%2FRealtime_PyAudio_FFT/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aiXander%2FRealtime_PyAudio_FFT/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aiXander","download_url":"https://codeload.github.com/aiXander/Realtime_PyAudio_FFT/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247082916,"owners_count":20880742,"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":["audio-visualizer","fft","pyaudio","realtime-audio","spectral-analysis"],"created_at":"2024-08-01T13:01:29.627Z","updated_at":"2025-04-03T21:30:38.981Z","avatar_url":"https://github.com/aiXander.png","language":"Python","funding_links":[],"categories":["Analysis and Visualization","Python","Packages"],"sub_categories":["CLI Tools"],"readme":"# Realtime_PyAudio_FFT\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"./assets/teaser.gif\"\u003e\n\u003c/p\u003e\n\n### A simple package to do realtime audio analysis in native Python, using PyAudio and Numpy to extract and visualize FFT features from a live audio stream.\n\n[**Demo Video**](https://youtu.be/FnP2bkzU4oo)\n\n**The basic pipeline:**\n* Starts a stream_reader that pulls live audio data from any source using PyAudio (soundcard, microphone, ...)\n* Reads data from this stream many times per second (eg 1000 updates per second) and stores that data in a fifo buffer\n* When triggered by `.get_audio_features()`, the stream_analyzer, applies a Fast-Fourier-Transform to the most recent audio window in the buffer\n* When `visualize` is enabled, the visualizer displays these FFT features in realtime using a PyGame GUI (I made two display modes: 2D and 3D)\n\n**Requirements:**\n\n`pip install -r requirements.txt`\n\nYou also might have to:\n\n`sudo apt install libasound-dev portaudio19-dev libportaudio2 libportaudiocpp0` (on Ubuntu)\nor \n\n`brew install portaudio` (on Mac)\n\n* Other platforms like Mac/Windows should work if PyGame can find your display and Python finds your audio card (these can be tricky with [WSL](https://research.wmz.ninja/articles/2017/11/setting-up-wsl-with-graphics-and-audio.html))\n\nAlternatively to pyaudio, you can try [sounddevice](https://python-sounddevice.readthedocs.io/en/0.3.15/installation.html) which sometimes is more compatible with Windows/Mac\n* just run `pip install sounddevice`\n* The code to switch between the two sound interfaces is in the `__init__` function of the Stream_Analyzer class\n\n**Usage:**\n\njust run `python run_FFT_analyzer.py` and play a sound on your machine!\n* I have personally learned **A LOT** about sound by watching [this realtime visualization](https://www.youtube.com/watch?v=FnP2bkzU4oo) while listening to music\n* You can run the stream_analyzer in headless mode and use the FFT features in any Python Application that requires live musical features\n\n![Teaser image](./assets/usage.png)\n\n**ToDo:**\n* Implement realtime beat detection / melody extraction on top of FFT features (eg using Harmonic/Percussive decomposition)\n* The pygame.transform operations sometimes cause weird visual artifacts (boxes) for some resolution settings --\u003e fix??\n* Remove the matplotlib dependency since it's only needed for the colormap of the vis..\n* Slow bars decay speed currently depends on how often `.get_audio_features()` is called --\u003e fix\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FaiXander%2FRealtime_PyAudio_FFT","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FaiXander%2FRealtime_PyAudio_FFT","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FaiXander%2FRealtime_PyAudio_FFT/lists"}