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'm not sure if I'm doing something wrong, I'm an novice when it comes to audio data. I'm not sure what filetype I should be saving the iOS pcm16 stream as, but nothing I've tried seems to be playable.
And here's the code I'm using to create the stream and save the data to a file. I've tried m4a, wav filetypes.
Future<void> recordStream(AudioRecorder recorder, RecordConfig config) async {
setState(() {
currentAudioFile =null;
});
final path =await_getPath();
final file =File(path);
stream =await recorder.startStream(config);
setState(() {
isRecording =true;
});
stream?.listen((data) {
file.writeAsBytesSync(data, mode:FileMode.append);
}, onDone: () {
print('End of stream. File written to $path.');
setState(() {
currentAudioFile = file;
});
});
}
Future<String> _getPath() async {
final dir =awaitgetApplicationDocumentsDirectory();
return p.join(
dir.path,
'audio_${DateTime.now().millisecondsSinceEpoch}.wav',
);
}
When I access the file saved to the path in the app documents directory, it is not playable. Any help would be greatly appreciated as I would like to use the stream to display an amplitude animation but also need to send the file afterwards.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I'm not sure if I'm doing something wrong, I'm an novice when it comes to audio data. I'm not sure what filetype I should be saving the iOS pcm16 stream as, but nothing I've tried seems to be playable.
My Recording configuration:
And here's the code I'm using to create the stream and save the data to a file. I've tried m4a, wav filetypes.
When I access the file saved to the path in the app documents directory, it is not playable. Any help would be greatly appreciated as I would like to use the stream to display an amplitude animation but also need to send the file afterwards.
Beta Was this translation helpful? Give feedback.
All reactions