question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Porcupine Issue: adding audio player will stop wakeWordCallback from getting called again

See original GitHub issue

Expected behaviour

wakeWordCallback gets called every single time the trigger word is mentioned

Actual behaviour

wakeWordCallback only gets called once. The moment an audio player is created, it stops getting called.

Steps to reproduce the behaviour

  1. Clone https://github.com/geekyme/picovoice_test
  2. flutter run
  3. Say “jarvis”, an audio will be played
  4. Repeat Step 3 and it will no longer work.

Revert the commit for adding the audio - https://github.com/geekyme/picovoice_test/commit/cf1f5d5137e1620b6fc7c84d514bed461ae46216

Now perform step 3 and 4, the callback will be triggered every time you say “jarvis”. Somehow, adding that audio player stops porcupine from working correctly.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
lavescommented, Aug 19, 2021

@geekyme we’ve scheduled someone to take a look at this in the coming weeks. Thank you for your patience.

0reactions
lavescommented, Sep 1, 2021

@geekyme, we’ve spent some time looking at this and it seems this is not necessarily a problem with Picovoice or our flutter audio recorder plugin - more of a combination of bad assumptions made by Apple and these audio player plugins.

The problem is related to iOS’s AVAudioSession. Each iOS app has a single audio session assigned to it that can be configured to do certain things. For our purposes, we enable recording and playback so that we can take in microphone audio, but still allow audio to be played. When you play a sound using these audio player plugins, they switch the audio session to playback only, which turns off audio recording. As a result, our Picovoice plugin stops receiving audio and cannot perform speech recognition. Apple assumes each app will have complete control over its own audio session, so this changing of settings is not considered an interruption event and cannot be handled like other audio interruptions. If you use any other flutter audio recording plugin, start recording, play a sound using one of these plugins, you’ll see they stop recording audio as well.

Unfortunately, there is no great way around this from our perspective. We’ve added extra error handling to detect when we’ve lost audio, but we cannot do much more at this time. I’d recommend you’d report this problem to the developers of the plugins you are trying to use and recommend that they not shut off recording capabilities when they play audio (or at least make it configurable).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to start speech Recognition after porcupine wake word ...
So I have tried to stop the porcupineManager.stop() (To stop from porcupine to listen) then initialized speech recognition and to start ...
Read more >
Picovoice - Bountysource
wakeWordCallback only gets called once. The moment an audio player is created, it stops getting called. Steps to reproduce the behaviour. 1) Clone...
Read more >
Audio player | Documents Knowledge Base
The smart and beautiful media player organizes folders into playlists with the ability to shuffle and loop your favorite tracks. Jump to: Add...
Read more >
AudioPlayer Interface Reference | Alexa Skills Kit
(again, no invocation name.) Alexa opens a new skill session and sends the skill AMAZON.PauseIntent . My Podcast Player sends a Stop ......
Read more >
In AVAudioPlayer after a pause the song does not continue on ...
do { audioPlayer = try AVAudioPlayer(contentsOfURL: mySound) audioPlayer!.prepareToPlay() } catch { print("Error getting the audio file") } }.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found