Dialog script for listening to recordings

Russell Nelson (nelson@crynwr.com)
Thu, 24 Mar 1994 13:19:00 +0100


   From: gert@greenie.muc.de (Gert Doering)
   Date: 	Thu, 24 Mar 1994 11:17:38 +0100

   Russell Nelson wrote:
   > I've written a script, using the ``dialog'' program, to select, listen
   > to, and optionally delete incoming voice messages.  Would this be
   > useful to anyone?  I have it set up to play back through the
   > soundblaster's /dev/audio device (highly recommended), but it could be
   > very easily modified to use zplay.

   Sounds good. If you like, I'd put it in contrib/. How long is it?

About one screen.  For the non-Linuxers, dialog can be found on
tsx-11.mit.edu, as can the ncurses that it was compiled with.

#!/bin/sh
cd /usr/spool/voice/incoming
DIALOG=dialog
DONE=no

while [ $DONE = "no" ]; do
	if dialog --clear --title "PLAY VOICE" \
		--menu "Pick a voice file to play" 20 51 14 \
		`ls voc* | awk '{ print $0 " \"\"" }'` \
		2> /tmp/menu.tmp.$$; then

		choice=`cat /tmp/menu.tmp.$$`
		dialog --title "PLAYING FILE" \
			--infobox "Playing $choice" 5 51
		adpcmtopvf -r610 < $choice | pvfspeed 1.2 | \
			pvftoau -ulaw > /dev/audio
		if dialog --clear --title "DELETE FILE" \
			--yesno "Delete $choice?" 5 51; then
			rm $choice
		fi
	else
		dialog --clear
		DONE=yes
	fi
	rm -f /tmp/menu.tmp.$$
done