Beta

Slashdot: News for Nerds

×

Welcome to the Slashdot Beta site -- learn more here. Use the link in the footer or click here to return to the Classic version of Slashdot.

Thank you!

Before you choose to head back to the Classic look of the site, we'd appreciate it if you share your thoughts on the Beta; your feedback is what drives our ongoing development.

Beta is different and we value you taking the time to try it out. Please take a look at the changes we've made in Beta and  learn more about it. Thanks for reading, and for making the site better!

JavaScript Decoder Plays MP3s Without Flash

Soulskill posted more than 3 years ago | from the race-to-easy dept.

Chrome 250

An anonymous reader writes "The introduction of HTML5 and super-fast JavaScript engines to the latest web browsers has brought with it a wealth of new functionality. The focus seems to have been put on the ability to play video in a browser without Flash, or making games. But a project born out of a Music Hackday in Berlin is just as exciting. It's called jsmad and is a pure JavaScript decoder that allows you to play MP3s in a browser without Flash. So, for example, a music artist could create a website and upload songs for visitors to listen to without need of any plug-ins. Alternatively, why not have an MP3 jukebox that can play songs off your hard drive or Dropbox folder just by loading a website? You can try out the decoder by visiting the jsmad.org website where there is a sample song, on the same site you can browse for your own local file to play. Be warned, it only works in Firefox 4+ at the moment, but Chrome support is coming and already works in some cases." Another reader tips news of a JavaScript PDF viewer.

cancel ×

250 comments

Wow!! (-1)

