[pulseaudio-discuss] audio source -> pa -> oggenc

Colin Guthrie gmane at colin.guthr.ie
Sun Sep 18 01:38:02 PDT 2011


'Twas brillig, and Richard Henwood at 17/09/11 17:06 did gyre and gimble:
> Hi All,
> 
> I've been playing at this for a while, and I would appreciate your
> help to get this working.
> 
> I have a signal generator: 
> http://introcs.cs.princeton.edu/java/stdlib/StdAudio.java
> 
> What I want to do is run StdAudio and make the output available in
> real-time via an ogg stream (targeted at the internet) for the
> duration of the run.
> 
> so, I'm doing the following:
> 
> # pactl load-module module-pipe-sink file=/tmp/drainpipe.out # pacmd
> set-default-sink fifo_output
> 
> PROBLEM 1: when I do 'java StdAudio', I can hear the output from my
> sound-card and nothing comes out of /tmp/drainpipe.out
> 
> If I switch with the sound preferences in Gnome, the signal appears
> to head out on /tmp/drainpipe.out. If I hook up 'oggenc' on this I
> get something resembling what I would expect.

I'm not really sure if this is a problem then?

Add in a new sink does pretty much noting until you set some (or all)
apps to use it, so using the Gnome sound prefs is what you're expected
to do. Is this really problem 1?

> PROBLEM 2: the whole task ('java StdAudio' and 'oggenc') is over in a
> second or two. The duration of the 'sound' from StdAudio is ~10
> seconds and what I'm aiming for is to drain audio from 'java
> StdAudio' at real-time, not as 'fast as possible.'
> 
> If you can overlook my imprecise use of terms (drain, signal etc) I
> would really appreciate help with this :)

Yeah the pipe sink is a bit of a hack/debug tool really, and in fact
many distros don't ship it.


What I'd suggest is the following solution with a couple variants
depending on how you want to use things.


The main question is: Do you want to hear the sounds as well as
converting them to ogg?

If you DO NOT want to hear the sounds, then you will do the following:

1. pactl load-module module-null-sink sink_name=null
2. Start "java StdAudio"
3. Set the null sink to be default in the gnome GUI (or use pavucontrol
to move only the java StdAudio stream to that device, letting all other
sonds still use the build in h/w)
4. Use the following gst pipeline: gst-launch-0.10 pulsesrc
device=null.monitor ! audioconvert  ! vorbisenc ! oggmux ! filesink
uri=file:///path/to/file.ogg

(I'm not 100% sure of the final filesink stage, but I know for a fact
there will be something you can use to dump it to disk!)



If you DO want to hear the sounds, then you don't use the null sink
module, you jut record straight from your h/w monitor.


1. pacmd list-sinks (take note of the name of your h/w sink Mine is
called "alsa_output.pci_8086_27d8_alsa_playback_0".
2. Use the following gst pipeline: gst-launch-0.10 pulsesrc
device=alsa_output.pci_8086_27d8_alsa_playback_0.monitor ! audioconvert
 ! vorbisenc ! oggmux ! filesink uri=file:///path/to/file.ogg



Note the fact that I append ".monitor" to the end of the sink name in
the pipeline. This is because each sink has a corresponding "monitor"
source. It is this source you're recording from.



Also note that if you are wanting to make this available to others, then
using the Shoutcast system is a pretty easy way to do this. You can push
straight to shoutcast via GST:

gst-launch-0.10 pulsesrc
device=alsa_output.pci_8086_27d8_alsa_playback_0.monitor ! audioconvert
 ! vorbisenc ! oggmux ! shout2send ip=SOMEIP port=8000 password=hackme
mount=stream.ogg


HTHs

Col











-- 

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited [http://www.tribalogic.net/]
Open Source:
  Mageia Contributor [http://www.mageia.org/]
  PulseAudio Hacker [http://www.pulseaudio.org/]
  Trac Hacker [http://trac.edgewall.org/]



More information about the pulseaudio-discuss mailing list