Re: Pipe som ljud-device?
On Fri, 18 Jun 2004 11:31:00 +0200, Daniel Swärd <excds@kth.se> posted to
debian-user-swedish:
>> > Min erfarenhet är att vsound inte begriper sina egna optioner över
>> > huvud taget. (Var detta på Woody eller är samma sak fortfarande sönder
>> > i Sarge? Buggrapport i så fall, pronto!) Det går att hitta en
>> > kombination som gör att den inte klagar men då gör den kanske inte
>> > just det man ville ... Jag har tyvärr inte fört bok men i min
>> > .bash_history hittade jag vsound -k realplay nånting.srm som kanske
>> > kan ha funkat. (Om inte den så möjligen vsound -s men det är mindre
>> > sannolikt.)
>> Just det, när jag använde vsound så var jag tvungen att hacka den för
>> att få det att funka. Buggen är rapporterad (#172552) men inte fixad,
>> dock har någon skickat en patch.
> Ok, så har du nåt recept på hur man får det att fungera?
Här är en något hackad version av vsound, använd den i stället. Jag
har inte hunnit gå igenom och kolla att alla fåniga problem i shell
scriptet är korrigerade (min minnesbild var att nästan inga optioner
fungerade som de skulle men nu kan jag inte reproducera ...) men om
det här hjälper så går det säkert att göra en mera formell patch och
skicka in den.
Sedan är det ju en annan fråga om det längre finns någon som sköter om
vsound-paketet och kan göra en ny patchad version, t.ex. innan Sarge
blir nästa stable. :-/
Bug #172552 korrigerar bara en av de trasiga optionerna och dessutom
en som är mindre viktig. Nu minns jag inte vad allt jag har ändrat men
det börjar vara så mycket -- och så triviala ändrigar mestadels -- att
det inte känns vettigt att göra en diff.
/* era */
#!/bin/sh
# vsound - a wrapper script that allows you to record the output of OSS programs
#
# Copyright (C) 2000,2001 Erik de Castro Lopo <erikd@zip.com.au>
# Copyright (C) 1999 James Henstridge <james@daa.com.au>
#
# Based on the esddsp utility that is part of esound. Esddsp's copyright:
# Copyright (C) 1998, 1999 Manish Singh <yosh@gimp.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
: set -vx
verbose=0
keep_temps=0
resamplerate=0
outfile=./vsound.wav
convert_to_wav=1
case $# in 0) exec "$0" -h ;; esac
while test $# -gt 0; do
case "$1" in
-h|--help)
cat <<________EOF >&2
vsound - digitally record output of an OSS audio program
vsound [options] program arguments
options:
-f, --file=FILE output file name
-v, --verbose set to verbose output
-k, --keep-temps don't delete temporary files
-h, --help this help message
-V, --version show program version
-r, --resample resample the output file to the given sample rate
eg. vsound -r 44100 realplay file.rm
-d, --dspout enable simulateous output to /dev/dsp and file
(may be required for some programs)
-s, --stdout write the intermediate (Sun AU format) file to stdout
(no other output file is generated)
-n, --no-convert do not convert the AU file to WAV
-t, --timing add timing delays to allow recording of streaming data
________EOF
exit 0
;;
-V|--version)
echo "vsound-0.5"
exit 0
;;
--file=*)
outfile="`echo "$1" | sed -e 's/^[^=]*=//'`"
shift
;;
-f|--file)
shift
if test $# -gt 0; then
outfile="$1"
else
echo "$0: No output file specified -- aborting" >&2
exit 1
fi
shift
;;
-r|--resample)
shift
if test $# -gt 0; then
resamplerate="$1"
else
echo "$0: No sample rate specified -- aborting" >&2
exit 1
fi
shift
;;
-d|--dspout)
export VSOUND_DSPOUT=1
shift
;;
-s|--stdout)
export VSOUND_STDOUT=1
shift
;;
-v|--verbose)
verbose=1
shift
;;
-k|--keep-temps)
keep_temps=1
shift
;;
-n|--no-convert)
convert_to_wav=0
outfile=./vsound.au
shift
;;
-t|--timing)
export VSOUND_TIMING=1
shift
;;
--)
shift
break
;;
-*)
echo "$0: unknown option $1 -- aborting" >&2
exit 1
;;
*)
break
;;
esac
done
export VSOUND_DATA=./vsound$$.au
if [ "$verbose" = 1 ] && [ "$VSOUND_STDOUT" = 1 ]; then
echo "$0: Error: cannot specify both --verbose and --stdout." >&2
exit 1
fi
if [ "$verbose" = 1 ]; then
echo "Output file: $outfile" >&2
echo "Temp AU file: $VSOUND_DATA" >&2
fi
prefix=/usr
exec_prefix=${prefix}
pkglibdir=${exec_prefix}/lib/vsound
if [ ! "$VSOUND_STDOUT" ]; then
cat <<-____EOF >&2
$0: About to start the application "$@".
The output will not be available until the application exits.
____EOF
fi
# run the program with the vsound library preloaded
if LD_PRELOAD="$pkglibdir/libvsound.so" "$@" ; then
if test "$VSOUND_STDOUT" = 1; then
# Output went to stdout so there's no further processing to be done.
exit 0
fi
if [ ! -e "$VSOUND_DATA" ]; then
cat <<-________EOF >&2
$0: Error: Missing file $VSOUND_DATA.
This means that the libvsound wrapper failed to capture any sound.
Here are some the possible reasons:
- You are trying to record a stream (RTSP or PNM protocol) from
the internet. You will need to use the --timing option.
- The program you are trying to run is setuid. You will need to
run vsound as root.
- The program ran, but did not produce any sound output at all.
- Vsound was not properly installed and hence won't work at all.
________EOF
exit 1
fi
if test "$resamplerate" != 0; then
# Use SoX to convert sample rate and file types simultaneously.
echo -n "Resampling file to $resamplerate Hz: " >&2
sox $VSOUND_DATA -r 44100 $outfile resample
exitcode=$?
echo "Done." >&2
elif test "$convert_to_wav" = 1; then
# Use SoX to change from AU file to WAV file.
if test "$verbose" = 1; then
echo "$0: Converting to WAV file." >&2
fi
sox $VSOUND_DATA $outfile
exitcode=$?
else
# Rename the file to remove pid portion of name.
mv $VSOUND_DATA $outfile
exit 0
fi
else
exitcode=$?
echo "$0: application returned an error ($exitcode) -- aborting" >&2
fi
if test "$keep_temps" = 0; then
if test "$verbose" = 1; then
echo "Deleting temporary files." >&2
fi
rm -f $VSOUND_DATA
fi
exit $exitcode
--
formail -s procmail <http://www.iki.fi/era/spam/ >http://www.euro.cauce.org/
cat | more | cat<http://www.iki.fi/era/unix/award.html>http://www.debian.org/
Reply to: