biemster / gasr

Google Chrome SODA Offline Speech Recognition command line client
https://hackaday.io/project/164399-android-offline-speech-recognition-natively-on-pc
145 stars 17 forks source link

Speech recognition not working - Macbook pro m1 pro #18

Closed bheesma closed 1 month ago

bheesma commented 1 year ago

When I execute the below command in my Macbook Pro M1 Pro system,

ecasound -f:16,1,16000 -i alsa -o:stdout | python3 gasr.py

It's throwing the following error. It's not recognising speech either. Any clue?

********************************************************************************
*        ecasound v2.9.3 (C) 1997-2020 Kai Vehmanen and others    
********************************************************************************
(libkvutils) kvu_rtcaps: warning! sched_getparam() not supported
(eca-chainsetup-parser) WARNING: Only 2+0 of the expected 4 parameters were recognized successfully.
(eca-chainsetup) Chainsetup "untitled-chainsetup"
---
ecasound: ERROR: [ECA-SESSION] : "Audio object "alsa" does not match any of the known audio device types or file formats. You can check the list of supported audio object types by issuing the command 'aio-register' in ecasound's interactive mode."

W0000 00:00:1683414548.426348       1 soda_async_impl.cc:334] Creating soda_impl.
W0000 00:00:1683414548.485785       1 terse_processor.cc:342] TISID disabled.
E0000 00:00:1683414548.486127       1 pipeline_builder.cc:192] Serial load failed for resource: context_models.rescoring_twiddler_map
.Twiddler does not have a twiddler_fst_ref or a set of ngrams to twiddle.
E0000 00:00:1683414548.486137       1 google_recognizer.cc:151] UNKNOWN: Twiddler does not have a twiddler_fst_ref or a set of ngrams to twiddle. [type.googleapis.com/util.ErrorSpacePayload='SpeechErrorSpace::SpeechError(-73501)']
=== Source Location Trace: ===
./speech/common/error_codes.h:62
./speech/greco3/resource/resource.h:413
speech/greco3/resource/resource.cc:126
speech/greco3/pipeline/pipeline_builder.cc:337
speech/greco3/api/base_recognizer.cc:415

E0000 00:00:1683414548.486426       1 terse_processor.cc:1228] Failed to start recognizer. Error code: 2
E0000 00:00:1683414548.498186       1 soda_impl.cc:529] Terse enabled but could not initialize processor: Terse Processor: Failed to start the recognizer with code 2
E0000 00:00:1683414548.498207       1 extended_soda_async_wrapper.cc:74] Unable to initialize SODA with the provided config. Failure status: 5
W0000 00:00:1683414548.498283       1 soda_async_impl.cc:561] SODA session starting (require_hotword:0, hotword_timeout_in_millis:0, trigger_type:TRIGGER_TYPE_UNSPECIFIED, hybrid_asr_config.mode:MODE_DEFAULT)
E0000 00:00:1683414548.499410       1 soda_impl.cc:1535] WriteInput failed: INTERNAL: No adapters available for processing input.
=== Source Location Trace: ===
speech/audio/processor/stream/processor_stream.cc:31

W0000 00:00:1683414548.499414       1 soda_async_impl.cc:612] Nice value changed from <Unknown> to <Unknown>. Restarting SODA thread.
bheesma commented 1 year ago

After I copied all the files from libsoda folder once again, I'm getting a slightly different error:

