How do I use jsmad? - javascript

jsmad is a new JavaScript based MP3 decoder (GitHub, demo), but it seems to be lacking any documentation at all. I can't really work out what a lot of the demo is doing either, and the actual JavaScript seems minified.
Is anyone able to write up some documentation here for someone that just wants to play MP3 audio, please? It looks like a few people are giving up because of the lack of documentation.

I sent an email over to Amos Wenger, one of the developers for jsmad, who had this to say:
Hi there!
Yes, we are very much aware of the lack of documentation. There are
two reasons for that:
First, the bad news: jsmad only does MP3 -> raw audio, whereas people
expect a much more complete piece of software (similar to HTML5 audio,
which does HTTP streaming, buffering, decoding, audio sink, UI
controls, events etc.) As I mentioned in my jsmad slides at jsconf.eu,
we need to flesh out several other components before we have a real
competitor for Flash-based audio playback on your website. So in a
way, the lack of docs is because we don't want end-users to start
deploying it on their website just yet! It's not ready for prime time.
At ofmlabs (Official.fm's R&D division, among other stuff) we had a
lot of internal projects going on, and have only recently been able to
re-focus on open source. So that's the good news: we'll have more time
to spend on stuff like jsmad, and will probably work on the missing
parts (buffering, proper demuxing - probably via aurora.js, etc.)
As for 'docs', there are a little in my slides (mentioned above), and
well mhd.js is not minified so you can always take a look at
http://jsmad.org/mhd.js ;)
Cheers, Amos
So it looks like jsmad isn't up for public use just yet, but we can look forward to further support in the future. :)

Related

How can I port an Adobe Flash game to JavaScript?

So there's this simple game, http://www.zigzagphilosophy.com/, that I've enjoyed playing around with every once in a while for a few years. However, I recently learned it was written in Adobe Flash, meaning its unplayable on most browsers currently and will be completely unplayable in a few months. Since it's a simple game, I decided I would try to port it to JavaScript by looking at its source code. However, the file index.swf that makes up the game simply downloads to my computer, where it cannot be opened by any means. How would I go about opening that file and being able to read the source code in a compiled form (e.g., looking like lines of code instead of just data)?
i have very little experience with javascript, though i read through the comments on your question and as you don't mind rewriting it yourself, i can recommend an swf decompiler for you. it's called jpexs flash decompiler and is accessible here. pretty sure it requires java and the gui looks pretty crappy but i can tell you from personal experience that it works well.
you can extract audio, images, basically whatever's there, as well as exporting to an fla or exe file.
i'm sorry i couldn't be of any more help than this, but i hope what i've written is at least useful :)

Specify different voices for specific content in web page

I have tried to find information about writing web pages that will be accessible to blind people and haven't found much useful information yet. Specifically, what I'm looking for is how to give specific instructions to screen readers in general, about how to read the content of my pages. I know that overriding user settings for a screen reader could be perceived as a type of annoyance but, the content I'm looking to make accessible is poetry, plays, stories, and other types of creative writing. Being that there are often many different characters speaking within the same document, it would be great if there were a way for me to specify different characteristics about the screen readers voice in order to allow the blind person (or anyone really) the opportunity to audibly distinguish the separate speaking characters. Right now, what I'm doing is using a narrator to tell the listener who is speaking, which is very unnatural and distracting.
An example of content could be:
Brenda: Hey Jimmy! What's up?
Jimmy: Brenda! Look look! You sound like a lady and I sound like a
man!
Slow Kid: Ooh... and I sound very very slow...
So, is there any way for me to define tags, attributes, or somehow attach a script to elements in order to change the speaking voice on specific content in a web page? Is there a standard defined that I can work with in order to present the spoken text in a similar fashion in IE and Firefox? What about native browser support, I've seen a few plugins for screen reading but I'm curious if there is any text to speech support built into IE or Firefox so I don't have to install a plugin.
The only direction I could point you in at the moment is http://www.w3.org/TR/CSS21/aural.html and http://www.w3.org/TR/css3-speech/#aural-model.
There aren't a lot of truly helpful resource in the wild for the optimisation of assistive technologies like screen readers. But perhaps some other members, more knowledgeable than I, might be able to provide greater assistance.
I am facing a similar challenge. (I want to distinguish the semantics of different kinds of content using voice 'character').
I'm quite fond of eSpeak, and have used it extensively for prototyping spoken content before we get the voice actors in. I therefore find speak.js a very interesting piece of work.
However, I would be wary of a roll-your-own solution for accessibility because I know that screenreader users often have very specific preferences about speech settings (speed, pitch, timbre, gender, accent etc.)
If you do go down the path you propose, make sure your users can tweak the settings easily (as they can with most screenreader software), and that those settings are saved between visits (e.g. with a cookie). This seems like a lot of work to do properly. If you have the time and budget, then great!
Now I'm off to visit those css3-speech links.
Migrating the solution from the question to an answer:
A hackers way of doing it in Firefox:
Here's something slightly promising... "speak.js" to quote:
"speak.js is a port of eSpeak, an open source speech synthesizer, from
C++ to JavaScript using Emscripten."
An article about speak.js on Mozilla's Dev blog.
Source on speak.js' GitHub page: kripken/speak.js quoting from
the readme.markdown:
"Options
You can also specify some options with calling speak(), by doing
speak('hello world', { option1: value1, option2: value2 .. })
available options are:
amplitude: How loud the voice will be (default: 100)
pitch: The voice pitch (default: 50)
speed: The speed at which to talk (words per minute) (default: 175)
voice: Which voice to use
(for a non-default voice, requires you to build speak.js
to include the proper data. See Language Support
below) (default: en/en-us)
wordgap: Additional gap between words in 10 ms units (default: 0)
noWorker: Do not use a web worker (see below in 'Architecture')
For example
speak('hello world', { pitch: 100 })
will talk in a very high-pitched voice."
Note:
This only works in Firefox at the moment. While it's not exactly what
I was looking for, it seems entirely possible to use JavaScript to
parse through the HTML and use attributes to trigger the "speak"
command with any options I'd like. This will take a little work but,
in the end I might end up with a bot that can try to read a page in
context!

How can I do video capture in the browser?

Ideally what I was initially looking for is an implementation of the HTML5 Media Capture API with a polyfill rolling back to Flash, however, my research has concluded that the API is in its infancy and is yet to be taken up by any of the major vendors, and in addition to that, Flash means for doing what I need seem scarce.
I need to be able to take webcam input from a camera, show a live preview, record, and play back that recording, nothing more, no upload to server necessary, all local.
Are there any decent Flash solutions? Or other means of achieving this?
I have found a lot of references to Red5, to clarify, would that refer to this: http://www.red5-recorder.com? Is this really the tool to use or are there better alternatives?
I ended up using http://nimbb.com for this, the free version has some limitations but gives the basic functionality needed met my criteria for the project.
In addition to my needs it also allows users to upload recordings to the Nimbb website and share over social, which can't hurt!
I too am looking around for the same feature. The best I found was Open-Tok, they do all the work
http://www.tokbox.com/opentok/plugnplay#VideoMessages
My problem is my site is adult in nature, so the people recording the videos would more than likely be naked. This is against the terms of service for Open-Tok I do like their offering.

What are good JS libraries for game dev? (HTML5)

If i decide to write a simple game both text and graphical (2d) what libs may i use? Assuming we are using a HTML5 compatible browser.
The main things i can think of
Rendering text on screen
Animating sprites (using images/css)
Input (capturing the arrow keys and getting relative mouse positions)
Perhaps some preloading resource or dynamically loading resources and choosing order
Sound (but i am unsure how important this will be to me at first). Perhaps with mixing and chaining sounds or looping forever until stop.
Networking (low priority) to connect a user to another or to continuously GET data without multiple request (i know this exist but i dont know how easy it is to setup or use. But this isnt important to me. Its for the question).
Well.... there's Rocket Engine. I haven't used it, but it appears (on the surface) to do much of what you want.
I'd also recommend HTML5 Gamer, a blog on the issues for building games in HTML5/JS
GameJs does this:
Sprites, SpriteGroups
Text rendering
input handling (key/mouse)
collision detection
sound
resource preloading
http://gamejs.org, Disclaimer: I'm dev of GameJs.
The stuff above works good and I did games with it. The API is similar to http://PyGame.org which some people like a lot.
Networking is planned.
If you're familiar with jQuery then gamequery is a good one to try. Here's a great demo of what you can do with it: brainsnackers.
Here are some of the features:
multi layer-sprite animations sprite
hierarchies (grouping) collision
detection swappable sound support
periodic callbacks keyboard state
polling free and open source license
Check out cake js. It's been around a long time and it's really nice to use - especially if you've used actionscript before.
The http://js1k.com contest just ended and the 2D platform game Legend Of The Bouncing Beholder (by marijnjh) was the winning entry. You might want to look over the source since it would provide a very easy to grasp overview of sidescrollers without needing to read lots of code.
Another good one is the two-player crazy pong which is a lot of fun.
Plus, 1kb games are just awesome.
i would use RenderEngine i think it has all you need and solves one of the most important problems that would be collision detection, and it also has sprite support...
Tutorial <- this is a great tutorial i found
i hope this helps
I can recommend Cometd for using ajax push networking (ie. comet)
What about createJS (createjs.com) or melonJS (melonjs.github.io/tutorial)?
CreateJS has great support for those items you mentioned, not so sure about networking though.
MelonJS has native support for reading Tiled tilemap .tmx files.

When do you really need to use Flash?

There are a lot of flash effects that can be achieved with jQuery.So when do you really need to use Flash instead of javascript?
Quite simply, when you need to do something that jQuery can't do. This includes video/audio, complex animations, cross-browser vector graphics, multi-file uploads, etc. The list goes on.
Of course, you could always write your website in HTML/jQuery and only use Flash for the necessary parts. That way it's a win-win situation, and your application degrades gracefully for those that don't have Flash.
Flash should be considered a 'last resort' in my opinion, and it's one that is shared with many others. Some people use flashblock, so they'll never see it. Users on mobile devices won't see it either.
There are few areas left for flash currently, and HTML5 will likely eliminate one of them.
Only when I have no choice...or asked by my boss
Flash features:
Compiled byte code versus interpreted
2D and 3D geometry libraries
Animation and audio libraries
Total control over Fonts/layout/design
Binary network calls as well as Xml and JSON
I'm not crazy about Flash for brochure or forms sites but it sure is nice for online games.
If your dislike of Flash comes from a dislike of Adobe, check out the Haxe programming language. It can target the Flash runtime.
if you need something which cant be done by JQuery then go for flash. otherwise stick to JQuery.
It is good for times when you want to make screen scraping harder. A major real estate site I worked with used Flash to make it much more difficult for a competitor to scrape agent data.
Sure this could of been done with images but Flash was just easier for us to implement.
Flex, which runs on top of Flash, is a very nice platform for building applications. In my opinion, it's far better than trying to coerce HTML and JavaScript into being a platform for GUIs. Also, if you have a graphics designer, they will have a much easier time designing the look and feel with the WYSIWYG tools available in the Adobe tools.
However, for traditional web sites, I'd stick with HTML/CSS/JavaScript. Don't use Flash if all you need is simple effects.
Flash is a frontend tool that should be considered when there are requirements that make a project much easier to develop. I know that there are alot of Flash haters, and I understand the reasons. However, each developer should use the tools available to them that would allow the job to get done effectively and quickly. PHP, HTML and JS have its limits, just like AS3 does as well, but each has something that can help deliver a project.

Categories