Re: mpg123 playing to both file and speakers (stdout)

2002-05-16 Thread Mathias Gygax
On Wed, May 15, 2002 at 10:09:33PM -0500, Lance Hoffmeyer wrote:
> > mpg123 file.mpg --cdr /dev/stdout | tee file.cdr | programm-to-handle-cdr 
> > 
> 
> OK, changing things up a bit:
> 
> mpg123 --wav - file.mpg | tee file.wav | wavp /dev/stdin
> 
> appears to record a wav file but it will not play.  In addition,
> not sound comes from the speaker while processing the commands.

you can still start two running processes of mpg123. with '&' you can
but a job into background and start the next (in the sense of shell
scripting)

so, try the following:

mpg123 -q file.mpg & mpg123 --wav - file.mpg | tee file.wav | wavp /dev/stdin

this first play the file and suppress the output so it doesn't fill up
your screen. with '&' the job get's into the background, but is still
running. if a program doesn't support this option, redirect the output
to /dev/null. the rest behind the '&' is as you now.

well this is not exactly what you want. i guess you want one instance of
mpg123 to do two jobs at once, but it should work too. if file.mpg is
opened read-only, you shouldn't have problems with the above solution.

if it works', try to put it into a shell script. if you need a tutorial
about this topic, let me know.


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Re: mpg123 playing to both file and speakers (stdout)

2002-05-15 Thread Lance Hoffmeyer
> 
> mpg123 file.mpg --cdr /dev/stdout | tee file.cdr | programm-to-handle-cdr 
> 
> 


OK, changing things up a bit:

mpg123 --wav - file.mpg | tee file.wav | wavp /dev/stdin


appears to record a wav file but it will not play.  In addition,
not sound comes from the speaker while processing the commands.

Lance


 

-- 

Lance Hoffmeyer
  [EMAIL PROTECTED]

---
  It gives me great pleasure indeed to see the stubbornness of an incorrigible
nonconformist warmly acclaimed.
   -
Albert Einstein


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Re: mpg123 playing to both file and speakers (stdout)

2002-05-15 Thread Mathias Gygax
On Wed, May 15, 2002 at 04:40:01PM -0500, Lance Hoffmeyer wrote:
> Is there a way to have mpg123 play a file and record it to a file at once?
> 
> One can play mpg123 file.mpg or
>   mpg123 file.mpg --cdr file.cdr
> 
> but can I do both at once?

well, doing two functions to the same time ist not un*x like in the
sense of a process. every programm does one job at once. you can
hardcode the opposite, but it's not our way of doing things. daemons are
(well, not the only) execption.

but there's a big "but" if you come across I/O handling:

for e.g., if you have an output to /dev/stdout you can redirect the
output via traditional dup,dup2. this connects the file descriptors to
two or more ouput operations (in this theoretical example)

the program tee(1) is not actually an example of this, but does a
similar thing.

so, you can do the following stuff:

mpg123 file.mpg --cdr /dev/stdout | tee file.cdr | programm-to-handle-cdr 


this does the following:

ouput file.mpg with cdr format to /dev/stdout. /dev/stdout is linked to
the stdout of the calling process.

now the magic. tee does write the input to file.cdr *and* also redirect
(duplex) the data to it's own stdout. see the manual page.

the next program does finally handle the original output and operate on
the data, while the tee in the middle save the data to a file.

conclusion: you can redirect output as you want, but seldom a un*x/linux
program does more than one thing at once. GUI programs have other
paradigms.


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]