[comp.sys.next] Attaching sounds to actions?

barry@pico.math.ucla.edu (Barry Merriman) (01/22/91)

Is there any way to attach sounds to system functions like
logout, killing a process, deleting a file, etc?

I know Preferences can be used to set the system beep, but I'd like
finer control. (My machines name is Arnold---as in Schwarzenegger---which
opens up the possibility for a great many amusing voice annotations
for these functions. For example, on shutdown, I'd like it to
say ``I'll be back'', from the movie Terminator, and when I kill 
a process, I'd like it to take the quote from Commando:``Remember when
I said I'd kill you last? I lied.'')


--
Barry Merriman
UCLA Dept. of Math
UCLA Inst. for Fusion and Plasma Research
barry@math.ucla.edu (Internet)

anderson@dogie.macc.wisc.edu (Jess Anderson) (01/23/91)

In article <985@kaos.MATH.UCLA.EDU> barry@pico.math.ucla.edu
(Barry Merriman) writes:

>Is there any way to attach sounds to system functions like
>logout, killing a process, deleting a file, etc?

>[details omitted]

That is an *very* silly idea, but I'm interested in almost
the same thing! :-)

I have this motd:

ULTRIX V4.1 (Rev. 52) System #2: Mon Jan  7 17:18:01 CST 1991
UWS V4.1 (Rev. 197) ...dogie...

(oops, wrong gadget! I want the other one:)

Yak (Poephagus grunniens) <> yak.macc.wisc.edu [128.104.30.152] <> (NeXT 2.0)

It's the Dairy State, so our hosts have kinetic names :-)

Up to here, this whole posting is just a joke.  What I
really want is something on the order of a spoken message at
the end of the logon sequence, after whatever is opened from
the dock opens, along the lines of

Good <morning | afternoon | evening>, <personal name>, how
may I do your bidding?

Or other such nonsense.

I only have a couple accounts to deal with, so it's just for
fun and the relief of tedium in the workplace.  Of course,
this being a university, we call it research.

Spoken fortunes could be fun, too, I guess.

<> "Slime is the agony of water." -- Jean-Paul Sartre
--
Jess Anderson <> Madison Academic Computing Center <> University of Wisconsin
Internet: anderson@macc.wisc.edu <-best, UUCP:{}!uwvax!macc.wisc.edu!anderson
NeXTmail w/attachments: anderson@yak.macc.wisc.edu  Bitnet: anderson@wiscmacc
Room 3130 <> 1210 West Dayton Street / Madison WI 53706 <> Phone 608/262-5888

garnett@cs.utexas.edu (John William Garnett) (01/23/91)

In article <985@kaos.MATH.UCLA.EDU> barry@pico.math.ucla.edu (Barry Merriman) writes:
>Is there any way to attach sounds to system functions like
>logout, killing a process, deleting a file, etc?
>
>I know Preferences can be used to set the system beep, but I'd like
>finer control. (My machines name is Arnold---as in Schwarzenegger---which
>opens up the possibility for a great many amusing voice annotations
>for these functions. For example, on shutdown, I'd like it to
>say ``I'll be back'', from the movie Terminator, and when I kill 
>a process, I'd like it to take the quote from Commando:``Remember when
>I said I'd kill you last? I lied.'')
>

I think that you must be kidding, but just in case you aren't you could

1) write csh or sh shell scripts that first play a sound and then invoke
   a corresponding command.  For example, you could write a shell script
   named "killer" that contained the following lines:

   kill $*
   sndplay /LocalLibrary/Sounds/killer.snd

   where killer.snd is a sound file that says whatever you want it to
   say (e.g. "Remember when I...").  Make sure to change killer to
   be executable (chmod +x killer).  You should also put killer in
   a directory that is in your path.

2) write a NeXTstep front end to the utilities (kill, rm, etc.) and
   specify the appropriate sound files using inspector on the button
   that causes a given application to be executed.  It might actually
   be useful to write this type of frontend to kill (who likes using
   ps to find a process id in order to kill something, much better
   to scroll through a list and then mouse select the process).

3) To attach a soundfile to system shutdown, you can move /etc/halt to
   /etc/halt.bin and then write a shell script like the following:

   sndplay /LocalLibrary/Sounds/shutdown.snd
   exec /etc/halt.bin -e -p

   Again, make sure that the /etc/halt script is executable.  I haven't
   actually tried this - you may have to make /etc/halt a compiled C
   program and use the C routines analagous to sndplay and exec
   (the SND* routines and execl()) depending upon how the windowserver
   invokes /etc/halt.

-- 
John Garnett
                              University of Texas at Austin
garnett@cs.utexas.edu         Department of Computer Science
                              Austin, Texas

barry@pico.math.ucla.edu (Barry Merriman) (01/24/91)

Here's the answer about how to attach sounds to actions---its
the Unix way, of course!

Lets assume you store all your sounds in /me as .snd files. 
Then you'd do the following:

Login sounds
------------

Put

playsnd /me/my_login_sound.snd

in you .login file

Logout sounds
------------

Put

playsnd /me/my_logout_sound.snd

in your .logout file