I0000 00:00:1683415284.400044       1 soda_async_impl.cc:352] Creating soda_impl.
I0000 00:00:1683415284.401156       1 soda_impl.cc:342] Maximum audio history: 30s
I0000 00:00:1683415284.401164       1 soda_impl.cc:377] Adding Resampler from 16000 to 16000
I0000 00:00:1683415284.401196       1 soda_impl.cc:556] Enabling power evaluator.
I0000 00:00:1683415284.401213       1 soda_impl.cc:566] Adding preamble processor.
I0000 00:00:1683415284.401231       1 soda_impl.cc:593] Enabling On Device ASR
I0000 00:00:1683415284.403191       1 terse_processor.cc:1155] LP details: [locale: en-us, version: 3045, config file: ./SODAModels/configs/ONDEVICE_MEDIUM_CONTINUOUS.config, personalized resources dir: <NONE>]
I0000 00:00:1683415284.403324       1 terse_processor.cc:215] Loaded PipelineDef.
I0000 00:00:1683415284.411135       1 terse_processor.cc:232] Initialized ResourceManager.
I0000 00:00:1683415284.411213       1 terse_processor.cc:244] Initialized GoogleRecognizer.
W0000 00:00:1683415284.421622       1 terse_processor.cc:351] TISID disabled.
I0000 00:00:1683415284.421629       1 terse_processor.cc:1247] Domain: IME
W0000 00:00:1683415284.421930       1 snapshot.cc:44] Failed to get any snapshot revision for |auto-apps| (scope: 15136313109896498463). Error: INTERNAL: No candidate revision in snapshot for |auto-apps| (scope: 15136313109896498463)
=== Source Location Trace: ===
speech/service/context/device/framework/snapshot.cc:67
I0000 00:00:1683415284.423385       1 terse_processor.cc:2383] Resetting Terse Processor
I0000 00:00:1683415284.423394       1 terse_processor.cc:1387] Cancelling session.
W0000 00:00:1683415284.423594       1 decoder_endpointer_stream.cc:58] Acoustic ep reader thread cancelled.
W0000 00:00:1683415284.423601       1 decoder_endpointer_stream.cc:58] Prefetch reader thread cancelled.
I0000 00:00:1683415284.423727       1 terse_processor.cc:1286] Setup completed
I0000 00:00:1683415284.423733       1 soda_impl.cc:683] Server ASR Disabled
I0000 00:00:1683415284.423735       1 soda_impl.cc:759] Initializing audio logger
I0000 00:00:1683415284.423745       1 soda_async_impl.cc:619] SODA session starting (require_hotword:0, hotword_timeout_in_millis:0, trigger_type:TRIGGER_TYPE_UNSPECIFIED, hybrid_asr_config.mode:MODE_DEFAULT)
I0000 00:00:1683415284.423785       1 soda_async_impl.cc:900] Session parameters updated. Reconfiguring SODA.
I0000 00:00:1683415284.423799       1 terse_processor.cc:1934] Setting impersonated speaker id to: <NONE>
I0000 00:00:1683415284.423804       1 soda_impl.cc:1388] Got pipeline signal out
I0000 00:00:1683415284.423806       1 soda_async_impl.cc:600] Nice value unknown. Restarting SODA thread.
I0000 00:00:1683415284.423865       2 soda_impl.cc:1388] Got pipeline signal out
^CI0000 00:00:1683415302.350647       2 soda_async_impl.cc:1116] SODA stopped processing audio, mics audio processed in millis: 0, loopback audio processed in millis: 0
I0000 00:00:1683415302.350778       2 soda_async_impl.cc:1129] Audio readers are stopped.
I0000 00:00:1683415302.350837       2 soda_impl.cc:1388] Got pipeline signal out
I0000 00:00:1683415302.350905       2 terse_processor.cc:2383] Resetting Terse Processor
I0000 00:00:1683415302.350911       2 soda_impl.cc:1388] Got pipeline signal out
I0000 00:00:1683415302.350920       2 soda_async_impl.cc:1179] SODA session stopped due to: STOP_CALLED
I0000 00:00:1683415302.364136       1 soda_async_impl.cc:1264] Deleted soda_impl.
biemster commented 1 year ago
ecasound: ERROR: [ECA-SESSION] : "Audio object "alsa" does not match any of the known audio device types

is your true error here. I'm not an expert on macOS, you'll need to find a way to pipe audio from your mic to the script and macOS does not have ALSA.