Created
May 3, 2012 01:23
-
-
Save trisweb/2582403 to your computer and use it in GitHub Desktop.
Script to run an esound stream from soundflower to a pulseaudio server
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# Requirements: | |
# - A PulseAudio server running at the host in TO below. | |
# - SoundFlower installed | |
# - ESound installed (on mac, brew install esound) | |
# Select SoundFlower (2ch) as both Input AND Output devices, then run "streamit start" | |
# otherwise you don't have to worry about anything; it's a daemon, will run in the background, | |
# once you're finished just kill esd or run "streamit stop" | |
TO = "sprout.socialsci.com" | |
def start | |
stop() | |
puts "Starting esd streaming to #{TO}..." | |
`esd -tcp -bind ::1 &` | |
`sleep 3` | |
puts "Starting playback..." | |
proc = fork do | |
exec "(esdrec -s localhost | esdcat -s #{TO}) &" | |
sleep(2) | |
exit(0) | |
end | |
Process.detach(proc) | |
end | |
def stop | |
`killall esd 2>&1 /dev/null` | |
`killall esdrec 2>&1 /dev/null` | |
`killall esdcat 2>&1 /dev/null` | |
puts "Killed all open streams..." | |
end | |
if ARGV.include? "start" | |
start() | |
elsif ARGV.include? "stop" | |
stop() | |
else | |
puts "Usage:\n" | |
puts " Start streaming: streamit start" | |
puts " Stop streaming: streamit stop" | |
puts "Make sure you have both input/output set to Soundflower (2Ch) first!" | |
end | |
exit(0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment