Follow Slashdot stories on Twitter

 



Forgot your password?
typodupeerror
×
Microsoft

Play Random Sounds for E-Mail Notifications? 156

An anonymous reader asks: "I, like many of my fellow Outlook-using geek friends, like to set funny sounds to be played when a new message arrives ('Leeroy Jenkins' is the one I have set now). However, we have always wanted to be able to have random sounds be played when a new message arrives, rather than the same sound over and over. I've searched high and low, and I was hoping Slashdot could suggest/write a program that can randomly play sound files from a specified folder when a new message arrives. Any ideas?"
This discussion has been archived. No new comments can be posted.

Play Random Sounds for E-Mail Notifications?

Comments Filter:
  • Random sounds? (Score:5, Insightful)

    by Anonymous Coward on Tuesday July 19, 2005 @07:18PM (#13108651)
    Is this what Ask Slashdot has boiled down to - asking about playing random sounds when email arrives? There's gotta be better material to pick from than this.
    • #!/bin/sh
      # updates the sound list

      path=$1

      find $path -name "*.[Oo][Oo][Gg]" -print > soundlist.txt
      find $path -name "*.[Mm][Pp][3]" -print >> soundlist.txt
      find $path -name "*.[Ww][Aa][Vv]" -print >> soundlist.txt
      find $path -name "*.[Ff][Ll][Aa][Cc]" -print >> soundlist.txt
      find $path -name "*.[Aa][Ii][Ff][Ff]" -print >> soundlist.txt

      #!/bin/sh
      # play random file from filelist

      filelist=$1

      len=`wc -l $filelist`
      n=`expr $RANDOM % $len`
      play `sed -n ${n}p $filelist`
    • My Ask Slashdot post was rejected, and this got through? WTF?
    • It's better than that.

      Ask about writing an application that will only run with Windows Outlook for playing sounds when email arrives.

      It's a cute idea, until you realize that most people who actually leave their speakers on at work, with all those event noises, are loathed by their coworkers for all that noise pollution. It's as bad as loudly farting every few minutes.

  • If you use OS X and Mail.app, it's easy. Turn off the new mail notification in preferences, and add a rule that executes an applescript. Have the applescript choose a random sound somewhere and play it.
    • it's a similar process under linux, only you have to create a script and then create a named pipe.
    • except he said he uses outlook.
      • 0. save all user data from computer
        1. install Mandrake Linux or similar over the top of Outlook and MS-Windows
        2. restore user data
        3. configure KMail or Evolution to play random sounds
        4. problem solved. forever.
    • If you use OS X and Mail.app, it's easy. Turn off the new mail notification in preferences, and add a rule that executes an applescript. Have the applescript choose a random sound somewhere and play it.

      Well, as helpful as that is for Mail.app, but since he specifically asked for Outlook you're just taunting the poor man.

      He expects to have to edit the registry or something. :-P
      • I'm sure there is a virus out there somewhere that can do this. But perhaps not, as virii are mostly malicious now days. Remeber the good ol' days when a virus whould print out a message like "Your computer is now stoned."
        • ...ramming the disk heads into the spindle and frying first the monitor and then the video card?

          My goodness, some people have selective memories!
          • Err. No, I'm quite sure the original did no damage and later version modified the MBR. That's not pysical damage, but if you threw your hard drive on the ground and set your monitor and video card on fire trying to get rid of the virus that's your problem. Me, I just fixed the the MBR.
  • by LennyDotCom ( 26658 ) <Lenny@lenny.com> on Tuesday July 19, 2005 @07:19PM (#13108663) Homepage Journal
    If there are no programs to do this already how about a program that renames teh files in a folder to a specified name randomly ? then you set outlook to what ever name you have set. Unless of course outlook caches the sound.
  • hmm... (Score:4, Interesting)

    by sycotic ( 26352 ) on Tuesday July 19, 2005 @07:20PM (#13108664) Homepage
    set windows to play a sound eg. c:\sounds\newmail.wav and then have a folder with a number of wave files in it eg. c:\sounds\collection and schedule tasks to copy sounds to c:\sounds\newmail.wav every X minutes/seconds/whatever ?

    pretty clunky but relatively simple for the average bear
  • by biglig2 ( 89374 ) on Tuesday July 19, 2005 @07:20PM (#13108668) Homepage Journal
    Use a seperate new e-mail notification program (that plays random sounds) in parallel to outlook.

    Or write a script that occasionally copies a random WAV to notify.wav (which is what outlook plays).

    BTW, the place to start looking for outlook info is the excellent slipstick.com
  • Just write an AppleScript, it'll take like 10 seconds... You do mean the Mac version of Outlook, right?

    (Make help to actually give us some useful information in your post. What OS? That would be a good start.)
    • Gruh. I meant to type "might help," not "make help." Sorry.
    • There is no Mac version of Outlook, as I imagine you already knew. There is a version of Outlook Express for Mac OS 9, and there's Microsoft Entourage for Mac OSX, but no Outlook for Mac.
      • You say there's no version of Outlook for Mac, then in the next sentence you say there's a version of Outlook for Mac... the hell?

        Thanks for the tip, but I knew already... I used Outlook (for Mac) for several years before switching to Gmail.
      • Why is it that Entourage's IMAP implementation is so much better than the one in Outlook and Outlook Express? The win32 software doesn't store sent mail on the IMAP server, do not properly IDLE, and do not have server-side IMAP searching,

        I confess to being a bit of an IMAP snob: I used PINE and Mulberry until Thunderbird became "good enough" and I switched because of the preferable license. But I am not usually one to bash MS products, even if I choose not to use them.

        But REALLY! How screwed up is dev
        • How screwed up is development over in Redmond that they got it right on the Mac & got it wrong on their own OS?

          Dunno, but they did the same thing with Internet Explorer - Internet Explorer for the Mac was the first web browser with reasonably complete support for CSS 1, and it also handles the PNG alpha channel just fine. Meanwhile, five years later, the latest version of Internet Explorer for Windows still can't handle the PNG alpha channel, despite the specification being nine years old.

          It mus

          • I believe, but cannot cite sources to back it up, that the Mac Applicaiton development department is separate from the Windows Application developtment department. I seem to recall that they are housed in separate cites as well (perhaps Cupertino for the Mac wing).

            They may start with a similar code base, but they tend to diverge as each department tweaks the software to fit the guidlines of the target OS, and consumer demands for the apps.

            This also explains why the Mac Apps are about a quarter of a cycle
            • A former colleage is working on Office for Mac...in Redmond. I haven't asked him about how removed he is from the win32 developers.

              It is fine if codebases diverge, but it would be nice if the positive improvements on one platform would eventually be back-ported to the other. I don't see that happening. Seems like such a waste.

              If Entourage+IE on Mac are better for the reasons cited in this thread, I guess you believe that Mac consumers have stronger demands for apps that comply to standards?
      • There is no outlook for Macintosh?
        Quick, go tell Microsoft, they don't know yet!

        http://www.microsoft.com/mac/otherproducts/outlook formac/outlookformac.aspx?pid=outlookformac [microsoft.com]
        • That's Outlook 2001 for Mac OS 9. How many Mac users are there that still use OS9, and like using a 4-year old email client?
        • I stand corrected. There is no current version of Outlook for Mac OS X, but there is a (old, and no longer sold, but distributed at no cost and apparently still supported) version of Outlook for OS 9 and classic. Sorry. However, according to this page [microsoft.com], Outlook 2001 only works with an Exchange server and not with Internet mail. I imagine that the version they sold with Office 2001 did.
  • ...'Leeroy Jenkins' is the one I have set now...

    I feel so sorry for this guy's coworkers.

  • by Anonymous Coward
    are you asking about outlook on slashdot?
    go use thunderbird.
  • by Datoyminaytah ( 550912 ) on Tuesday July 19, 2005 @07:29PM (#13108744)
    I like! In fact, I like it so much, I think I'll assign random sounds to ALL system events!

    [click][click][clickity][click]

    Done!

    SPROING!!!

    Oh! I've got an email! Um...no, wait - what was that? Maybe an instant message...nope. Oh no! It's an illegal oper@*^!>$?%_)#&=
  • by Anonymous Coward
    I thought I had seen it all but, this is BY FAR the lamest Ask Slashdot I have ever seen. The Article needs to be moderated -5 Banal.

    How to rotate notification sounds? In Microsoft Outlook?? On Slashdot????

    Dear Slashdot, how can I cause this person to receive a severe electric shock everytime a new message arrives in his Outlook inbox?
  • Perl... (Score:4, Informative)

    by RedPhoenix ( 124662 ) on Tuesday July 19, 2005 @07:46PM (#13108907)
    #!/usr/bin/perl
    $SOUNDDIR="/usr/share/sounds";
    $ DESTFILE="/tmp/sound.wav";
    opendir(DIR,$SOUNDDIR) || die "Can't open $SOUNDDIR: $!\n";
    $count=0;
    while(defined($file = readdir(DIR))) {
    if($file =~ /\.wav$/) {
    $files[$count]=$file;
    $count++;
    }
    }

    $arraysize=@files;
    while(1) {
    $rnd=int(rand($arraysize));
    $filename=$files[$rnd];
    `cp $SOUNDDIR/$filename $DESTFILE`;
    sleep 10;
    }

    Mangle appropriately (source dir, sleep time, dest file, file-type).

    Have fun.

    Red.
    • Since you're on MS, you'll probably want to:
      * Install activestate perl
      * Use appropriate MS compatible directories (c:\path\to\somewhere rather than /usr/share/sounds)
      * swap out the `cp ...` for `copy ...` .. probably worth chucking a closedir in there somewhere too.

      Bah, ahh well - can't expect much for 20 seconds of coding and no debugging I guess.

      Red.
    • Nice.

      How about this, tho? Make a piped file on a samba share, and when something tries to read the file, it executes:

      #!/usr/bin/perl
      $SOUNDDIR="/usr/share/sounds";
      opendir(DIR,$SOUNDDIR) || die "Can't open $SOUNDDIR: $!\n";

      $count=0;
      while(defined($file = readdir(DIR))) {
      if($file =~ /\.wav$/) {
      $files[$count]=$file;
      $count++;
      }
      }

      $arraysize=@files;

      $rnd=int(rand($arraysize));
      $filename=$files[$r nd];
      system("cat $filename");

      # --LWM
    • There's a lot of extra stuff in your version, largely due to not taking advantage of things behaving differently in array and scalar contexts. readdir in array context will return all of the elements in the dir, which you can then grep for the entries matching your criteria. Similarly, there's no reason to have $count *and* $arraysize, or really either one. @array will give you the number of elements in the array when called in scalar context - like in rand($). Finally, there's no reason to use the back
  • Outlook-using geek

    That's it. Turn in your fucking geek card. Now. There's the door. Get going and don't ever come back here.
  • Do already have the sounds lined up? Lots of Locutus quotes, Ballmer's "Developers^3" quote, a few Brain "Take over the World" quotes, and you should be perfectly prepared.
  • Write a script that gets triggered by file access events for the wave file Outlook is looking at. Every time that event happens, have it wait fifteen seconds, then overwrite the file with a randomly-selected one from a directory tree that contains wav files.

    Bonus points for having it read the config information out of the registry and/or an ini file.
  • Wow (Score:3, Insightful)

    by Goo.cc ( 687626 ) * on Tuesday July 19, 2005 @07:53PM (#13108977)
    Without trying to disrespect the submitter, I can't believe this is a Ask Slashdot topic. Certainly this would have been better answered on a Windows related forum.
  • No Problem (Score:4, Funny)

    by RealityMogul ( 663835 ) on Tuesday July 19, 2005 @08:25PM (#13109271)
    Be glad to help - just give me your e-mail address and I'll send you over an executable. I'll even be so nice as to include an MD5 hash so you know its secure.

  • by AuMatar ( 183847 ) on Tuesday July 19, 2005 @08:28PM (#13109292)
    from Claria [claria.com]. Nothing makes a Windows PC do random shit faster.
  • ... Use the Macros (Score:4, Interesting)

    by johnnliu ( 454880 ) on Tuesday July 19, 2005 @09:04PM (#13109544) Homepage
    In Outlook, press ALT-F11
    Write your macro that plays your sound file.

    Go to your Rules & Alerts
    Create a rule for receiving emails - to play your Macro.

    Bonus point.
    Make your macro play a random sound.

    I think the whole effort should take about 5 minutes.
  • by Tezkah ( 771144 ) on Tuesday July 19, 2005 @09:09PM (#13109565)
    This is better than the Ask Slashdot I submitted, where I wanted to find out a way for thunderbird to play a random sound every time my RSS feed picks up a new Slashdot story.

    I settled for comic book guy saying "Worst. Slashdot. Story. EVER."

    Surprisingly its true every time!
  • by LordEd ( 840443 ) on Tuesday July 19, 2005 @09:41PM (#13109753)
    1. Write a simple application/script that plays a random sound file
    - Read directory and store files in a list/array
    - Use a random function to pick a wav file
    - Load and play the selected audio file

    2. Disable e-mail sound notifications (Tools->Options->Email options->Advanced email options->uncheck 'play a sound'

    3. Set up a rule for incoming email: (Tools->Rules wizard->New.
    Start from a blank rule. Check messages when they arrive (next).
    (Next) and confirm to apply to all rules.
    Check 'start application'. Click the underlined 'application'. Choose your custom app (open).
    (next)(next).
    Name the rule 'sound script'
    (finish)(ok).

    To prevent your script from playing sounds for every email received, put a delay counter on it to prevent multiple instances of the same application, or some form of lock preventing concurrent running.
    • Oh man, first I have to hand back my geek card because I am also an Outlook using geek, and now I realise that I didn't think of this way of doing it, so I have to hand back my MCSE.

      I mean, can't you leave me with some shreds of dignity?

      Alright, heres my last suggestion, get your colleagues and friends to record a mail notification for you, and attach it to Outlook (via the rules wizard) to play that notification when that person sends you a greeting.
  • One way is to use VBA. I don't have much experience with it. All I've ever done is make a quick thing that would page me when the 15-minute notification for meetings came up. If you go to Tools -> Macros -> Visual Basic Editor, the help file in that is very useful, specifically the information on the NewMail event. It won't explain exactly how to do it (and I don't know enougrh to explain how here), but it should go a long way to helping out.
  • Why not vary the sound depending on the amount of email arriving? With a Ferris Bueller theme, a short note would be a small cough, up to a load of spam and several Powerpoint presentations which would sound like someone coughing up a lung and a face-hugger or two.

    Since my new mail sound is currently a Klingon yellow alert, each email could be a hit on the shields, which slowly regenerate. Too much email in a short period would start a warp-core breach warning followed a huge explosion. Real fans could in

  • Ah, Poly MacBeep
    You always were so much fun
    Windows needs you now
  • by clambake ( 37702 )
    just play a file called "email_sound.wav", then have a cron job symbolically link a random sound to it every minute.
  • by Bitsy Boffin ( 110334 ) on Wednesday July 20, 2005 @01:00AM (#13110809) Homepage
    I used to have alert sounds on my email system, but it got really tedious, because I get lots of mail and most of it can wait, while some of it is important enough that I must look at it there and then (think important clients, not so important clients) - every time the alert went off, I'd have to stop what I was doing, go to the mail software, check to see what the message was and if it was important enough to deal with there and then.

    So anyway I had a bit of a brainwave one day - I hooked up festival (the voice synthesis software) to Evolution (my preferred mail client) and now instead of non-informational alert sounds I have festival read out-loud the sender and subject.

    It's probably the best thing since sliced bread as far as I'm concerned (I've had it like this for, umm, about a year I guess, and it's still very cool). Now when an email comes in I don't have to stop what I'm doing, I know if it's important enough to go look at because my PC tells me :)

    Even better..like all good geeks I have my PC running 24/7 a couple of meters from my bed (and like all good geeks I'm the only one in my bed), so no more do I have to get up and go see what the email was if I'm in bed :) Strangely enough I find I often sort of half-wake up in time to hear the subject being read to me even in the middle of the night (perhaps the hard drive churning before as fest starts up etc wakes me slightly).

    Most useful thing... ever. Perhaps I should patent it ;)
  • Here is the code (Score:3, Informative)

    by FriedTurkey ( 761642 ) * on Wednesday July 20, 2005 @01:05AM (#13110841)
    Step 1 - Lower your macro security.

    Step 2 - Close Outlook and restart Outlook.

    Step 3 - Open up the Visual Basic editor.

    Step 4 - Add this in the code session of "ThisOutLookSession".

    Step 5 - Reformat the thing. I spent more time trying get it through the Slashdot filters than writing it.

    Private Declare Function PlaySound Lib "winmm.dll" _ Alias "PlaySoundA" (ByVal lpszName As String, _ ByVal hModule As Long, ByVal dwFlags As Long) As Long Function GetAllFilesInDir(ByVal strDirPath As String) As Variant ' Loop through the directory specified in strDirPath and save each ' file name in an array, then return that array to the calling ' procedure. ' Return False if strDirPath is not a valid directory. Dim strTempName As String Dim varFiles() As Variant Dim lngFileCount As Long On Error GoTo GetAllFiles_Err ' Make sure that strDirPath ends with a "\" character. If Right$(strDirPath, 1) "\" Then strDirPath = strDirPath & "\" End If ' Make sure strDirPath is a directory. If GetAttr(strDirPath) = vbDirectory Then strTempName = Dir(strDirPath, vbDirectory) Do Until Len(strTempName) = 0 ' Exclude ".", "..". If (strTempName ".") And (strTempName "..") Then ' Make sure we do not have a sub-directory name. If (GetAttr(strDirPath & strTempName) _ And vbDirectory) vbDirectory Then ' Increase the size of the array ' to accommodate the found filename ' and add the filename to the array. ReDim Preserve varFiles(lngFileCount) varFiles(lngFileCount) = strTempName lngFileCount = lngFileCount + 1 End If End If ' Use the Dir function to find the next filename. strTempName = Dir() Loop ' Return the array of found files. GetAllFilesInDir = varFiles End If GetAllFiles_End: Exit Function GetAllFiles_Err: GetAllFilesInDir = False Resume GetAllFiles_End End Function Private Sub Application_NewMail() Const SND_SYNC = &H0 Const SND_ASYNC = &H1 Const SND_FILENAME = &H20000 Dim varFileArray As Variant Dim lngI As Long Dim strDirName As String Const NO_FILES_IN_DIR As Long = 9 Const INVALID_DIR As Long = 13 On Error GoTo Test_Err strDirName = "C:\windows\media" varFileArray = GetAllFilesInDir(strDirName) For lngI = 0 To UBound(varFileArray) Debug.Print varFileArray(lngI) Next lngI lngI = Math.Round(Math.Rnd() * UBound(varFileArray)) WAVFile = "C:\windows\media\" & varFileArray(lngI) Call PlaySound(WAVFile, 0&, SND_ASYNC Or SND_FILENAME) Test_Err: Select Case Err.Number Case NO_FILES_IN_DIR MsgBox "The directory named '" & strDirName _ & "' contains no files." Case INVALID_DIR MsgBox "'" & strDirName & "' is not a valid directory." Case 0 Case Else MsgBox "Error #" & Err.Number & " - " & Err.Description End Select End Sub

    Step 6 - Ignore all replies to this post. They are all the same Microsoft bashing crap you've already read 1000 times on /.

    Step 7 - If you think this is some kind of virus learn to code and then you can check it yourself.

    Step 8 - Fix the API call. It is too slow.
  • Just create a named pipe connected to an app that spits out a random wave file on access.

    Oh, right, you can't do that and use Outlook at the same time.
  • You should ask one of your friends who is good with computers to help you set up something.

"Protozoa are small, and bacteria are small, but viruses are smaller than the both put together."

Working...