Closed bruhnth17 closed 8 months ago
Thanks for the report bruhnth17! We will take a look.
By the way, does the example scene have similar problems?
Great thank you! Could you point me to the direction of the example scene for Microphone Streaming? I checked out the SpeechInputExample from the Input-Demos, and AudioLoFiEffectExamples & AudioOcclusionExamples from the Audio Demos. They all work fine, but I did not see the WindowsMicrophoneStream in them.
The example where I have the code from is from this "older" example for a voice chat that I found https://github.com/microsoft/MixedReality213/blob/b507f095f2bb8f238961cd223c0cde2be391f36e/Assets/HoloToolkit/Sharing/Scripts/VoiceChat/MicrophoneTransmitter.cs
@bruhnth17, our example does not do streaming of the microphone data. I am interested in seeing if the demo (spatial mesh responding to your voice) has any of the same errors you are seeing in your application.
The demo is in MRTK\Examples\Demos\Audio\Scenes. Please use WindowsMicrophoneStreamDemo.unity
Alright thank you. I'll try out the WindowsMicrophoneStreamDemo this weekend and report back to you
WindowsMicrophoneStreamDemo.unity is not contained in the MRTK examples that I have in the project (2.6.1). When downloading the Audio examples through the package manager in Unity, I only get the two you see in the image below.
#if MICSTREAM_PRESENT
private void OnAudioFilterRead(float[] buffer, int numChannels)
{
if (micStream == null) { return; }
// Read the microphone stream data.
WindowsMicrophoneStreamErrorCode result = micStream.ReadAudioFrame(buffer, numChannels);
Debug.Log($"Read Audio Frame. {string.Join(", ", buffer)}");
// [...]
Tomorrow I'll deploy the original version of the example to the HL2 and see if that works
I tried the demo scene, but it didn't work as expected. While I spoke several times, the mesh didn't change colour. BTW, I checked the script WindowsMicrophoneStream.cs and the code is grey(my OS is Win 10), do you know how to solve that?
@blingopen do you see a #if MICSTREAM_PRESENT
at the top of the file? It is a custom #define - You can find more information about them here. If you remove the conditions at the top and the bottom of the file, the code will be highlighted as usual.
Because I have Mixed Reality Toolkit Microphone Stream Selector 1.0.0 installed, I thought I can remove it safely - But that might be a misconception (As I still can't get it to work).
Thanks. @bruhnth17 I've tried it, but there is another problem. This is my issue #9779 . My Microphone Stream Selector didn't work. Is your Microphone Stream Selector working normally? If so, is there any setting I should do?
I left a comment in the issue. If I understand it right we have two different issues. You can't work with the WindowsMicrophoneStream, I can but the stream is emtpy
yeah, I found you imported this package successfully, so wanna ask if there are other steps after importing this package via official Mixed Reality Feature Tool
Question for folks. Are you using the Unity XR SDK pipeline or the built-in "legacy xr" one?
I have been able to repro what looks like this, in the following scenario:
I am using the prerelease of MRTK 2.7
wanna ask if there are other steps after importing this package via official Mixed Reality Feature Tool
There are no other required steps. Just import the package into the project and use the API
Marking external as the mic stream is managed in an external repository. Will continue investigating as a flaw in that component/script set.
I am using the XR-Plugin Management and MRTK 2.6.1
@davidkline-ms
I have been able to repro what looks like this, in the following scenario: [...]
Does that mean, you were able to reproduce the problem? Any workaround you can recommend at this time?
This issue has been marked as stale by an automated process because it has not had any recent activity. It will be automatically closed in 30 days if no further activity occurs. If this is still an issue please add a new comment with more recent details and repro steps.
I have the exact same problem. Was a solution ever found? Using MRTK 2.8.2.0 and Unity 2020.3.16f1. Is it related to this problem (at the end of the page)? @MaxWang-MS @davidkline-ms
Anything you can offer about how to work around this? Since the first comment I've tried 2 (newer) versions of Unity. No change. I built a project from scratch just for the demo, still no change. Sometimes it never returns a value. Sometimes it begins correctly and then stops returning values and never starts again.
Sorry, I gave up on this solution at the time and stopped development related to HoloLens, so I can't offer any help.
For what its worth - I finally fixed it. The MicStream DLL's MediaCapture instance was conflicting with one I had already instantiated for photo captures. In short, you cant use MicStream with another MediaCapture instance. I tried to set the settings for SharingMode on the first MediaCapture (in my script for capturing photos), but this didnt work. I had to completely stop using the MicStream .dll and streamline the audio capture under one MediaCapture instantiated with StreamingCaptureMode.AudioAndVideo. This fixed the problem.
We appreciate your feedback and thank you for reporting this issue.
Microsoft Mixed Reality Toolkit version 2 (MRTK2) is currently in limited support. This means that Microsoft is only fixing high priority security issues. Unfortunately, this issue does not meet the necessary priority and will be closed. If you strongly feel that this issue deserves more attention, please open a new issue and explain why it is important.
Microsoft recommends that all new HoloLens 2 Unity applications use MRTK3 instead of MRTK2.
Please note that MRTK3 was released in August 2023. It features an all-new architecture for developing rich mixed reality experiences and has a minimum requirement of Unity 2021.3 LTS. For more information about MRTK3, please visit https://www.mixedrealitytoolkit.org.
Thank you for your continued support of the Mixed Reality Toolkit!
Describe the bug
I am working on a collaborative MR environment in Unity, where people with different Headsets can work in the same Unity scene. A requirement for that is audio communication - Something we want to handle over UDP in C# Scripts.
To get the microphone data I am using the MicStreamSelector dll from the Mixed Reality Toolkit Microphone Stream Selector. But for me this has the weirdest behavior. Sometimes
MicGetFrame
works, sometimes it does not. Not working, means that MicStreamSelector provides an empty byte frame (I have no error messages for you 😢) instead of the real audio data. A weird thing I have noticed is that there is a pattern in the randomness. If it works it is much more likely to work the next few times, if it does not work it will probably not work the next times.To reproduce
MicStream.cs
MicrophoneTransmitter.cs
Expected behavior
The audio stream is consistently available, or gives an error message explaining why byteframes are empty
Screenshots
If applicable, add screenshots to help explain your problem.
Your setup (please complete the following information)
Target platform (please complete the following information)