MrJoy / audio_playground

Place for me to play with FFTs and CoreAudio. Mostly just a poorly implemented band-pass filter.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Audio Playground

Playground for me to play with FFTs and CoreAudio.

This code was all written between 9pm and 2am while preparing for my wedding, so... my apologies.

Installation

This code is tied to CoreAudio and thus will only run on OS X!

After cloning this repo, run:

brew install fftw
bundle install

Usage

To run the crude band-pass filter in interactive mode where you can tweak the parameters and hear the output:

# Plug in headphones!
# Turn volume *down* until you're running the processor, then turn it up to taste!

bin/sm-discover-audio
# Replace '39' below with the ID listed for 'Built-in Microphone' from above:
bin/sm-audio-processor --input-device=39 --map=0,1 --window=8192 --span=4 --mode=interactive

# Non-interactive, against a pure sine-wave:
bin/sm-audio-processor --input-file="test/fixtures/Sin125Hz@0dB24bit44kHzM.caf" --window=8192 --span=4 --map=0,1

The audio will lag considerably due to the size of the sliding window / span parameters. As my math is... not close to correct yet, reducing these parameters reduces the quality of the filtering considerably.

Testing

bin/test.sh

This will run some simple regression tests to ensure that the filter behavior hasn't changed, using a variety of pure sine-wave recordings. To see if the behavior has changed, do git status to see if any of the files in test/results have been changed.

About

Place for me to play with FFTs and CoreAudio. Mostly just a poorly implemented band-pass filter.

License:MIT License


Languages

Language:Ruby 96.7%Language:Shell 2.5%Language:R 0.8%