Anonymous Coward | more than 3 years ago | (#36478210)

Wow!!! Software that can be written in one turing complete language can be written in another! Let's post a story about every single new piece of software being written in Javascript as if this is some amazing accomplishment! What next? Someone writes software that generates farting noises... IN JAVASCRIPT!!!!!1111eleventyone

I predict... (1)

cruff (171569) | more than 3 years ago | (#36478434)

In the future there will be a slashdot posting about a Javascript script being able to post comments to stories on slashdot from a browser without needing a human to be present at the keyboard. When this happens, there will be remarks made about the change in the quality of comments. Some one will welcome the new Javascript comment posting overlords, etc.

Re:Wow!! (1)

haystor (102186) | more than 3 years ago | (#36478450)

I think this was posted due to /.'s obsession with everything mp3.

Re:Wow!! (0)

Anonymous Coward | more than 3 years ago | (#36478900)

It's cool because a ubiquitous scripting language that ran slowly has been optimized (probably with JIT) so that it runs quickly enough to do things traditionally done with C or C++.

Re:Wow!! (1)

the linux geek (799780) | more than 3 years ago | (#36478984)

It's always been enough to "do" things traditionally done with C/C++. The problem is that it does it one or two orders of magnitude slower.

Re:Wow!! (1)

Lunix Nutcase (1092239) | more than 3 years ago | (#36479024)

Great. But do we really need a story for each and every piece of software written? Secondly, having used this decoder it is no where near as performant as a traditional decoder written in C and assembly optimization. It stutters quite badly.

Re:Wow!! (1)

Tarlus (1000874) | more than 3 years ago | (#36478952)

Anything that can phase out the necessity for Flash is welcome news in the web dev community.

So, yeah. Posting snooty Slashdot criticisms as AC is pretty cool too.

Re:Wow!! (1)

Lunix Nutcase (1092239) | more than 3 years ago | (#36479048)

Except that this does absolutely jack and shit to phase out flash for almost anyone. How many people are saying to themselves "Well I'd only get rid of flash but I need a flash-based mp3 decoder!!". Anyone who is going to want to play mp3s on their computer are ether going to use a media player installed on the system rather than using a browser player to play mp3 files off of their hard drive.

It works! (2, Funny)

drsmack1 (698392) | more than 3 years ago | (#36478216)

Actually, my subject makes me seem more excited than I am. I regret any misunderstanding.

Carry on.

another reason to not have to use flash (2)

Nick (109) | more than 3 years ago | (#36478224)

Now if only the pr0n industry would hurry up and get with the program.

mp3? Acrobat! (4, Insightful)

Joce640k (829181) | more than 3 years ago | (#36478240)

I'd say that getting rid of the Acrobat plugin is far more interesting.

Re:mp3? Acrobat! (0)

Anonymous Coward | more than 3 years ago | (#36478384)

That's why I use Chrome for my regular, everyday browsing. No Adobe Reader plugin required!

Re:mp3? Acrobat! (3, Interesting)

ByOhTek (1181381) | more than 3 years ago | (#36478456)

I use foxit. There's also Okular. I probably shouldn't forget [g|k|x]pdf... Plenty of alternatives to acrobat.

Re:mp3? Acrobat! (1)

TerranFury (726743) | more than 3 years ago | (#36478508)

On Windows, Sumatra is the fastest, and by far the best for use with pdflatex. Its printing is poor, so on those occasions when you actually want to print a PDF you probably want Foxit.

Re:mp3? Acrobat! (0)

Anonymous Coward | more than 3 years ago | (#36478510)

Foxit and Okular are alternatives to Adobe Reader, neither is an alternative to Adobe Acrobat, which ultimately doesn't really have any legitimate alternatives.

Re:mp3? Acrobat! (0)

Anonymous Coward | more than 3 years ago | (#36478588)

But a Javascript API means PDFs be much more optimized, because you don't need a software plugin loading and running in the background. And maybe now we can PDF's into a page without iframes, I imagine we will also find a way to serve the text to search engines... this is a pretty useful tool for designers

Re:mp3? Acrobat! (1)

Lunix Nutcase (1092239) | more than 3 years ago | (#36479062)

But a Javascript API means PDFs be much more optimized, because you don't need a software plugin loading and running in the background.

Because Javascript just executes itself through magic and requires no background processes running to compile and run it, right?

Re:mp3? Acrobat! (0)

Anonymous Coward | more than 3 years ago | (#36478662)

And an office suite [webodf.org] in the browser would be nice too.

Re:mp3? Acrobat! (1)

tikram (1262046) | more than 3 years ago | (#36478708)

It actually exists: PDF JS [github.com] is a Javascript-based PDF decoder in development.

Power efficiency??? (1)

goombah99 (560566) | more than 3 years ago | (#36478836)

My guess would be that native plug-ins will always be more efficient on power than java script interpreted code. Not sure where exactly flash lies in that spectrum. It's a power hog compared to most apps but but my guess is flash has a lot of high level functionality running natively (audio and video) with just the command and control being in the flash language.

Re:mp3? Acrobat! (0)

Anonymous Coward | more than 3 years ago | (#36478856)

Easiest way would be just integrate evince into firefox, though that increases bloat some..... there's a windows version of evince now if you want to throw acrobat away once and for all.

Can't HTML5-compatible browsers play MP3s natively (0)

Anonymous Coward | more than 3 years ago | (#36478244)

Can't they?

Re:Can't HTML5-compatible browsers play MP3s nativ (2)

emj (15659) | more than 3 years ago | (#36478346)

MP3 is patented so I'm guessing Mozilla and Opera won't pay the license fees for it..

Re:Can't HTML5-compatible browsers play MP3s nativ (5, Insightful)

Anonymous Coward | more than 3 years ago | (#36478572)

And once agan, just like with H.264, they wouldn't have to pay any license fees if they just used the OS's own media API instead of trying to support specific codecs themselves.

Modern OSs provide such an API for playing audio and video, and some (ie. Mac OS and Windows) even provide licensed proprietary codecs... not to mention that OS-provided codecs often work with things like video drivers to provide hardware acceleration that is transparent to applications. For example, VLC, while awesome, uses a huge amount of my CPU to play 1080p H.264 video, since it's software decoding (possibly with some generic "hardware assist"). On the other hand, Windows Media Player, which uses Microsoft's DirectShow codec which takes advantage of my GeForce card's full H.264 decoding, uses 1% of my CPU to play the same video.

Browsers already make use of other OS-specific features, and this would make the whole codec licensing thing a non-issue for the browser makers, and for the vast majority of users. They need to stop trying to reinvent the wheel. The OS provides services to applications... browsers should use them.

Re:Can't HTML5-compatible browsers play MP3s nativ (2)

Haedrian (1676506) | more than 3 years ago | (#36478724)

A multi-platform browser tightly coupling itself so that a certain subset of the users can't use some of the features. What a good idea.

Re:Can't HTML5-compatible browsers play MP3s nativ (1)

iluvcapra (782887) | more than 3 years ago | (#36478920)

There is this thing called conditional compilation, ya know. Let alone environment-aware code paths.

No Exploits (0)

Anonymous Coward | more than 3 years ago | (#36478250)

The nice thing about a JS based flash / reader replacement is that it would have no obviously exploitable bugs that aren't already exposed via the JS VM anyways.
I'm still skeptical about the performance, though.

The rise of Javascript. (0)

Timmmm (636430) | more than 3 years ago | (#36478256)

All this ultra-fast javascript stuff is cool.... I just wish javascript didn't suck quite so much. It's seems like writing CAD software using bash...

Re:The rise of Javascript. (0)

Anonymous Coward | more than 3 years ago | (#36478358)

I used to hate JavaScript too, but now that I've learned how to actually code with it, I like it a lot. The only scripting language I prefer of JavaScript is Python.

Re:The rise of Javascript. (1)

fuzzyfuzzyfungus (1223518) | more than 3 years ago | (#36478438)

Arguably, with the existence of tools like the "Google web toolkit" and its analogs, which let you do the writing in some other language and then convert it to javascript for deployment in-browser, I suspect that javascript's sins against developers will become somewhat less relevant. Admittedly, it almost certainly isn't what you would design if you were asked to design a platform-independent intermediate representation for complex programs; but it is pretty much the only platform-independent intermediate representation for complex programs that you can be fairly sure that any idiot can "install" just by typing something into a browser bar...

It would have been nice if something better had been standardized; but your options pretty much break down into "javascript" or "assorted architecturally superior; but single-platform and/or deeply fucked in the code quality plugins".

Re:The rise of Javascript. (1)

nschubach (922175) | more than 3 years ago | (#36478496)

javascript's sins against developers will become somewhat less relevant.

Or do you mean: "developer's sins against javascript"?

Just because there is a history of poor programers does not make the language any less interesting/powerful.

Re:The rise of Javascript. (1)

Millennium (2451) | more than 3 years ago | (#36478678)

My guess: yet another person complaining about how JavaScript doesn't use their specific pet paradigms.

Re:The rise of Javascript. (1)

Nadaka (224565) | more than 3 years ago | (#36478702)

I am an expert with javascript at this point, and I can do amazing things with it. But that does not mean that it does not suck. No good IDE's, debugging and validation are a pain. The worst part of all is that its GUI is tied the crapfest that is the modern web browser running any one of a number of almost but not quite entirely unalike implementations of the HTML DOM.

Re:The rise of Javascript. (0)

Anonymous Coward | more than 3 years ago | (#36478746)

I fully agree with all the issues you mentioned... but none of those would have been fixed by selecting another language back then.

Re:The rise of Javascript. (3, Insightful)

TerranFury (726743) | more than 3 years ago | (#36478524)

your options pretty much break down into "javascript" or "assorted architecturally superior; but single-platform and/or deeply fucked in the code quality plugins".

You'd think Java would be filling this role, but it isn't.

Re:The rise of Javascript. (2)

petsounds (593538) | more than 3 years ago | (#36478980)

It would have been nice if something better had been standardized

No, the problem is that the "standard" has barely changed since Javascript was introduced many years ago. The base language, ECMAScript, is shared with Actionscript (Flash's coding language). Except JS still looks like Actionscript from ten years ago. This comes down to the intractability of the standards committee to move forward with any large design changes due to various corporate dissenters, as well as between the ECMAScript committee and W3C. I mean, the first update since *1999* was in 2009, and that was a very, very, very watered down update (based on the few things the committee could agree on) intended to show everyone they'd made progress, but seemed more like the Bring Out Your Dead sketch. More or less, the ECMAScript committee is the software version of the UN. Now they're planning for another update, but they've already said they won't be adding classes or the things that would pull it out of the software dark ages, and there's no release date.

After that internal meltdown, Adobe pulled a Cartman and continued on with Actionscript development. And who can blame them? ECMAScript/Javascript is a disaster. There's many JS apologists out there who think that Javascript is like some kind of totally expressive free jazz ensemble, and that everyone else *just doesn't get it*, man. The real fact is, most of these Javascript developers have only ever worked in Javascript (or PHP...tomato, tomato) and don't see the performance/efficiency gains of moving to a language with modern features. It doesn't help that browsers are putting nitrous and rocket packs on what is effectively a '78 Pinto; it tends to mask the fact that the language is a hurtling fireball of death. Hey, I sympathize with JS developers. They've been working with the same screwdriver for 12 years. You get used to the tool. Actionscript developers went through the same thing with the intro of AS 3.0, when it moved to a strictly-typed environment with many new language features. But you know, Adobe had the cojones to do that and risked pissing off its developers. Unlike the ECMAScript standards committee.

And so here we are sadly, with a language that has becoming the de facto web language, that hasn't changed much at all in 12 years. A language mostly unsuitable for OOP development. A language that's a pain to debug. A language lacking basic, basic features. It's a '78 Pinto with some racing stripes and a jet engine strapped to the top. But it's totally paid off!

Re:The rise of Javascript. (0)

Anonymous Coward | more than 3 years ago | (#36478764)

It's not JavaScript that sucks, it's the dependence DOM that sucks.

JavaScript itself is a very flexible yet powerful language. I love languages such as Clojure (LISPs) and JavaScript. To me they are like LEGOs, they provide you with a small subset of basic powerful building blocks that build on one another. Although JavaScript isn't a LISP, I do appreciate it's simplicity and elegance.
When you deduce the instruction set to a small subset (lamda calc), it makes learning yet another language/environment very easy for an experienced programmer. You can spend the rest of your time designing concepts you know/want to design. The alternate is to spend an eternity learning the quirks, exceptions, short-comings and ways of a language with a verbose syntax.

JavaScript features:
first-class functions meaning functions are treated like primitive objects meaning you can pass functions around as args/params...
closures
functional
anonymous functions
prototype
object oriented (not as powerful as Java but still enough bang for most tasks)
dynamic type (some folks just don't like weakly typed, but I do)

If you are looking for a language with tons of libraries to do x, y and z, JavaScript is probably not it. If you are looking to prototype, design custom creative patterns and work on the Web, JavaScript is a solid choice. NodeJS is a beast that gives you a credible server-side JavaScript environment, however, it's still in development.

As far as the client-side JavaScript is concerned, I don't think people understand the complexities of UI philosophy. JavaScript gets a bad rep because it is the de facto language for the Web and is tied closely to the limitations of the UI advancement in the field of software development.

Some would argue UI should be a black screen with a ticker, but the truth is most folks who use computers are retarded technologically and need guidance. And achieving this is f*** hard. It exposes our lack of understanding of time and space (relativity, events, synchronization, state ...) Anyways, I don't want to diverge into a philosophical rant.

The rise of javascript based malware (0)

Anonymous Coward | more than 3 years ago | (#36478864)

Came along for the ride, & guess what gents: It's about to get WORSE!

Case-in-point/e.g. is "MASS MESH ATTACKS":

http://www.esecurityplanet.com/trends/article.php/3935941/New-Injection-Attack-30000-Websites.htm [esecurityplanet.com]

* Very nasty...

APK

P.S.=> Now - SQLInjection's fairly easy to stop (via Stored Procedures usage, BIND variables usage, & removal of business logic out of front ends in general (if not blocking out redirects as I do to over 1, 444, 444++ known bad sites/servers/domains-hosts as I do via a HOSTS file, or a firewall (or even a TPL for IE, Opera's URLFILTER.INI or FireFox's methods etc.))...

This type though? Quite a bit worse

So - I sort of hate to say "I told you so", but... it furthers the case for my stating to people to LIMIT THEIR USE OF JAVASCRIPT, or be judicious in its usage @ least, as I have said for YEARS here:

http://www.bing.com/search?q=%22HOW+TO+SECURE+Windows+2000%2FXP%22&go=&form=QBRE [bing.com] [bing.com]

nd a decade before it here:

http://www.neowin.net/news/apk-a-to-z-internet-speedup--security-text [neowin.net] [neowin.net]

Man - yes, I know: You NEED javascript for some sites (think e-commerce) but... the second I saw scriptable documents in say, Word & Excel docs + their macros being taken advantage of in VB-Script/VBA? I knew that scripting web HTML documents was going to be the same!

So, do take a read of the 1st URL I posted on Mass Mesh attack & its mechanics, be enlightened folks, & prepare yourselves!

... apk

Re:The rise of javascript based malware (1)

JonySuede (1908576) | more than 3 years ago | (#36479236)

go away host file troll

audio (1)

Anonymous Coward | more than 3 years ago | (#36478258)

How to play mp3s in your browser using HTML5:

<audio src="song.mp3">

What, me worry?

Old News is old (0)

228e2 (934443) | more than 3 years ago | (#36478278)

Sound Manager [schillmania.com] has been doing this for years

Re:Old News is old (0)

Anonymous Coward | more than 3 years ago | (#36478342)

Huh, no. Not at all. Not even close.

Re:Old News is old (1)

madprof (4723) | more than 3 years ago | (#36478386)

No it hasn't. We're talking about a pure JavaScript decoder.

Re:Old News is old (0)

Anonymous Coward | more than 3 years ago | (#36478424)

SoundManager:jsmad::apples:oranges

Re:Old News is old (0)

Anonymous Coward | more than 3 years ago | (#36478482)

Good to see that you can't even bother reading the first FOUR words of that page (under the heading):

"Using HTML5 and Flash..."

I hope Subsonic adds a version of this (2)

Nimey (114278) | more than 3 years ago | (#36478296)

it'd be kind of nice to be able to stream music to my Kindle, which for obvious reasons doesn't have Flash, but does have a rudimentary web browser that's based on WebKit.

Re:I hope Subsonic adds a version of this (-1)

Anonymous Coward | more than 3 years ago | (#36478364)

yes, i've got no doubt that your kindle's shitty little processor will be able to run a browser which is interpreting mp3s through javafuckingscript at the same time without falling over and dying

Re:I hope Subsonic adds a version of this (0)

Anonymous Coward | more than 3 years ago | (#36478884)

Your kindle (assuming 3) can play mp3 already. Check under experimental.

Err (1)

The MAZZTer (911996) | more than 3 years ago | (#36478304)

Chrome (and I'm pretty sure Firefox too) already supports MP3s without plugins, that's the purpose of the audio HTML5 tag. What is the benefit of this that the audio tag doesn't offer?

Re:Err (0)

Anonymous Coward | more than 3 years ago | (#36478368)

FF does not support MP3. MP3 is a proprietary format; in order to support MP3, the Mozilla Foundation would need to purchase a license from Fraunhofer to do so.

Re:Err (1)

amliebsch (724858) | more than 3 years ago | (#36478676)

Great! So now instead of the browser user (or OS user) needing to purchase a license, every website does!

Re:Err (0)

Anonymous Coward | more than 3 years ago | (#36478692)

When does that crap expire, anyway? GIF's patents expired and now we don't need to worry about that crap anymore; how much longer for MP3 decoding?

Re:Err (3, Insightful)

Dishwasha (125561) | more than 3 years ago | (#36478404)

Not having to have a native mp3 decoder codec on your machine. Also being javascript it is theoretically compatible across all platforms that the browser supports, particular those that may not have native mp3 decoder codecs. The HTML5 standard isn't attempting to establish a standard for codecs. Not saying it's worthwhile or anything, just pointing out potential benefits as you requested.

Re:Err (1)

Em Adespoton (792954) | more than 3 years ago | (#36478880)

In theory it's great... in practice, can you name a single environment that supports an HTML5 compliant browser that doesn't already bundle an MP3 codec? And what happens if the available audio is AAC, PCM or FLAC? Also, what does this do to the security model? Could someone write an "MP3" that exploits the javascript decoder?

Re:Err (3, Informative)

BZ (40346) | more than 3 years ago | (#36478872)

Gecko does not support MP3 in HTML for exactly the same reason it doesn't support H.264 in : it's patent-encumbered and you have to pay licensing fees to use it.

In 6 years, when the MP3 patents expire, we'll see.

Re:Err (1)

iluvcapra (782887) | more than 3 years ago | (#36479066)

Gecko does not support MP3 in HTML for exactly the same reason it doesn't support H.264 in : it's patent-encumbered and you have to pay licensing fees to use it.

They could just divert and use the codecs that are included with the OS and already licensed by the OS vendor, be he Microsoft or Apple, and that would cover 90% of cases. However, they probably wouldn't do that because it would make the Linux version less competitive by comparison, because many Linuxes don't have codecs or they're an additional install, and Mozilla would rather have an equal less-functional playing field between the ports of Gecko/Firefox than have versions that competed with each other on features. They also have an ideological commitment to give patented formats no quarter or support, unless they meet some definition of "open" they're comfortable with, like WebM.

Jerky sound (1)

Ricarus (1942244) | more than 3 years ago | (#36478320)

It does work indeed, but the sound is pretty jerky while the browser is loading other websites... Maybe a bug (or feature?) in the FF4 JS scheduler.

Fail (2)

yourlord (473099) | more than 3 years ago | (#36479238)

It's useless on my work laptop running FF4.

The sound is so choppy it's essentially noise, and it causes my FF4 memory footprint to triple. This is on a 1.6GHz Pentium M with 1GB of RAM..

Just another example of our wonderful ability to come up with ways to waste immense amounts of computational power. It's completely ludicrous to write a decoder in such a high level interpreted language.. I was playing mp3's on p200's, and whoever did this managed to waste so much time executing bloat that a 1.6GHz cpu can't plow through it in real time. This thing would probably take 2 weeks to play the 1st minute of a song on a p200.

Yep, we can write an mp3 decoder in javascript. But, should that really be our goal?

Interesting, BUT (1)

vga_init (589198) | more than 3 years ago | (#36478328)

We've had this kind of functionality for a long time. I don't mean through flash, but there has always been some client-side software that decodes and plays back audio files, usually by one plugin or another. A javascript player basically follows the same model of loading some code on the client machine that does the playing. The only difference here is that it's being done using slightly different facilities.

Re:Interesting, BUT (0)

Anonymous Coward | more than 3 years ago | (#36478558)

So you're saying that the only difference is that it's different? Brilliant! :)

why? (1)

TRRosen (720617) | more than 3 years ago | (#36478350)

anyone?

5...4...3...2...1...Slashdotted! (1)

ckthorp (1255134) | more than 3 years ago | (#36478372)

And we're there.

Re:5...4...3...2...1...Slashdotted! (0)

Anonymous Coward | more than 3 years ago | (#36478416)

502 Bad Gateway (nginx)

Re:5...4...3...2...1...Slashdotted! (0)

Anonymous Coward | more than 3 years ago | (#36478468)

The fix is coming: https://twitter.com/#!/nddrylliog/status/81798532717228032

HTML5 and Javascript (The Emperor's New Clothes) (0)

Anonymous Coward | more than 3 years ago | (#36478374)

This nonsense may inexplicably result in feverish night terrors among those in Redmond, but the rest of us - the best of the best?

Not impressed. Not interested. Don't care. Never will...

Re:HTML5 and Javascript (The Emperor's New Clothes (1)

Intron (870560) | more than 3 years ago | (#36478772)

This nonsense may inexplicably result in feverish night terrors among those in Redmond, but the rest of us - the best of the best?

Not impressed. Not interested. Don't care. Never will...

Redmond? ITYM San Jose

It's coming (3, Funny)

TRRosen (720617) | more than 3 years ago | (#36478390)

I'm writing a browser in JavaScript that will run on itself !!!

Re:It's coming (1)

idontgno (624372) | more than 3 years ago | (#36478452)

Hotjava. [wikipedia.org] A browser which could run Java applets, written in Java.

On all the Sun servers I ever administered, I ran that browser just long enough to download and install Mozilla. (Yeah, it was the IE of Unix browsers, for the simple reason that it was pretty limited.)

This cries out for a "'Yo Dawg" joke which I am not going to stoop to make.

Re:It's coming (1)

Em Adespoton (792954) | more than 3 years ago | (#36478918)

Ever used Cyberdog [cyberdog.org] ? You could run HotJava in Cyberdog in HotJava in Cyberdog....

Re:It's coming (0)

Anonymous Coward | more than 3 years ago | (#36479170)

Yo Dawg, we saw that you like browsing the internet so much that we put a web browser inside your browser.

Re:It's coming (1)

maxume (22995) | more than 3 years ago | (#36478686)

Much of the interface of Firefox is written in javascript and XUL.

It's part of the reason the extension ecosystem is so robust.

Super-fast is a bit of a misnomer (2)

Wrath0fb0b (302444) | more than 3 years ago | (#36478392)

It's more like "no longer agonizingly slow" due to herculean (and well-appreciated) efforts to optimize a language that was just not written for speed. You might as well say you upped the voltage to your Prius and say now it's a "super-fast hybrid" -- people that prioritize speed don't buy hybrids and people that buy hybrids obviously didn't consider speed to be a priority.

This is not a criticism, it's just a statement of fact. Even the fastest javascript engines don't even remotely compete with modern interpreted languages (Java, C#), let alone actual bare-metal code (C and friends). Both have their place depending on what you are doing. Having a natively written plugin handle MP3 decoding with a well-defined API seems to me far more logical than expending effort to write it in javascript, especially when it doesn't even run across all browsers yet.

Then again, that's just my $0.02, and as much as I don't think it's a great use of effort, it's damn cool!

Re:Super-fast is a bit of a misnomer (1)

Shados (741919) | more than 3 years ago | (#36478526)

Even the fastest javascript engines don't even remotely compete with modern interpreted languages (Java, C#)

I'd think it would depend which part you're considering. Overall, yeah, you're right. But in parts, at the end modern Javascript engines, just like Java or C#, have just in time compiler and they execute native code. Javascript preemptively has to auto-detect the types, but recent progress allowed engines to do that ahead of time as much as possible. So after that, native code is native code. I wouldn't expect differences to be THAT large. DOM operations would be the majority of the bottleneck.

Re:Super-fast is a bit of a misnomer (1)

shutdown -p now (807394) | more than 3 years ago | (#36479090)

Javascript preemptively has to auto-detect the types, but recent progress allowed engines to do that ahead of time as much as possible.

That's where the catch it. Semantically, JavaScript is dynamically typed. Optimizers have to jump through a lot of hoops to infer types, and even then they often end up with "it's either X or Y here, not sure which", necessitating a runtime check before one of the two optimized versions is chosen. The problem is that it's very easy to write such JavaScript without realizing that, whereas in something like Java or C#, this is explicit in the code of your program in form of "instanceof" and casts.

Re:Super-fast is a bit of a misnomer (1)

Lunix Nutcase (1092239) | more than 3 years ago | (#36478606)

Even the fastest javascript engines don't even remotely compete with modern interpreted languages (Java, C#)

*facepalm* C# is not an interpreted language. The IL is either AOT compiled or JIT compiled to native code at runtime.

Re:Super-fast is a bit of a misnomer (1)

Lunix Nutcase (1092239) | more than 3 years ago | (#36478638)

Now you could write a C# interpreter if you want but that is not how C# code is executed. It is always compiled whether it be AOT or through a JIT compiler.

Re:Super-fast is a bit of a misnomer (1)

Nadaka (224565) | more than 3 years ago | (#36478934)

Same for Java, but the JVM happens to be a lot more mature than the CLR and generally runs faster.

Re:Super-fast is a bit of a misnomer (1)

Lunix Nutcase (1092239) | more than 3 years ago | (#36479094)

Sure, Java does now. But originally Java was purely interpreted. C# has NEVER been interpreted.

Re:Super-fast is a bit of a misnomer (1)

djdanlib (732853) | more than 3 years ago | (#36478752)

New $engine: Now with more jiggawatts! Hey, I have an idea. Let's also re-invent the multithreading wheel by putting a totally new code you guise scheduler into our awesome for real browser. That ought to run nice and smooth... wait, the OS and that other site that pings the twittlers is pre-empting it, so now my mp3 is all skippy.

My point is: Software that needs to keep a buffer filled in real-time should probably not be written in Javascript. While you CAN do it under ideal circumstances (powerful enough CPU, low system load, enough RAM, no other websites open contending for the browser's JS engine's time) there are far better ways to do such a thing that can guarantee the CPU time you need. You know, like all those other audio plugins and standalone apps, which have more direct access to the audio hardware.

I do agree though that it's pretty cool to see someone actually try something so brain-wrecking as to implement mp3 decoding in Javascript. I wonder what the licensing situation is when that happens?

Wrong. (1)

Anonymous Coward | more than 3 years ago | (#36478802)

Languages are not slow. Algorithms are slow. Execution environments are slow. There is nothing fundamental about JavaScript that makes it slow. Until recently, browsers executed it inefficiently and with few optimizations.

Yes (0)

Anonymous Coward | more than 3 years ago | (#36478406)

Looks like finnaly grooveshark guys will be able to depoy iphones and ipads web apps.

Slashdotted! (0)

Anonymous Coward | more than 3 years ago | (#36478444)

That was quick.

LulzSecuritys' website example? (0)

Anonymous Coward | more than 3 years ago | (#36478462)

Is this the java mp3 player that is in the LulzSec website?

tag? (0)

Anonymous Coward | more than 3 years ago | (#36478472)

wait, isn't that what the HTML5 tag is for?

Just because you can, doesn't mean you should. (0)

Alex Belits (437) | more than 3 years ago | (#36478480)

Now, if AutoCAD was ported to Javascript and worked on non-Microsoft systems...

To think of it, it probably would run faster and had better UI that way.

Re:Just because you can, doesn't mean you should. (1)

Pope (17780) | more than 3 years ago | (#36479242)

AutoCad runs on OS X!

Is this news? (1)

NeoXon (1718618) | more than 3 years ago | (#36478504)

We have already have html5 h.264 video players for more than a year. Why is it news that from now on we can not only play videos (with sound, probably in mp3 format), but even sound without video?

Re:Is this news? (1)

NeoXon (1718618) | more than 3 years ago | (#36478554)

Sorry, I got the point. html5 video players use h.264 decoders that are most probably written in assembly or C, whilst this is a pure javascript based mp3 decoder.

Answer to "Why" (0)

Anonymous Coward | more than 3 years ago | (#36478516)

I've seen a few threads started to ask: why?

Here are some ideas:

1. Convert MP3 files to another format (WAV, OGG, etc)
2. Load MP3s as sound resources (for creating sound editors, or DAWs, for example)
3. Server-side JavaScript is becoming popular (Node.js), and this provides servers with a way for decoding MP3 files (perhaps from user upload)
4. Games that use MP3s as part of the experience (analyzing beats, synching events in games to beats, etc)

Perhaps other stuff... this was off the top of my head.

Are there other ways to do these things? Of course! But now we can also do them on the web :-).

grooveshark (0)

Anonymous Coward | more than 3 years ago | (#36478560)

Grooveshark need to get this and make ipad and iphone webapps. No more jailbreak. uhuu.

Great... if it worked. (0)

Anonymous Coward | more than 3 years ago | (#36478616)

Time to debug Javascript!!!

Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; InfoPath.2; .NET4.0C; .NET4.0E)
Timestamp: Fri, 17 Jun 2011 19:17:10 UTC

Message: 'Mad' is undefined
Line: 14
Char: 1
Code: 0
URI: http://assets.jsmad.org/src/rq_table.js

Message: 'Mad' is undefined
Line: 1
Char: 1
Code: 0
URI: http://assets.jsmad.org/src/imdct_s.js

Message: 'OfficialFM' is undefined
Line: 18
Char: 1
Code: 0
URI: http://assets.jsmad.org/mhd.js

Message: 'ofm' is null or not an object
Line: 34
Char: 3
Code: 0
URI: http://assets.jsmad.org/mhd.js

HTML5 can already do this (1)

OverTheGeicoE (1743174) | more than 3 years ago | (#36478806)

HTML5 browsers already have support for audio file playback, depending on the browser. For example, Chrome can play MP3 and Ogg Vorbis files. Firefox 4 can play Ogg Vorbis but not MP3 due to licensing issues. Safari can do MP3 natively; Ogg Vorbis requires extensions from Xiph.org that are easily installable.

Re:HTML5 can already do this (0)

Anonymous Coward | more than 3 years ago | (#36478870)

I think you answered your own question. Besides missing the point entirely. Oh and also, please read this: http://news.ycombinator.com/item?id=2665607

Ugh. (1)

Dracos (107777) | more than 3 years ago | (#36478824)

This will allow unthinking people another way to implement one of the things listed in every bad practices top ten list for the past decade: websites that make noise.

Java, anyone? (2)

xded (1046894) | more than 3 years ago | (#36478914)

Can somebody please remind me why we moved from Java applets to Javascript applets?

It can't be just a matter of tight browser-VM integration or GPLiness.

Why are we coding the whole thing all over again?

Re:Java, anyone? (2)

shutdown -p now (807394) | more than 3 years ago | (#36479110)

Java applets took several seconds to load, but more importantly, that was visible to the user (remember those ugly gray rectangles)?

That, and they have their own sandbox, not particularly well integrated with HTML DOM.

tag? (0)

Anonymous Coward | more than 3 years ago | (#36478982)

Eh... why not use the tag? it's in HTML5 ...

bettter than I tought (3, Interesting)

JonySuede (1908576) | more than 3 years ago | (#36479064)

I was worried about the cpu consumption of this and it only took between 7 and 13 % of one q6600 core on firefox 7.0a1 nightly

Cool hack (2)

McBeer (714119) | more than 3 years ago | (#36479096)

It's cool that somebody got this working. That said, looking at this sort of things further enforces my belief that we're all barking up the wrong tree by going with JS+html as client side development environment of the future. Compared to a Silverlight solution, the JS player is 3.5 times larger (535kb vs 154kb), uses about 3.6 times as much CPU power (25% vs 7%), and has to have significant modifications to work in multiple browsers. Not really progress.
Load More Comments
Slashdot Account

Need an Account?

Forgot your password?

Don't worry, we never post anything without your permission.

Submission Text Formatting Tips

We support a small subset of HTML, namely these tags:

  • b
  • i
  • p
  • br
  • a
  • ol
  • ul
  • li
  • dl
  • dt
  • dd
  • em
  • strong
  • tt
  • blockquote
  • div
  • quote
  • ecode

"ecode" can be used for code snippets, for example:

<ecode>    while(1) { do_something(); } </ecode>
Create a Slashdot Account

Loading...