Unable to control volume on iOS when vosk is active.
Hello, I'm using the react-native-vosk library for speech recognition in my app, the recognition is used to detect sentences in a text to trigger some actions, on android everything works perfect, but on iOS I'm having some trouble, for example the volume control on iOS is disabled when speech recognition is active, I would like to know if anyone knows how I can enable volume control when speech recognition is active.
I know that this isn't necessarily an issue in the library, but I haven't found anywhere appropriate to ask for help and I don't know how to solve this "issue".
Hi @pedrolmsin
I think there is code in Swift that temporarily reduces the volume of other audios.
If I'm not mistaken, it would be .duckOthers, from here:
try audioSession.setCategory(.record, mode: .measurement, options: .duckOthers)
Maybe if you pass the options like:
try audioSession.setCategory(.record, mode: .measurement, options: [])
I haven't tested this, but I can test it later and get back to you.
Hi @pedrolmsin
I think there is code in Swift that temporarily reduces the volume of other audios.
If I'm not mistaken, it would be
.duckOthers, from here:
try audioSession.setCategory(.record, mode: .measurement, options: .duckOthers)Maybe if you pass the options like:
try audioSession.setCategory(.record, mode: .measurement, options: [])I haven't tested this, but I can test it later and get back to you.
I will look into it but any help would be amazing, I have been stuck in this issue for weeks so far, it is the only thing getting in the way of me launching my app, lol, on android it works perfectly but on iOS this library is giving me headaches.
Hi @pedrolmsin I think there is code in Swift that temporarily reduces the volume of other audios. If I'm not mistaken, it would be
.duckOthers, from here:try audioSession.setCategory(.record, mode: .measurement, options: .duckOthers)Maybe if you pass the options like:try audioSession.setCategory(.record, mode: .measurement, options: [])I haven't tested this, but I can test it later and get back to you.I will look into it but any help would be amazing, I have been stuck in this issue for weeks so far, it is the only thing getting in the way of me launching my app, lol, on android it works perfectly but on iOS this library is giving me headaches.
Later I will try to simulate and solve this problem, I will get back to you here.
Ducking has been removed, can you try again now @pedrolmsin ?
Ducking has been removed, can you try again now @pedrolmsin ?
Hi, I did some tests and now I can control the volume on iOS after stopping vosk, however when the recognition is active it is still not possible to control the volume of the device, I have to stop the recognition to adjust the volume and then start the recognition again, it improved a little with this new addition, before not even after stopping I could adjust the volume on iOS, but the ideal would be to be able to control the volume even with the voice recognition active, if it is possible to implement this it would be nice, thanks for your attention and time.
@pedrolmsin Are you unable to control the volume or the audio does not play?
@pedrolmsin Are you unable to control the volume or the audio does not play?
I can't control the volume, when speech recognition is active I can't control the volume on iOS, my application requires speech recognition to be active all the time to recognize certain phrases and play some sounds based on those phrases, I would like to be able to control the volume while recognition is active, on Android this is possible and works perfectly, but on iOS I have to stop speech recognition to allow the user to control the volume, and this becomes unfeasible for the proposal of my application.
What lib are you using to play the audios? @pedrolmsin
@pedrolmsin I'm going to do the tests here, because last time I tried to run vosk with @react-native-community/audio-toolkit it didn't work, I had to stop react-native-vosk for it to work
I finally managed to control the audio volume on iOS while voice recognition is active. It might not work for all purposes, but it worked for mine.
try audioSession.setCategory(.playAndRecord, mode: .measurement, options: [.mixWithOthers, .defaultToSpeaker])