Skip to content

Instantly share code, notes, and snippets.

@ebot
Created March 30, 2013 21:06
Show Gist options
  • Save ebot/5278333 to your computer and use it in GitHub Desktop.
Save ebot/5278333 to your computer and use it in GitHub Desktop.
Sets the volume to 100% and plays random mp3s to test the raspberry pi audio.
var sys = require('sys');
function playRandomSound() {
var num = Math.floor(Math.random()*13);
if (num == 0) {
num = "09";
}
else if (num < 10) {
num = '0' + num;
}
console.log("Random Nanny Quote " + num);
sys.exec("mpg321 " + __dirname + "/drivers/soundboard/mp3s/random/" + num + ".mp3");
}
sys.exec( "amixer cset iface=MIXER,name=\"PCM Playback Volume\" 100%"); // Set volume to 100%
setInterval(playRandomSound, 8000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment