awesomebytes / play_games_with_audio

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Play Super Mario (web game) with your voice

By playing with the volume of the current microphone registered audio/noise you can command Super Mario.

Funny video of my housemate playing (click for the video): youtube video

Install

You'll need:

  • PyQt4 sudo apt-get install python-qt4
  • pyqtgraph sudo pip install pyqtgraph
  • numpy sudo apt-get install python-numpy
  • pykeyboard sudo pip install PyUserInput
  • pyaudio sudo pip install pyaudio. Note: You may get rid of this dependence modifying the code using the hacky approach found in this gist. Do it at your own risk.

And clone this repo: git clone https://github.com/awesomebytes/play_games_with_audio

Run

python play_mario.py

Open a browser, I used chrome, with the HTML5 Super Mario game. Focus this window, you may need to click in the game...

And now when the sound registered by your microphone is louder than 12.5% D key will be pressed (so Mario will start moving right) when the noise becomes lower the key will be released. When the audio is louder than 25.0% W will be pressed (Mario will jump as high as relative to the maximum volume found at that moment). So if you make a louder noise it will jump higher!

You can adjust these parameters as you wish in the code.

Thanks to

Based on qt audio monitor.

PROJECT PAGE: http://www.swharden.com/wp/2016-07-31-real-time-audio-monitor-with-pyqt/

demo

About

License:MIT License


Languages

Language:Python 100.0%