0

I am new to android and node.js;

My task is as follows:

I have a raw audio file on my android device. The goal is to build an android app to send the file to my Node.js server, where I can then convert the data into playable audio.

Currently, using retrofit, I am able to succesfully send data of type T from the android device to my server. On the server side, I am able to convert a raw audio file (assuming that I already have it on the desktop) to WAV format and play it in the browser.

How do I extract the raw audio file on the android device and send it to the Node server?

Thanks!

A S
  • 75
  • 8
  • where do you want to extract the audio file from? – Nicholas Obert Dec 31 '20 at 14:03
  • from the android device. – A S Dec 31 '20 at 14:06
  • then you should read the file on your android device and send its content to the server via some websocket. I'm not into native android development, but I'm sure there is a library for handling web traffic. – Nicholas Obert Dec 31 '20 at 14:10
  • Yes, I understand that that is the idea, but I am looking for guidance in how to read the raw audio file. – A S Dec 31 '20 at 14:14
  • are you asking how to read a file in general or how to read specifically an audio file? since the app's only purpose is to send its content, there shouldn't be any difference – Nicholas Obert Dec 31 '20 at 14:22
  • Since it is a raw file, I am not sure which format to "open" and send it in (InputStream fro instance?) – A S Dec 31 '20 at 14:32
  • 1
    any format should do the trick, provided it's the same for both your Android app and Node.js server. Use whichever format you are familiar with. Since the standard JS and Java libraries probably won't have straight-away compatible formats, I suggest you read the file as bytes (https://stackoverflow.com/questions/10039672/android-how-to-read-file-in-bytes/10039728) – Nicholas Obert Dec 31 '20 at 14:43

0 Answers0