loading

Playing Sound File Question?

Is there anyway for my computer to play a sound whenever I go to a specific website? I just want a simple program that will run in the background that plays a sound everytime it detects that I go to a particular site.

Thanks!

Hi transistorguy...

You can play a sound file every time your computer accesses a website by using a script monitoring your network traffic running in the background.

This concept will work on either Mac, Linux and PC. If you are using a PC (I tested this on Windows 7)... you can download two simple helper applications. WinPcap which is an open source packet capturing library and ngrep to monitor your network traffic.

Install WinPcap and place ngrep into your windows folder. From the command prompt type: ngrep -L this will give you a list of network adapters that you may monitor - in my case I monitored my wifi adapter which was number 2.

Using notepad I wrote a quick and nasty script and saved it as sound.cmd;

ngrep -q -n 1 -d 2 www.instructables.com
"%ProgramFiles%\Windows Media Player\wmplayer.exe" /play /close "%windir%\Media\Sonata\Windows Ding.wav"


This script monitors the traffic quietly (-q) on adapter 2 (-d 2) until 1 (-n 1) packet is found to have www.instructables.com in it... then it runs the windows media player with the Ding wav files.

Hope that helps.

PS You can simply add :START at the beginning of the script and GOTO START at the end to make it continue. If you have trouble with media player not closing you could use a different player or run another script to run the media file and then include a delay to let the sound play timeout /T "#ofsecondshere" and finally taskkill /IM "mediaplayer" to close it.