Sounds attached to commands
---------------------------

too attach foobar.snd to the command foobar, make the following alias
in your .cshrc file:

alias foobar 'playsnd /me/foobar.snd ; /bin/foobar'

NOTE: you must put the full path name of foobar (here assumed /bin/foobar)
in the alias to avoid a self-referential alias.

Complications:
-------------
If you work in a heterogenous environment---say suns and NeXTs,
then you need to put conditional statements in front of all the
above commands, conditioning on whether you are logged into the NeXT.
A crude way to do this is 
if(`hostname` == my_next_hostname ) <command>
But this is clumsy if you have many NeXTs.

A better way is to see if the NeXT files are present, and use this
to deside. E.g.,

if ( -e "/.NeXT" ) <command>

checks for the existence of the /.NeXT directory.

Q: is there a command that returns "next" as a machine type,
analogous to the sun `arch` command? If so, use this to
query the machine type.

Bugs
----

These sounds don't get executed by the system though---for e.g.,
if you attach a sound to "kill", and then use the Processes panel
to kill an App, it doesn't use your kill. Even if you put it
in the root .cshrc. I suppose you would have to su to root
and change the kill command to a script that read your sound
prior to kill---but thats a little hacky.

Getting sounds
--------------

Well, this is up to you. You can always record them through the
built in mike using SoundPlayer---though these are of lesser quality.
If anyone out there has a high quality (digital ears) recording setup,
I'm looking for a few good Arnold Schwarzenneger quotes. 
For the moment, I'm making do with my Arnold imitation, which
eventually I'll replace with Arnold himself, via the builtin mike.

If anyone has a digitial ears setup, post some good sounds to the archives.

Have fun.

--
Barry Merriman
UCLA Dept. of Math
UCLA Inst. for Fusion and Plasma Research
barry@math.ucla.edu (Internet)

mfi@serc.cis.ufl.edu (Mark Interrante) (01/24/91)

In article <1053@tokio.cs.utexas.edu> garnett@cs.utexas.edu (John William Garnett) writes:
>In article <985@kaos.MATH.UCLA.EDU> barry@pico.math.ucla.edu (Barry Merriman) writes:
>>Is there any way to attach sounds to system functions like
>>logout, killing a process, deleting a file, etc?
>>
>
>I think that you must be kidding, but just in case you aren't you could

This is not a joke, Apple has had something called the sonic finder
around for a while and there are numerous ways of adding sounds to
various mac interface activities.  These can provide useful feedback
when performing mouse based work.  I specificaly like the "clunk" a
file makes when it is directly over a folder (in addition to
highlighting).  I think apple has done interface studies finding this
to be effective.

Mark

-----------------------------------------------------------------------------
Mark Interrante   		  Software Engineering Research Center
mfi@beach.cis.ufl.edu		  CIS Department, University of Florida 32611
-----------------------------------------------------------------------------
Quote from a west Texas farmer  "status quo is Latin for the mess we're in."

anderson@dogie.macc.wisc.edu (Jess Anderson) (01/24/91)

In article <992@kaos.MATH.UCLA.EDU> barry@pico.math.ucla.edu
(Barry Merriman) writes:

>Here's the answer about how to attach sounds to actions---its
>the Unix way, of course!

[various methods]

>Complications:
>-------------
>If you work in a heterogenous environment---say suns and NeXTs,
>then you need to put conditional statements in front of all the
>above commands, conditioning on whether you are logged into the NeXT.
>A crude way to do this is 
>if(`hostname` == my_next_hostname ) <command>
>But this is clumsy if you have many NeXTs.
>
>A better way is to see if the NeXT files are present, and use this
>to deside. E.g.,
>
>if ( -e "/.NeXT" ) <command>
>
>checks for the existence of the /.NeXT directory.

I'm not very Unix-proficient (but I'm working on it :-), but
I don't think that does it.  When I'm not at my desk (where
the NeXT is), like from home at the moment, I reach it by
dialing in to a VMS Vax, then rlogin to the NeXT over the
campus ethernet.

I'd get a true on both those tests and pass the *.snd file
to the terminal (eek), right?

Hm.  Maybe a sed or awk script to extract the useful info
from the output of a who command and test the result?

>Getting sounds
>--------------
>
>Well, this is up to you. You can always record them through the
>built in mike using SoundPlayer---though these are of lesser quality.

I tried setting my system beep to an oops.snd file I made with
SoundPlayer, and that was when I noticed the cube has what I
would call loud fans, even though it's under a sturdy table.
It's the sort of noise you tune out in life but that is heard
right away on a sound recording.  I had a similar problem while
playing with my Sound Blaster board in the PC at home (it has
even louder fans, including one in the monitor).

(Can you believe adults do these things?  I can't! :-)

--
Jess Anderson <> Madison Academic Computing Center <> University of Wisconsin
Internet: anderson@macc.wisc.edu <-best, UUCP:{}!uwvax!macc.wisc.edu!anderson
NeXTmail w/attachments: anderson@yak.macc.wisc.edu  Bitnet: anderson@wiscmacc
Room 3130 <> 1210 West Dayton Street / Madison WI 53706 <> Phone 608/262-5888

gessel@masada.cs.swarthmore.edu (Daniel Mark Gessel) (01/25/91)

>When I'm not at my desk (where
>the NeXT is), like from home at the moment, I reach it by
>dialing in to a VMS Vax, then rlogin to the NeXT over the
>campus ethernet.

