Want to read Slashdot from your mobile device? Point it at m.slashdot.org and keep reading!


Forgot your password?
Firefox Music News

Breakthroughs In HTML Audio Via Manipulation With JavaScript 141

jamienk writes "Imagine if you could grab and manipulate audio with JavaScript just like you can images with Canvas. Firefox experimental builds let you do just that: crazy audio visualizations, a graphic equalizer, even text-to-speech, all in JavaScript! Work in progress; you need a special build of Firefox (videos available), being worked on via W3C."
This discussion has been archived. No new comments can be posted.

Breakthroughs In HTML Audio Via Manipulation With JavaScript

Comments Filter:
  • Pac-Man played sound on the Google homepage, wasn't that done in JavaScript?

    • Re: (Score:1, Insightful)

      by Anonymous Coward

      No, that was Flash, and it caused lots of ire, particularly in combination with Firefox plugin that loaded the Google homepage in the background. I hope there'll be a sound=off option, because I still remember the 90s and web pages with MIDI sounds.

      • by dgatwood (11270)

        Humorously, I actually thought the game was silent when I first viewed it. Once again, ClickToFlash delivers an improved user experience.

    • by Yvan256 (722131)

      It was done via Flash.

    • Re: (Score:2, Informative)

      by scurker (1381139)
      The game and all the movements were Javascript. The sounds were done with flash.
    • From what I've read, there was an off-screen flash helper playing the audio, and I'm not surprised. It's nigh impossible to get reliable audio with JavaScript only. People have been doing some experiments with stuffing data urls into , , and tags for a while now (heck, I've been doing it since last fall) in order to programmatically generate audio, but it generally suffers from performance issues and various glitches for a while now. You can mostly pull it off only if you stick with MIDI or you use Flash

      • This:

        have been doing some experiments with stuffing data urls into , , and tags for a while now

        was meant to be

        have been doing some experiments with stuffing data urls into <bgsound>, <embed>, <object>, and <audio> tags for a while now

      • Have you published your experiments anywhere? I have done some experiments with the audio tag and have been disappointed with the way it handles short programatically triggered sounds. It works (baring bug, like in Chrome) but I would love to see a better way.

        • Have you published your experiments anywhere?

          I talked about them a little bit at the December BayJax Meetup, and I've been meaning to turn that presentation into a web page since then, but I haven't.

          However... I've also been meaning to create an audio-focused JavaScript mailing list so that when I do put it up, I'd have somewhere to announce it. And thanks to your comment, I just got off my butt and created the js-audio Google Group. :)

          http://groups.google.com/group/js-audio [google.com]

          I'd love to have you or anyone el

      • Re: (Score:3, Informative)

        by roca (43122)

        There is no Flash involved here, you read wrong. I wonder why you got modded up.

        • by weston (16146)

          There is no Flash involved here, you read wrong.

          In the topic of the linked article, or in Google's Pac-man?

          I wonder why you got modded up.

          Possibly because even if it turns out what I've read about GPac is incorrect, most of what I've written besides is correct.

  • by B5_geek (638928) on Wednesday May 26, 2010 @03:34PM (#32352860)
    All I can think of is <BLINK> </BLINK> turned into audio!

    Of course this has good uses (blind users with scripts available), but I can see how this will end badly for the rest of us.
    • by Yvan256 (722131) on Wednesday May 26, 2010 @03:38PM (#32352924) Homepage Journal

      You mean annoying like people who put their comments between <code> tags?

    • by Darkness404 (1287218) on Wednesday May 26, 2010 @03:45PM (#32353022)
      You mean that you expect this to actually be used?

      IE doesn't even have support for canvas, Firefox has had it from 3.0 at least, and I think even 2.0 had some support.

      If IE still has more than 30% worldwide marketshare, and doesn't have basic requirements for this, its not going to be used. Period.

      Canvas has been around for ages and is there even a single practical example on a site people use daily? Yeah, there are about a million tech demos but very little actual use because IE doesn't support it.
      • by sfcat (872532)
        Actually, I'm building an enterprisy application right now that uses the canvas tag to emulate a 3D environment. We support IE via the Google Chrome Frame. So there's one way around your problem and one example of people using canvas in the real world.
      • IE9 will have Canvas

      • by timeOday (582209)
        Any chance google will help [techcrunch.com] Microsoft along again? (Heh, I'll bet MS *loves* that!)
    • Re: (Score:2, Funny)

      You know, there are already PLENTY of applications out there that blind users can use to turn text on screen to speech? And that a lot of people prefer to disable javascript from running?

      Last thing we need is an "on Hover" Javascript ad, you mouse over, and audio gets maximized "FIND YOUR MATCH @ ADULTFINDER.COM!"

  • All these breakthroughs in Canvas and Javascript are useful, but will they be used?

    Until IE implements even half these features, we will be stuck with "Quick"Time and Flash for quite some time...
    • > Until IE implements even half these features...

      Or until IE is dead...

      • by mini me (132455)

        IE is already dead as far as developers should be concerned. Pages will work well enough that IE users can still limp along, if need be.

  • music to my ears. Finally I will be able to listen to midis without a plugin.
  • Screen readers... (Score:3, Insightful)

    by dclozier (1002772) on Wednesday May 26, 2010 @03:38PM (#32352920)
    This will be fantastic for aiding those that have vision impairments. The 503 compliance will end up including this if it is ever standardized. (w3c not known for speed)
  • by Anonymous Coward

    awesome, you could do that in Flash 5 years ago.

    • by hedwards (940851)
      Not on any OS that Macromedia didn't bless with an implementation. Which is the reason why there's so much effort going into opening it up. You can't see Flash things if you don't have Flash.
    • The difference is that we want flash to die horribly for a number of reasons.

      • by Kamineko (851857)
        And one of these would be that it allowed you to have sound in web pages.
        • With no way to fine-tune who is allowed sound and who isn't.

          With a browser implementation of an open standard, it would be easy to add features such as muting a page's audio when (*gasp*) it's not in the foreground tab. Besides, there will no doubt be plenty of ways to turn off audio, partially or completely. And plug-ins like greasemonkey work great to hack around website JS features, while you can't do anything with Flash SWF blobs other than turn them on and off.

    • awesome, you could do that in Flash 5 years ago.

      awesome, you could do that in a Win32 app 15 years ago.

      • awesome, you could do that in a Win32 app 15 years ago.

        You have to be a member of the Administrators group to install a native app. You do not have to be a member of the Administrators group to run a Flash object, a JavaScript program, or a Java applet, because the web developer can safely assume that every PC already has players for one or more of these.

  • even text-to-speech, all in JavaScript!

    WooHoo! I'm gonna have hidden fields in my web pages so this "text to speech" will say one thing while the text on the screen will say another!

  • the future os is the browser

    the future os programming language is javascript


    • You need to put "enjoy" in quotes.

    • by gbjbaanb (229885)

      sure, but that's because the marketplace for browser-based languages is immature. As it displaces al other forms of programming platforms, Microsoft will bring out javascript.net, mozilla will bring out xpjavascript, and Google will bring out javavik.

      See, the future will turn out to be just as good as today.

    • by eulernet (1132389)

      The future sucks badly.

      Hopefully, the world will end in 2012.

    • by evilviper (135110)

      the future os is the browser

      the future os programming language is javascript

      I don't buy it. It's too inherently limited to replace any large class of regular applications.

      I fully expect the web-app trend will be just that... every bit as short-lived as every other stupid trend. This time it's Flash and Javascript. Last time it was Java Applets. Next time... who knows?

  • it does not help me one bit with building a beowulf cluster of javascript engines.

  • wisdom (Score:2, Insightful)

    It was Chris Rock, who said, "You can do it, but that don't mean it's to be done."
    • and why in this case is it "not to be done"?

    • by thijsh (910751)
      One thing that *can* be done, and thus is *meant* to be done once this JS audio hits the web: SilentFox plug-in, it kills all sound from all sites (except the white listed ones)... Never an annoying ad that unexpectedly gives you a heart attack when the speakers are still set to 11.
  • The boundary is being breached by the form field on your right column. One's eye just jumps right to it. I'm using Firefox 3.6.4.
  • ...that was needed to be able to actually make a decent 3D game in JavaScript. Sure, I'd prefer OpenAL bindings, but this'll work.

    • Define decent. Let me know when we're talking about hardware acceleration.
      • WebGL is hardware-accelerated video. Audio benefits from hardware acceleration, but doesn't need it. It does, however, need some amount of software control, something more than "Play this file at roughly this time."

If a subordinate asks you a pertinent question, look at him as if he had lost his senses. When he looks down, paraphrase the question back at him.