Closed bradintheusa closed 3 months ago
Hi @bradintheusa ,
I think that your question is about choosing the correct codec. The device where you will record (stream, buffer, file, …) is another question. What I would consider if I were you, is recording Raw int16 audio data. You can manipulate those data easily (concatenation, truncation, …).
Then, you must decide what to do with those data (sending to a server, keeping them in a buffer, storing into a file.
If you want to store those data into a file, the second question is "will you want that file to be read by another app?". If the answer is yes
, I probably choose a pcm-wav format. It is very simple to produce a wave
file from raw pcm. You just have to put a small header in front of them, and there is a helper function inside Flutter Sound to do that.
ok, Thanks. That's enough information to point me in the right direction, very much appreciated. It seems like the function you are referencing is pcmToWaveBuffer
Note: I talked about raw-pcm16 because it is the easiest way to manipulate data. But it is probably possible to do concatenation with some other codecs like opus or mp3. But you must try yourself because I am not very sure
If you record raw pcm with a sample rate =44100, you will get 44100 int16 every second. It is very simple to cut something, in the middle of your record. You could also do more elaborate things like increase the volume gain in the middle of your record, etc… but you must find on internet the right algorithm.
Internally, when Flutter Sound wants to record raw-pcm, in fact it records pcm-wav and remove the wav header. This is exactly what you want, because when you do the concatenation, you don’t want to have a header in the middle of your record. And when finished, pcm-to-wav() adds a correct new header, with a length inside it equals the total of your data.
I need Help for :
Here is my question :
I want the user to record something, play it back and then let them record some more (append) and then once they are happy save it as a file to be uploaded to the server.
I've tried
ffmepg
to unsuccessfully merge two files together. Then I thought about a number of options (streams). My question is: is it what I want possible? Has anyone done it before?I seems like it should be but I've not seen anyone else do it or an example. If someone has an idea and points be in the right path I can fumble my way to a conclusion and share my answer.
Brad