feat: integrate Sherpa-ONNX local offline speech recognition engine
This commit is contained in:
@@ -77,8 +77,12 @@ class VoiceService {
|
||||
if (!await recordings.exists()) await recordings.create(recursive: true);
|
||||
final timestamp = DateTime.now().microsecondsSinceEpoch;
|
||||
await _recorder.start(
|
||||
const RecordConfig(encoder: AudioEncoder.aacLc),
|
||||
path: '${recordings.path}/practice_$timestamp.m4a',
|
||||
const RecordConfig(
|
||||
encoder: AudioEncoder.wav,
|
||||
sampleRate: 16000,
|
||||
numChannels: 1,
|
||||
),
|
||||
path: '${recordings.path}/practice_$timestamp.wav',
|
||||
);
|
||||
return true;
|
||||
}
|
||||
@@ -118,7 +122,7 @@ class VoiceService {
|
||||
if (!await recordings.exists()) return const [];
|
||||
final files = await recordings
|
||||
.list()
|
||||
.where((item) => item is File && item.path.endsWith('.m4a'))
|
||||
.where((item) => item is File && (item.path.endsWith('.wav') || item.path.endsWith('.m4a')))
|
||||
.cast<File>()
|
||||
.toList();
|
||||
files.sort((left, right) => right.path.compareTo(left.path));
|
||||
|
||||
Reference in New Issue
Block a user