Skip to content
Fully-featured web application for use on a server taking in audio input and providing analytics.
Ruby CSS JavaScript CoffeeScript
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
app
bin
config
db
lib
public
sandbox
test
vendor/assets
.DS_Store
.gitignore
Gemfile
Gemfile.lock
LICENSE
README.md
README.rdoc
Rakefile
blah.txt
config.ru
fft.rb
frequencies.stuff
message.html
ping.yml
pingpong.rb
pong_test.wav
pong_test_hit.wav
rectest.wav
setup_db.rb
test1.wav
tweets.yml

README.md

rails-sound-spy

Fully-featured web application for use on a server taking in audio input and providing analytics. We have this running on a raspberry (s)pi, running raspian, hooked up to a mic on our ping pong table in the break room. YMMV on the amount of customization required here.

Getting Started

Prerequisites

You'll need a few things before you can get going with this.

Required

Some server (We used a Raspberry Pi with Raspian installed)

A microphone and USB sound card (Raspberry Pis don't have an onboard one)

A ping pong table

Ruby on Rails

FFTW3

$ sudo aptitude install fftw3-dev

A clone of this repo (you should probably fork it so you can easily make changes. Feel free to submit your changes back to us!)

Optional

nginx with passenger

Allows for web hosting at port 80. Point the config to where you have stored this repo at.

Things you'll probably want to modify

  • The acrecord command in pingpong.rb
    • Your server may be able to handle higher recording frequencies
  • The default settings in fft.rb
    • I'll eventually get around to making this more portable. In the mean time, modify!
  • Where pingpong.rb stores logs and writes out.wav

How to run it

$ cd /path/to/rails_sound_spy
$ bundle install
$ RAILS_ENV=production bundle exec rake db:migrate
$ ./pingpong.rb

We've turned pingpong.rb into a daemon that runs on startup. To do that, you'll need the daemons gem.

$ gem install daemons

For nginx, you need to precompile the css:

$ bundle exec rake assets:precompile

You'll also need to start nginx or restart it each time you do this.

If you aren't using nginx (or a similar service), and are instead hosting on port 3000, you may need to modify pingpong.rb to write to the development database, and use

$ rake db:migrate

instead of

$ RAILS_ENV=production bundle exec rake db:migrate
You can’t perform that action at this time.