Audio manipulation using node.js - javascript

My team has been using the Web Audio API/Getusermedia in a product and we are going really well with our chrome and firefox users. But we still have a large base of users that we would love to reach, but due to technology barriers, we still can't (mostly, those are IE users), as their main browser does not support the technology, and they do not or can not change to a modern browser.
We are planning to get to those users, but we don't want to go to Flash, Flex, Silverlight or anything similar.
So, thinking about solutions, I thought that maybe I could pass by this difficulty if I moved the audio manipulation, from the browser to the server. NodeJS was the first answer when trying to figure out how to do it.
Would it be possible to be done using NodeJS? Are there any libraries available that would help us accomplish this? Are there any other technologies that would allow me to do this?
Thanks anyone that could help.

It could easily be done. Node is simply an IO engine designed for rapid response. If it needs to happen in real time then I imagine latency would be a usability-breaking issue due to networking restraints. If it doesn't, then I think it would be a great solution! :)
Either way here are a couple related resources
https://www.npmjs.org/package/webrtc.io <- latency optimization library intended for work with media streams
http://wac.ircam.fr/ an upcoming conference (Jan 2015) dedicated to the types of problems you are dealing with.
http://www.sitepoint.com/5-libraries-html5-audio-api/ A few web libraries for use with audio. #3 and #4 look like they are related to what you are trying to do

You can try using this (is in development):
Node Web Audio API
https://github.com/sebpiq/node-web-audio-api
Installation
npm install web-audio-api
Demo
node test/manual-testing/AudioContext-sound-output.js

Related

Protecting Apps with Apache Cordova MS VS Extension on App Stores

Just have a question about apps that are uploaded on the Windows Store, Andriod Store, and Apple Store. I have never built an App before for any of the three stores, but the Multi Hybrid Extension for Visual Studio seems to be a great start to cover all three Platforms.
How do I protect my code for apps that are uploaded to the three stores? The core development for the Apache Cordova extension is done in HTML5 and Javascript. On a regular HTML / Javascript website, the end user can simply right click and View Source of the page and see all the code I've written.
My question is, how is this protected for apps that are uploaded to the app store? Will someone be able to reverse engineer my application and get the code and simply re-sell it?
Thank you all for your time
You want to, develop once, deploy many. Then, you’ll want to use HTML5 to do it.
You can use Apache Cordova directly, but you’ll want to use a service like Telerik AppBuilder, Adobe Phonegap or Intel XDK.
Regarding your question, your best bet is to use a good JavaScript source code obfuscation service to protect your sources before publishing. There is no such thing as a 100% full proof solution when it comes to JavaScript obfuscation, but professional tools such as JScrambler can take you a long way. At least JScrambler I know that it supports Mobile and HTML5, which is good because they make sure the resulting code is compliant.
There are other tools, even free ones. But be careful though, there are tons of other tools that do obfuscation, encoding/packing or minfication that seem to provide protection, but are reversed in a few minutes. So, unless you really know how to tell the difference, I recommend that you rely on a professional service.

TCP/IP socket communication in HTML5

