我想在该代码https://pub.dev/packages/voice_changer_plugin#-readme-tab-中使用语音转换器打包程序,但是我不知道如何在将记录上传到消防存储之前使用功能VoiceChangerPlugin.change(path,type)更改语音。
void startRecorder() async {
try {
String path = await flutterSound.startRecorder(null);
uriPath = path;
});
_dbPeakSubscription =
flutterSound.onRecorderDbPeakChanged.listen((value) {
print("got update -> $value");
setState(() {
this._dbLevel = value;
});
});
this.setState(() {
this._isRecording = true;
});
} catch (err) {
print('startRecorder error: $err');
}
}
]]
void startPlayer() async {
String path = await flutterSound.startPlayer(null);
await flutterSound.setVolume(1.0);
try {
_playerSubscription = flutterSound.onPlayerStateChanged.listen((e) {
if (e != null) {
slider_current_position = e.currentPosition;
max_duration = e.duration;
DateTime date = new DateTime.fromMillisecondsSinceEpoch(
e.currentPosition.toInt(),
isUtc: true);
String txt = DateFormat('mm:ss:SS', 'pt_BR').format(date);
this.setState(() {
this._isPlaying = true;
this._playerTxt = txt.substring(0, 8);
});
}
});
} catch (err) {
print('error: $err');
}
}
try {
File file = File(uriPath);
final StorageReference storageRef = FirebaseStorage
.instance
.ref()
.child('$idGenerator.aac');
final StorageUploadTask task = storageRef.putFile(file);
_fireStore.collection(problemCategory).add({
'name': name,
'title': problemTitle,
'date': recordNameDate,
'record': idGenerator,
});