radio

GUIDE TO HUBFS BASED RADIO

Radio with hubfs is very simple. just create a hubfile and make it available like you would any other file with exportfs. In more detail, you might create a hub such as

hubfs -b 17000 -q 7777777 -s radio -m /n/muzak

Taking advantage of the rate limting added to hubfs. Then touch a file to send the music to with chmod 666. Then, share the file with the world:

myip=9.mydom.su gridlisten1 -d 'MYRADIO' -m /n/muzak -v tcp!*!8008 /bin/exportfs -S /srv/radio

With your own information. Now, anyone can get and play the radio file just like it was a local audio file, a regular local audio file that occasionaly skips the boring songs and sometimes has long silent periods. Of course, depending on how you limited the hubfiles, writing too much or too little at once might make it sound wrong. Writing too much would probably make it sound wrong no matter how you did it since 9p isnt good with large files over slow connections. Heres one of my own functions for using the radio:

fn radioplay{
	sed 's/.*mp3''$/echo &>>\/n\/UFO\/playing\naudio\/mp3dec < & | dd -conv swab|audio\/mp3enc -V 7 >> \/n\/UFO\/radio/g' |\
	sed 's/.*flac''$/echo &>>\/n\/UFO\/playing\naudio\/flacdec < & | dd -conv swab|audio\/mp3enc -V 7 >> \/n\/UFO\/radio/g' |\
	sed 's/.*ogg''$/echo &>>\/n\/UFO\/playing\naudio\/oggdec < & | dd -conv swab|audio\/mp3enc -V 7 >> \/n\/UFO\/radio/g' 
}

It translates 'foo.ext' into

echo foo.ext >>/n/UFO/playing
audio/extdec < foo.mp3 | dd -conv swab|audio/mp3enc -V 7 >> /n/UFO/radio'j

Perhaps in a bit of a stupid way. Either way, the important part to note is the converstion of everything to mp3 with the flag -V 7. This sets the average bitrate. There are still some problems with this- you dont know the exact bitrate at any given time, and hubfs limits exactly, and you still end up with skipping now and then. You COULD set an exact bitrate, but thatd mean more bytes for less quality. Still, it's important to limit the rate for hubfs. See, perhaps by trying the same pipeline with a tput inserted somewhere, how much will go through at a particular quality setting compared to how much was set with -b for hubfs, and that its not too much larger or smaller. Obviously its also important everything be the same type of stream so you can actually play the file without switching players and getting a minute of avant garde noise from using flacdec on ogg data before the actual HarshNoiseWall.ogg starts playing.


Last modified Thu May 3 06:47:28 GMT 2018 [ Top | Edit | History | Changelog | Create a new page ] About the server | Powered by Plan 9