Android Question Persistant Microphone Audio storage (saving)

G

GCOINC

Guest
I would like to...


1. start app (app records microphone audio as service)
2. save the most recent 1 minute of audio


Basically the device will always be recording and storing the most recent 1 minute of audio, deleting the trailing extra audio time.

User would stop recording by using accelerometer(or VR ;) ) pattern to trigger permanentely saving that minute of audio - then the service would again restart recording audio.


Most of this info is found easily enough in the forum with the exception of persistently storing only 1 minute of the most recent recording. Hopefully one of the audio experts can shed some info...TIA @stevel05 @XverhelstX
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
See AudioStreamer: http://www.b4x.com/android/forum/threads/audio-library-v1-5-new-audiostreamer-object.30550/#content
There is an example of saving the data to a wave file.

Create a custom type that holds an array of bytes (audio data) and a long variable (time).
Create a List that holds the recorded data. Collect it in streamer_RecordBuffer and add the audio data and its time to the list.

Each time you add data to the list you should remove all the audio data that was collected more than a minute ago.

Saving the list to a file is simple. You need to go over all the stored data and write it with OutputStream.WriteBytes.
 
Upvote 0
Top