I'd like to know if my idea is even possible, but based on everything I've searched for so far, it seems like it's not possible. I would love to hear what the experts think.
Goal: Interface with laboratory equipment via TCP/IP sockets using HTML/Javascript.
One problem is that I have no control to program the server. Therefore, I can't use HTML5 websockets. The vendor has not implemented websockets. The equipment server waits for a socket connection, and then communicates via API.
Because HTML5 and Javascript are relatively OS-independent and are 'built' for user display, I'd like to create a browser-based program. I've found related questions and answers on SO, but they are older now, so I'm wondering what is the current technology.
Thanks in advance, and please let me know if you have any questions.
The W3C published a first draft for a 'Raw Socket' standard:
http://www.w3.org/TR/raw-sockets/
I think this might be what you're looking for, but I wouldn't count on it being implemented by vendors in the near future, since it's only a first draft.
Another thing I found out while searching, is that chrome apparently enables tcp/ip communications in extensions (did not check this myself, so can't gurantee):
http://developer.chrome.com/apps/app_network.html
If possible, you might consider writing a chrome extension (though it's not really "HTML5").
I read this as needing essentially a telnet session to your equipment.
Currently, there's no way to do this from the browser without a plugin.
This question has some similar discussion: Best way to display high-speed data from a telnet interface on a web view?
Why not use the server where the HTML5/Javascript code is created. To create to connection to the device and convert this to something you can use, like websockets.

Adding audio/video calls in HTML5 app

I'm working on HTML5 app that lets several users to work on one document. I need to add a possibility for users (editing the same document) to talk to each other. And I just don't know how to start with that. Here are my questions
Is there an HTML5 lib allowing to transfer sound from microphone between clients?
What about streaming video from camera?
What is an easiest server-side solution for that?
Any thoughts are strongly appreciated! So don't be shy! :)
UPD: please note that I need an abbility for more then two users to talk.
For this you can use WebRTC.
However, this is a very young and unfinished technology that as already stated is currently available only in Chrome stable and Firefox beta. This means there will probably come changes to the current spec, something to be aware of in case of early implementation. But it allow you to use video and audio communication directly in the browser.
Quick-start here:
http://www.html5rocks.com/en/tutorials/webrtc/basics/
Other options are Flash based plugins such as flash-videoio. This is an open source plugin but will naturally require Adobe Flash installed. This may or may not be a problem depending on the company's security policy.
For technical details on implementation please see examples on the provided links.
For many-to-many you can use either:
"Mesh" - everybody connects to everybody. This however is costly on CPU and mobiles are often left out.
"Star" - everybody goes through the most capable device. However, with many connections this will soon run slow for the device handling all connections.
MCU. Specialized server to handle all connections. If mixes audio and video and handles drop-outs as well without affecting the other callers.
Examples of MCU's:
http://sourceforge.net/projects/mcumediaserver/ (open source)
http://www.medooze.com/products/mcu.aspx (commercial)
you are searching for navigator.getUserMedia()
that allows the various users to share video audio and data.
the support is very low... only chrome and the latest verions of opera and firefox support it.
and totally no support on mobile devices... maybe in the next android chrome... dunno
as there is much to talk about and i have no clue on how u wanna setup everything i suggest u read a little more about that on the urls...
http://caniuse.com/stream
http://www.html5rocks.com/en/tutorials/getusermedia/intro/
http://dev.w3.org/2011/webrtc/editor/getusermedia.html
https://developer.mozilla.org/en-US/docs/WebRTC/navigator.getUserMedia
http://my.opera.com/core/blog/2011/03/23/webcam-orientation-preview
http://simpl.info/getusermedia/
and SERVERSIDE solution nahh... thats not a good solution
clientside is the way to go.
Not sure if you're required to do it yourself from scratch or are able to use third party libraries/tools.
In which case I would recommend using Tokbox which has support for WebRTC and SDK for iOS.
Their API is simple and easy to use.

Interfacing a midi keyboard or other real-time midi input with javascript?

I want to create a simple visualization tool that would allow to represent my playing a midi keyboard on the screen. I play a relatively novel instrument type, called the harmonic table:
http://en.wikipedia.org/wiki/Harmonic_table_note_layout
http://www.soundonsound.com/newspix/image/axis49.jpg
And want to build tools to ease their use and to teach others how to use them.
However, I can't find a good way to get get midi into javascript environment (or, for that matter, Flash, or Java without a large helping of jiggery-pokery slightly beyond my reach, and the use of code from what look to be rather stale and abandoned open source projects. Neither language I am too enthused to work in for this project in any case).
Is there a suitable library or application that I have missed, that will enable me to do this?
While searching around for another solution (Flash based, using the functions of the Red5 Open source flash server - really ugly, but I'm desperate at this point) I found someone who had done exactly what I needed using Java to interface with the hardware. They had started with a flash solution and recently ported to Javascript. Yay!
http://www.abumarkub.net/abublog/?p=505
Don't let the caveats about 'proof of concept' discourage you: the basic functionality appears solid, at least with everything I have been able to throw at it.
So now I'm on my way, and so is anyone else who want to build javascript based midi interfaces/synths/what have you.
I can manipulate real-time midi in javascript! This is much better than flying cars and jetboots.
I have made a NPAPI browser plugin that lets you communicate in Javascript with MIDI devices.
Currently it works on OSX in Chrome and Safari, and on Windows in Chrome.
I am working on support for other browsers (Firefox, Internet Explorer) and other operating systems (Linux, Android, iOs)
See: http://abumarkub.net/abublog/?p=754
EDIT:
I recently published this module https://github.com/hems/midi2funk it's a node.js module that listens to midi and broadcast it through socket.io so if you have the luxury of running a node.js service locally together with your client side you might get some fun out of it...
~~~~~
A few others handy links, i kinda ordered in what i think would be most important for you:
midibridge.js - A Javascript API for interacting with MIDI devices
midi.js sequencing in javascript
jasmid - A Javascript MIDI file reader and synthesiser
Second web midi api working draft published - 11/12/2012
Jazz Soft - MIDI IN / OUT PLUGIN FOR BROWSER
edit: just realised the thread is old, hopefully the links will help someone ( :
The Web MIDI API is now real in Google Chrome 43+. I even wrote a library to make it easier to work with it. If you are still interested and do not care that it currently only works in Chrome, check it out: https://github.com/cotejp/webmidi
Nowadays browsers supports MIDI listening. All you need is
navigator.requestMIDIAccess().then(requestMIDIAccessSuccess, requestMIDIAccessFailure);
and listen keys
function requestMIDIAccessSuccess(midi) {
var inputs = midi.inputs.values();
for (var input = inputs.next(); input && !input.done; input = inputs.next()) {
console.log('midi input', input);
input.value.onmidimessage = midiOnMIDImessage;
}
midi.onstatechange = midiOnStateChange;
}
See working example here
Most browsers don't allow access to any hardware except the keyboard and mouse - for obvious security reasons, so it's unlikely that you could access a midi device unless it's plugged in as one of those devices.
You could try finding a driver that would translate midi output to key presses, and then deal with those in the browser, but this would be a single-computer solution only.
I am really excited by the upcoming Web MIDI API. As far as I know, its only under discussion and hasn't made it into any browsers yet.
Combined with the Web Audio API which has started to be implemented in some browsers already, it will be possible to have complete software synthesis in the browser. Exciting times.
Since Web MIDI API is still a draft, there is no way of direct access to MIDI events in the browser.
A simple workaround could be to write a small server where you register MIDI events and communicate them to your javascript using a websocket. This could be done quite easily in Python.

JavaScript multithreading in IE6?

Is JavaScript multithreading possible in IE6?
Are there any third party libraries for this?
JavaScript does not support native multithreading in current web browsers. Even if it did, I bet IE 6 wouldn't have supported it :)
Running your scripts in multiple iframes could be one workaround, as Jason Kester suggested in another answer.
In addition, for modern browsers you might be interested in checking out Web Workers, but this is definitely something out of the IE 6's league:
Stack Overflow: JavaScript and Threads
Dive into HTML 5: Web Workers
Firefox 3.5: Web Workers in action
John Resig: Computing with JavaScript Web Workers
Run your tasks in IFrames
Assuming you're talking about multitasking on the client side, you can open n frames on your page, each pointed to a page on your domain.
There are lots of ways to architect it from there. Probably the easiest would be to have a single .js include that you run from each frame. It phones home to parent.readyToGo() or whatever, and gets some work assigned. The worker methods can call something like parent.taskFinished() to report when they're done.
Most importantly, don't listen to anybody telling you not to run your mission critical multithreaded javascript application on IE6. I'm sure you have good reasons:)
There is no way - definitely not in IE6. You can fake it by using lots of window.setTimeout()s.
See Why doesn't JavaScript support multithreading?
Well, HTML5 is coming up with Web-Workers. But i highly doubt there is a library which creates a wrapper for using it in IE6.
Does my browser support web workers?
Google Gears is a plugin that works with IE6 and includes something called WorkerPools. Google Gears does not seem like it is being very actively developed anymore, because it has tried to move most of the ideas of Gears into HTML5. WorkerPools are basically background processes that do not share state and only communicate through messages. In HTML5 this has turned into WebWorkers. You can find more info here: http://code.google.com/apis/gears/api_workerpool.html
If you merely want to write synchronous code and thus avoid having to deal with writing event handlers all over the place, you can try: Strands

Categories

Resources