>I'd get a true on both those tests and pass the *.snd file
>to the terminal (eek), right?

I don't think so. I think it would play it on the machine you had
logged into. People might think you were in your office. If you put
stuff in like "get your hands off me!" you might scare off some
burglars if you happen to log in at just the right moment :-).

Seriously, I think this is covered by the public sound server control
in Preferences (or Workspace Manager?). I would say try it out, but I
suspect that if the public sound server is on, anyone logged in from
anywhere can play and send the console sounds over a tcp-ip connection
(the same way you can run your program on another machine and have it
send window server commands to your NeXT). If not, I suspect that only
the person logged into the Console itself has the right to send sounds
through the sound port.

This may, however, only be for recording, (blocking recording from
another machine, or a remote user).

If you get a chance to test this out, please let us know (or if it's
well documented somewhere, I'd like to know where.)

The above gives me an interesting idea. Port NeXTStep to crays and
big number crunchers that exist around. Not the window server, just
NeXTStep. Run your programs there, using your screen only as a window
server. You can do this with X, why not NeXTStep. I can just see
the mandelbrot app ported off the DSP to a cray (and in color too,
once those machines get out). Fire up 64 bits of precision at 200
MFLOPS or whatever they put out these days . . . 

Dan

--
Daniel Mark Gessel                          Independent Software Consultant
Internet: gessel@cs.swarthmore.edu                   and Developer
I do not represent Swarthmore College (thank God).

matthews@lewhoosh.umd.edu (Mike Matthews) (01/25/91)

In article <GESSEL.91Jan24100224@masada.cs.swarthmore.edu> gessel@masada.cs.swarthmore.edu (Daniel Mark Gessel) writes:
>I don't think so. I think it would play it on the machine you had
>logged into. People might think you were in your office. If you put
>stuff in like "get your hands off me!" you might scare off some
>burglars if you happen to log in at just the right moment :-).

Actually, it's humorous even if you just kind of have it play a random sound
-- the evil laugh is nice for people who are afraid of computers, the HAL
ones are nice for people named Dave...

You can also just rsh it, too -- no need to log in.

A friend of mine is in the habit of playing the Jetsons sound and trying to
do it so I can't stop it (other than muting).  This involves rshing, using
/tmp and deleting the file, changing ownership so I can't find it with a find
-owner command, etc.  He's very tricky.  Almost to the point of earning a
disabled account.  (:-), Jeff).

>Seriously, I think this is covered by the public sound server control
>in Preferences (or Workspace Manager?). I would say try it out, but I
>suspect that if the public sound server is on, anyone logged in from
>anywhere can play and send the console sounds over a tcp-ip connection
>(the same way you can run your program on another machine and have it
>send window server commands to your NeXT). If not, I suspect that only
>the person logged into the Console itself has the right to send sounds
>through the sound port.

It's in Preferences, under Unix Expert options.

If you have root's public sound server turned ON, anyone can play sounds
remotely, UNLESS the person logged in to the console has turned it off, and
you aren't root.

>Daniel Mark Gessel                          Independent Software Consultant

If you're root, you're God. :-)
------
Mike Matthews, matthews@lewhoosh.umd.edu (NeXT)/matthews@umdd (bitnet)
------
Who needs friends when you can sit alone in your room and drink?

wiml@milton.u.washington.edu (William Lewis) (01/25/91)

  Attaching sounds to command-line actions is fairly easy, since you
can get at the program that interprets your actions... the hard part
would seem to be getting sounds associated with the *GUI* actions, like
logging in, using the abbatoir, etc. Logging in and out is not too difficult:
there are system defaults (set by root) named LoginHook and LogoutHook,
which point to programs that are executed every time anyone logs in and
out on the console. You couls make scripts for these containing 
appropriate sndplays. 
  Harder are the other actions, the ones that are performed by clicking on
buttons in the Workspace Manager. The only way I can think of to 
change these is to modify the WM. This isn't as difficult as it sounds --
all Mach-O format NextStep applications contain (among other things) their
.nib files, stored in such a way that it is possible to extract them, edit
them (with InterfaceBuilder) to include sounds on the buttons, and reinsert
them. (A utility that does this is named 'segedit'. 1.0 has its manpage
but no executeable. I think 2.0 has the exe. In any case, there's a
program on the archives named 'fsectbyname' that will do this as long as
you don't try to insert a file larger than it used to be -- this is troublesome
though since sounds in the .nib make them larger.) This is definitely
"hacky" but it ought to work (so long as you're root so you can replace
the WM ...)



-- 
 wiml@milton.acs.washington.edu       Seattle, Washington   
     (William Lewis)   |  47 41' 15" N   122 42' 58" W  
"If a wave function collapses in the forest and no-one is
                 around to observe it ..."