[PD] PD -> Mp3

Marc Lavallée odradek at videotron.ca
Thu Jul 5 12:21:37 CEST 2001


Ivan Chabanaud wrote:

> Hi all !
> Does it make sense to generate Mp3
> from PD

Bonjour Yvan.

This is getting interesting. You first asked about streaming PD's
output to RealAudio, now you want to stream to mp3, right? 

Earlier this week, dieb13 wrote:
---
i did a modified version of gg´s sfread~/sfwrite~ , suitable for pipes.
you will find the "externals" pipein~/pipeout~ at 
http://loopool.live.fm/filez/pd/ext13.0.10b.tar.gz
then just do a "mknod /path/out.wav p" and write to this fifo via
pipeout~
best regards
d13b
---

So if it works, this simple command would encode to a mp3 file:
cat /path/out.wav | gogo stdin /path/out.mp3

I use the gogo mp3 encoder because it's the fastest on PCs. Lame is 
also a good encoder, but the syntax would be slightly different.

Now the mp3 streaming trick, based on something I read on Slashdot.
Thanks to Thomas Malt of the NRK radio in Norway.
Tools needed: gogo or lame, a icecast server, and netcat (nc).

Make the /path/out.mp3 file as a fifo pipe:
mkfifo -m 644 /path/out.mp3

Create a file (/path/ice.txt) with settings for a icecast server:
--- 
SOURCE [SERVER SOURCE PASSWORD] /[mountpoint on server] 
x-audiocast-bitrate: [encoding bitrate] 
x-audiocast-name: [The name of the broadcast] 
x-audiocast-genre: [the genre of the broadcast] 
x-audiocast-url: [broadcast URL] 
x-audiocast-mount: /[mountpoint on server] 
x-audiocast-description: Icy protocol in use 
x-audiocast-public: 1 
--- 

Then run these commands from a shell script 
(to make sure the fifo buffer doesn't time out): 
cat /path/out.wav | gogo stdin /path/out.mp3 &
cat /path/ice.txt /path/out.mp3 | nc -w 30 [icecast server] [port] & 

I haven't try all of this, so let me know if it works.

Marc



More information about the Pd-list mailing list