Convert wav data to flac data using JS - javascript

I have a JS blob of WAV Data which I need to convert to FLAC data which I need to send an AJAX request to my localhost Django server where I want to use the Google Speech API.
The important thing here is that I don't want to store any kind of audio data anywhere on the server (So I think I should refrain from using commands which include "input.wav" and "output.flac")
I tried using pySoX but didn't know how to use without providing the paths of input and output files.
I am open to any other strategies as I don't know how this is done conventionally.

Related

storing info as a JSON file on a server

So I have information i need to save. I am using a JavaScript object then I store the info in a JSON file.
But I want to put my project on a server and run it. but currently I am using fs to read and write data.
how would i do that on a server
You can have the JSON file in the server and read/write to it the same way you are doing locally, it makes no difference.
That said, I'd recommend using something like http://npmjs.com/package/json-server to make it work like an actual server API.

REST Api in node to send audio file along with json data

I have a REST API built using node and express. Now i need to send the following data in one http request:
jSON Data
One Audio File to be playable on client
On the client side,i have a simple audio player that requires audio file path as input to play the file. Now i don't understand the whole flow. How will i send the file from API and how the client consume it?
The file is located in file system of the server. Point me in the right direction !!
Express doesn't appear to support multipart responses. I'd instead recommend returning JSON that includes a URL to the audio file to play. Different routes on your Express server can send the JSON and the audio files. This approach will require two different HTTP requests from your client, but it will also be far more compatible with different browsers, since not all of them deal with HTTP multipart responses the same.
It is very different type of data you trying to deliver to client.
Much better and scalable will be to have two separate requests. One for JSON data that will contain details over where Audio is located (file name?). RESTful dont have to answer with only JSON or XML data, but it is highly recommended though.
Then another request to node, that will respond with streaming audio data, please check this good question and answers.
If you need just to send audio file without live streaming, then read this: Nodejs send file in response

implementing server-side after REQUEST sent

Right now, i found out that if i were to put this url to my browser, a .csv file will be downloaded to my Downloads folder on My Computer, where the word YHOO is the stock symbol of Yahoo
http://ichart.finance.yahoo.com/table.csv?s=YHOO&d=0&e=28&f=2010&g=d&a=3&b=12&c=1996&ignore=.csv
Is there any way where I can implement the above action on my own personal-use RESTful website where
on a client-side GUI, the user inputs symbol
on client-side, a request URL is constructed with the symbol
client-side sends the request URL to the browser (similar to the action i described above)
browser downloads a file to a location on a server (dropbox / EC2)
.csv file is converted to json object on server
json object is returned to client
How can i do this, and which framework is recommended for high performance. i am thinking of NodeJS and Mongoose.
I'm interpreting your question like this:
on a browser or GUI, the user inputs symbol
on server-side, a request URL is constructed with the symbol
server-side sends the request URL to the above url (similar to the action i described above)
server-side downloads a file to a location on the server or remote repository(dropbox / EC2)
.csv file is converted to a json object on the server
the server then returns the json object is returned to the browser or GUI
If so, then the answer to your question is yes, this is possible albeit a bit tricky if you want to to work properly.
This doesn't have to be Node.js specific. You don't need Node.js nor Mongoose for this since you're not saving the CSV to the harddrive but just going to be an interrim transporter.
Basically you can in your "servlet" issue a POST call to another url and fetch the CSV file.
Then convert this and write the file on the response and serve it back to the client.

IE6 compatible way to send uploaded file via Javascript to API

Right now users have to two ways to send data to my application: upload a CSV file via browser, or via our API.
It would dramatically reduce duplication to use the API in both instances. Is there a way they could use the existing upload form, but instead of storing the CSV on the server, it would be processed via Javascript and sent to the API?
The solution would unfortunately have to be IE6 compatible.
There is no way to do this with IE6 (and in my opinion there is no reason to even try this).
Possible workarounds:
Embed the uploadform into a iframe (ugly)
Use a FlashPlayer 9+/JavaApplet to perform the upload (requires plugin), but this also gives you the possibility to process the data before sending it.
Unfortunately, no, this is not possible with IE6. Reading local files is possible in HTML5, but IE has a long way to go...
Also- it is not required to store the CSV on the server. You can process the CSV dynamically in a servlet and use the API to store the data without storing the CSV on the server.

Javascript for playing audio from server

I have a database in MS SQL Server'08 with mp3 files as BLOB objects (I use filestream for storing).
There's a WCF service which works with database (linq).
There's a client application on html+javascript (and nothing more).
How to play one of the audio files from server on the client?I tried to send a byte array which represents mp3 file, but it's a problem how to play this array as sound using javascript.
Thanks
You need to use a server side script to serve up the MP3 out of the database.
If you are using SQL Server, I assume you will need to use the .Net Framework to fetch rows from the database.

Categories

Resources