How to convert an audio file into raw binary data in javascript?
-
No, I need to do it in javascriptRatan– Ratan2011-07-16 06:58:38 +00:00Commented Jul 16, 2011 at 6:58
-
2Uh... what for? A bit of context would be good. What do you want to do with the raw binary data?Dan F– Dan F2011-07-16 07:00:54 +00:00Commented Jul 16, 2011 at 7:00
-
Is this from a web browser or using a local javascript interpreter like rhino? If it's from a web browser, you need to edit your question and say which one, since the mechanisms to allow local file access depend on the browser. Or if your web browser is running locally you should mention that too.ninjagecko– ninjagecko2011-07-16 07:05:43 +00:00Commented Jul 16, 2011 at 7:05
-
1possible duplicate of Local file access with javascriptninjagecko– ninjagecko2011-07-16 07:13:25 +00:00Commented Jul 16, 2011 at 7:13
-
if you end up using Flash, there is stackoverflow.com/questions/1243912/read-local-file-in-flashninjagecko– ninjagecko2011-07-16 07:14:58 +00:00Commented Jul 16, 2011 at 7:14
|
Show 1 more comment
2 Answers
Use the File API.
With Blob data, you can get a Uint8Array or whatever other typed array you like. Here's a link to more info about Uint8Arrays.
You might also be interested in this.
2 Comments
ninjagecko
ooh, thank you! nice to know, I missed this while looking at new features
beatgammit
I've been messing with binary data lately in JavaScript. Just happened to know a few good resources.
You need to create handler that will do the job the javascript will only call the handler with the right parameters according to what you need look at jquery ajax call: http://api.jquery.com/jQuery.ajax/