You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am working on an Audio recording function. I want the recorded Audio to be saved into the internal cache directory of my app so that I can later process it and send it to my server. I have taken the RECORD_AUDIO_PERMISSION in my Android Manifest.
Below is the code I am using for recording audio and save it to a file.
The above code to work fine but I am facing another issue. I want to create a Waveform effect for my app for which I am using this library. I know the below code can be used to pass on bytes to the visualizer.
//get reference to visualizer
mVisualizer = findViewById(R.id.blast);
//TODO: get the raw audio bytes
//pass the bytes to visualizer
mVisualizer.setRawAudioBytes(bytes);
Now, my question is how can I get the Bytes in real-time of the Audio which is being recorded and being saved? Should I read the file and extract recent bytes from it at regular intervals or is there any other method to achieve this?
Any help would be appreciated
Thanks.
The text was updated successfully, but these errors were encountered:
private fun convertFileToBytes(file: File):ByteArray {
try {
val b = ByteArray(1024)
val os= ByteArrayOutputStream()
val fis=FileInputStream(file)
var read:Int=0
read=fis.read(b)
while ((fis.read(b).also { read = it })!=-1){
os.write(b,0,read)
}
fis.close()
os.close()
return os.toByteArray()
Hi,
I am working on an Audio recording function. I want the recorded Audio to be saved into the internal cache directory of my app so that I can later process it and send it to my server. I have taken the
RECORD_AUDIO_PERMISSION
in my Android Manifest.Below is the code I am using for recording audio and save it to a file.
The above code to work fine but I am facing another issue. I want to create a Waveform effect for my app for which I am using this library. I know the below code can be used to pass on bytes to the visualizer.
Now, my question is how can I get the Bytes in real-time of the Audio which is being recorded and being saved? Should I read the file and extract recent bytes from it at regular intervals or is there any other method to achieve this?
Any help would be appreciated
Thanks.
The text was updated successfully, but these errors were encountered: