xuegao-tzx / whisper_flutter_new

A flutter library for offline speech-to-text conversion which use whisper.cpp models implementation for Android、iOS、macOS.
https://pub.dev/packages/whisper_flutter_new
GNU General Public License v3.0
11 stars 3 forks source link

Failed to process audio #4

Open RandomHuang opened 1 month ago

RandomHuang commented 1 month ago

Use flutter_sound record (Codec.pcm16WAV) in iOS, file exist.

flutter: file length 4096 flutter: Use existing model base flutter: Result = {@type: version, message: lib version: v1.0.1} flutter: lib version: v1.0.1 flutter: Use existing model base flutter: Result = {@type: error, message: failed to process audio} flutter: Transcribe request {@type: error, message: failed to process audio} [Global Loggy] ‼️ 18:32:37.269840 - Exception: failed to process audio

0 Whisper.transcribe (package:whisper_flutter_new/whisper_flutter_new.dart:119:7)

#1 _TestP... [Global Loggy] ‼️ 18:32:37.270162 - error stack #0 Whisper.transcribe (package:whisper_flutter_new/whisper_flutter_new.dart:119:7) #1 _TestPageState.translate (package:ai_record/page/test/test_page.dart:81:48) flutter: Transcribe Exception failed to process audio
RandomHuang commented 1 month ago

Change to tiny model still have same problem

flutter: file length 4096 flutter: Download model tiny flutter: Download Down . Path = /var/mobile/Containers/Data/Application/AADDB388-1A36-43AF-A066-B260E14EBF44/Library/ggml-tiny.bin flutter: Result = {@type: version, message: lib version: v1.0.1} flutter: lib version: v1.0.1 flutter: Use existing model tiny flutter: Result = {@type: error, message: failed to process audio} flutter: Transcribe request {@type: error, message: failed to process audio} [Global Loggy] ‼️ 18:36:25.321926 - Exception: failed to process audio flutter: Transcribe Exception failed to process audio

0 Whisper.transcribe (package:whisper_flutter_new/whisper_flutter_new.dart:119:7)

#1 _TestP... [Global Loggy] ‼️ 18:36:25.322299 - error stack #0 Whisper.transcribe (package:whisper_flutter_new/whisper_flutter_new.dart:119:7) #1 _TestPageState.translate (package:ai_record/page/test/test_page.dart:81:48) [ERROR:flutter/shell/platform/darwin/ios/framework/Source/profiler_metrics_ios.mm(203)] Error retrieving thread information: (os/kern) invalid argument
xuegao-tzx commented 1 month ago

This model only supports 16-bit WAV files. image

You can also try running the sample code to see if the problem can be reproduced.

RandomHuang commented 1 month ago

thanks reply. I have already used the pcm16WAV format from flutter_sound for recording, and its documentation says 'Linear 16 PCM, which is a Wave file.' start record by bitRate = 16000 , Could you recommend any Flutter plugins for recording? Thank you

xuegao-tzx commented 1 month ago

I use record to record, and use ffmpeg_kit_flutter_full_gpl to convert. There is no better way at present. If you have one, please tell me. Thank you very much.