Hello there,
So I have an application that uses photon voice as well as a speech to text library and it seems that those two are not working together. I guess it’s because they are both trying to reach the audio input flux from the microphone.
And so I currently have no idea on how to make those work together.
Do you guys have any clue or suggestion that would help me out a lot !
Cheers and thanks for your time
well, I have a mp3 audio recorder that I record lextures with. I goofed and bought the recorder that was not digital . so I’m stuck with playing it by a line in audio earphone jack. I can do it no problems at all with my laptop but for some reason it will not let me do it on this stupid all in one . I don’t know if its a setting or a hardware conflict. To check your microphones quality drive mic test online.
It sounds like you’re having trouble getting two audio-related libraries, Photon Voice and a speech-to-text library, to work together in your application. It’s possible that both libraries are trying to access the microphone at the same time, which could be causing conflicts.
You can try to try using a virtual audio device to route the audio input from the microphone to both libraries simultaneously. This can be done using a tool like VB-Audio Virtual Cable or a similar software that allows you to create virtual audio devices.
Thanks for the suggestion, Maya. I hadn’t considered using a virtual audio device to resolve the conflicts between Photon Voice and the speech-to-text library. It makes sense that they might be clashing over microphone access. I’ll definitely give VB-Audio Virtual Cable a try and see if it helps to streamline the integration process. Your advice is greatly appreciated!
Hello,
This is a very common issue when integrating multiple audio-processing libraries in Unity. You’re absolutely right — the core problem is that both Photon Voice and your Speech-to-Text (STT) library are trying to claim exclusive control of the microphone device, leading to a resource conflict.
The key is to have only one library capture the microphone input and then share the audio data stream with the other.
Here are the most effective strategies to solve this:
1. The Ideal Solution: Use Photon Voice as the Source
Photon Voice is designed to handle audio streams efficiently. Instead of having your STT library access the mic directly, you can tap into the audio buffer that Photon Voice is already capturing.
- How it works: Photon Voice provides access to its
AudioStream buffer. You can subscribe to this stream, get the raw byte or float data, and then feed it directly into your STT library’s processing function. This bypasses the need for the STT library to initialize the microphone itself.
- Action: Check the Photon Voice documentation for “Audio Stream” or “Audio Data Access”. You are looking for an event or callback like
OnAudioFrame that gives you the raw audio frames. You would then write a custom bridge class that takes this data and sends it to your STT engine.
2. The Fallback Solution: Use the STT Library as the Source
If your STT library is more central to your app, you can reverse the flow. Capture the audio with the STT library and then forward the processed audio packets to Photon Voice for transmission.
- How it works: You would disable Photon Voice’s internal recording and put it in “Audio Source” mode. Then, you manually create an
AudioClip or byte array from your STT library’s audio stream and feed it to Photon Voice using its Push data API.
- Action: Look into your STT library’s API for accessing the raw audio data it records. Then, check the Photon Voice docs for “Streaming Audio via Script” or “Pushing Data”.
3. Critical First Step: Diagnose the Exact Conflict
Before you dive into coding a complex bridge, it’s crucial to confirm this is a pure microphone conflict and not a deeper code issue.
A great way to do this is to test the microphone’s availability and state in real-time. This helps you see which library is winning the fight for the device. For a quick diagnostic, you can use an online tool to check if your microphone is being held open by another process. I often use the Mic Test & Debug tool at Michigan County Map during development. It’s a simple web-based tool that shows if your mic is accessible and working, which can help you confirm the conflict’s nature before you spend hours on integration.
Start with the first solution, as it’s generally the most stable. The Photon Voice community forums are also a great place to find code snippets for accessing the audio stream.
Good luck! Once you get the audio stream shared, it should work flawlessly.