Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Speech-to-Text Fails on Simulator After Connecting External Audio Interface on macOS M3 Pro #549

Open
CristianAragon opened this issue Aug 21, 2024 · 0 comments

Comments

@CristianAragon
Copy link

After connecting an external audio interface, the speech-to-text functionality stopped working in the simulator.

Package: speech_to_text: ^7.0.0-beta.1

Environtment:

MacBook with an M3 Pro chip.

Flutter 3.25.0-1.0.pre.54 • channel master • https://github.com/flutter/flutter.git
Framework • revision d0d23300e6 (2 hours ago) • 2024-08-20 19:16:07 -0400
Engine • revision 3d18f65c37
Tools • Dart 3.6.0 (build 3.6.0-162.0.dev) • DevTools 2.39.0-dev.15

Tests:

  • Start speech-to-text with the audio interface disconnected:
    Result: error_no_match | status: NotListening
  • Start speech-to-text with the audio interface connected and MacBook's built-in output selected:
    Result: error_no_match | status: NotListening
  • Start speech-to-text with the audio interface connected and selected as output, MacBook's built-in input:
    Result: Listening

I'm unsure if this is a bug in the library or if the audio interface has altered some settings.

I’ve tried various solutions but haven’t been able to fix it:

  • Removed all audio cache settings
  • Cleaned the simulator
  • Installed audio_session and made the relevant configurations to check if the issue was related to the sample rate, but I got the same results:
await session.configure(AudioSessionConfiguration(
  avAudioSessionCategory: AVAudioSessionCategory.playAndRecord,
  avAudioSessionCategoryOptions: AVAudioSessionCategoryOptions.defaultToSpeaker,
  avAudioSessionMode: AVAudioSessionMode.spokenAudio,
  avAudioSessionPreferredSampleRate: 44100, // Added this line
));

Relevant Console Logs:

When the interface is connected (speech works):

default	13:48:39.017544-0300	Runner	       AggregateDevice.mm:983   PrimarySessionActiveWithInputEnabled 0 -> 1
default	13:48:40.630472-0300	Runner	           AQMEIO_HAL.cpp:2475  aqmeio@0x138808218, device 136 (iOSSimulatorAudioDevice-4187-5), AudioDeviceStart (err 0)
default	13:48:40.642229-0300	Runner	           AQMEIO_HAL.cpp:527   iOSSimulatorAudioDevice-4187-5 (136): IO started 1 (err 0), was running 1, running count 1
default	13:48:41.669002-0300	Runner	flutter: [speech recognition service] status: listening

When the interface is not connected (speech fails):

error	13:28:10.850234-0300	Runner	    AVAudioSession_iOS.mm:1192  AudioSessionGetProperty (temp_kMXSessionProperty_HasEchoCancelledInput) failed with error: -50
error	13:28:10.938749-0300	Runner	           AVAEInternal.h:76    required condition is false: [AVAudioIONodeImpl.mm:1281:SetOutputFormat: (format.sampleRate == hwFormat.sampleRate)]
error	13:28:10.939117-0300	Runner	Error starting listen: The operation couldn't be completed. (Try error 1.)
default	13:28:10.939250-0300	Runner	AVAudioSessionImpl_Simulator.mm:136   Set volume on device 72 to 0.60
default	13:28:10.939294-0300	Runner	       AggregateDevice.mm:983   PrimarySessionActiveWithInputEnabled 1 -> 0

I also tried running the example, but I encountered the same results:

image

I'm continuing to debug this issue, but I wanted to report it here in case someone else is experiencing the same problem.

Thanks in advance for any assistance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant