PDA

View Full Version : Javascript onHover sound effect


johnMoss
03-30-2011, 04:07 PM
Does anyone have a resource for a good old fashioned PLEASANT onHover sound effect? Talking about those very short, soft tick noises or something similar for the menu. Have found any and everything but so far...
Thanx!

site use is www.reflexms.com (http://www.reflexms.com)

johnMoss
03-30-2011, 10:22 PM
OK I went ahead and just made one, I've loaded several scripts trying to get the sound to work. One that did work was calling the file from the server. So now pre-load is in order. I've found several of those also, which don't work. Me going wrong somewhere... Ideas / good resource for complete known good script?

johnMoss
03-31-2011, 01:24 AM
OK, have that figured out... Now problem is the latency of the audio. Flash has a workaround, but has anyone come up with a way to either shorten the buffer or get rid of it completely in javascript?

effect can be heard at www.reflexms.com (http://www.reflexms.com) home page and just the home menu button is active...

edbr
03-31-2011, 01:30 AM
i havent a clue but hopefully this will help

http://www.javascriptkit.com/script/script2/soundlink.shtml

johnMoss
03-31-2011, 01:48 AM
That was a piece of code that wouldn't work for me, tried it already. No biggie though, I've found two that do. This latency thing has taken me as far as the R&D blogs at M.I.T. I'm still hangin' in there with JS on this as the newest entries I have come across are still at least two years old. Which as I write this leads me to suspect everyone simply bailed and went with flash for this type of app.

johnMoss
03-31-2011, 01:52 AM
In continueum, MP3 gives the shortest latency at about 940 samples. WAV files are actually coming in at 2400 (!) I upped the sample rate to 96000 on the file (in soundbooth) but it didn't faze it. The file I have on the server is an mp3 at 36000.

edbr
03-31-2011, 02:03 AM
sound on sites is a minority as well i would think so less interest generally

johnMoss
03-31-2011, 02:09 AM
I know, I'm bein' a smarty pants on this one...

domedia
03-31-2011, 01:38 PM
HTML 5 . Check this out:
http://www.wait-till-i.com/2010/05/23/rimshots-for-all-using-html5-audio-and-css3-to-make-instantrimshot-com/
http://stackoverflow.com/questions/3472459/custom-1-button-player-with-html5-audio-tag

johnMoss
03-31-2011, 02:22 PM
http://stackoverflow.com/questions/3479780/creating-audio-using-javascript-in-audio

is an offshoot from the second link in the previous post. Second paragraph pretty well sums it up, gotta go flash for now. Mozilla is working on an advanced API, but the rest shall surely take an additional year to follow through. I guess the lesson here is with audio, its not just pre-load, it's pre-buffered as well. Apparently only Adobe has had the good sense to build that in to their players...

domedia
03-31-2011, 03:32 PM
I don't see why you have to do anything in flash.

You said it was to be a small audio clip.

Confused..

johnMoss
03-31-2011, 03:54 PM
go to the site www.reflexms.com (http://www.reflexms.com)

hover over the home button. the automatically generated latency by the browser default audio player is making the sound lag vs. the motion of the pointer as it strikes the object. Windows default player is the lame device in the browser, and it's latency is about 950 samples or so... Objective is to have sound immediately. I soundboothed the audio, so its a known good, arriving at maximum wavelength at .1 seconds... Killing the buffer is the objective, I just don't know that it can be done, and also, each browser has its own defaults... If I can skate by with IE & Mozilla on this, I'd call it even. Any thoughts?