Giter VIP home page Giter VIP logo

realtime_pyaudio_fft's Introduction

Realtime_PyAudio_FFT

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.

The basic pipeline:

  • Starts a stream_reader that pulls live audio data from any source using PyAudio (soundcard, microphone, ...)
  • Reads data from this stream many times per second (eg 1000 updates per second) and stores that data in a fifo buffer
  • When triggered by .get_audio_features(), the stream_analyzer, applies a Fast-Fourier-Transform to the most recent audio window in the buffer
  • When visualize is enabled, the visualizer displays these FFT features in realtime using a PyGame GUI (I made two display modes: 2D and 3D)

Usage:

  • I have personally learned A LOT about sound by watching this realtime visualization while listening to music
  • You can run the stream_analyzer in headless mode and use the FFT features in any Python Application that requires live musical features

Teaser image

Requirements:

I developped this code on my local machine, it has not been properly tested on other setups.. If something doesn't work, please first try to fix it yourself and post an issue/solution when appropriate!

  • Tested on Ubuntu 18.04
  • Other platforms like Mac/Windows should work if PyGame can find your display (can be tricky with WSL)

Tested with:

  • Python 3.6.3
  • pygame --> Version: 1.9.6
  • pyaudio --> Version: 0.2.11
  • scipy --> Version: 1.4.1

ToDo:

  • Implement realtime beat detection / melody extraction on top of FFT features (eg using Harmonic/Percussive decomposition)
  • The pygame.transform operations sometimes cause weird visual artifacts (boxes) for some resolution settings --> fix??
  • Remove the matplotlib dependency since it's only needed for the colormap of the vis..
  • Slow bars decay speed currently depends on how often .get_audio_features() is called --> fix

realtime_pyaudio_fft's People

Contributors

aixander avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.