microsoft / HoloJS

Provides a framework for creating holographic apps using JavaScript and WebGL.
MIT License
1.19k stars 114 forks source link

Spatial Sound #63

Closed Reda-S closed 6 years ago

Reda-S commented 7 years ago

We have been working on a solution that needs placing sounds in 3 dimensional space, it would be great to have spatial sound directly from HoloJS.

Almost-Done commented 6 years ago

I've started an implementation for this.

Hopefully it will not take long; there is a C++ implementation for WebAudio (https://github.com/LabSound/LabSound). It has to be adapted to work in an APPX container (hopefully already done at the fork I made in https://github.com/Almost-Done/LabSound) and JavaScript projections must be written for the WebAudio APIs to hook them to the C++ implementation.

Reda-S commented 6 years ago

Thanks Cristi

Reda-S commented 6 years ago

Hello Cristi,

I am still interested in the spatial sound feature, will you have a chance to check it out again?

Regards, Reda

Almost-Done commented 6 years ago

The implementation in develop/audio does not work on the OS version currently running on the HoloLens (RS1). It runs just fine on the latest version of windows (RS3). On RS1 it throws and "illegal instruction exception" which I have to investigate (most probably a CRT incompatibility).

Reda-S commented 6 years ago

Hi Cristi,

Will your audio solution, as is, work on the recent HoloLens RS4 update preview?

Thanks, Reda

Almost-Done commented 6 years ago

It should. I haven't tried RS4 yet, but it works on RS3. Try the audio sample from the audio branch. I've given up development for RS1 and I've been waiting for RS4 to make progress on features that have split over time (audio, WebVR, MRC headset support)

Reda-S commented 6 years ago

I wasn't able to make the audio sample run on RS4, it is always giving an "illegal instruction" exception on the following line (19): AudioContext::AudioContext() { m_context = lab::MakeAudioContext(); }

Almost-Done commented 6 years ago

Very frustrating since I can't repro it. I did get "illegal instruction" when running RS1, but not anymore with RS4.

I dropped RS1 as target version for the projects, merged with master and pushed the changes out to develop/audio. Do you mind trying one more time and if you still get the crash I'll wrap the audio engine in a WinRT component instead of the current static library. I guess there's a STL incompatibility somewhere between HoloJsHost and the audio library.

Almost-Done commented 6 years ago

It turns out the sound library was compiling with the AVX switch which the Intel CPU in the HoloLens does not support. I removed the AVX switch and pushed a fix. I believe it should work now.

Reda-S commented 6 years ago

I am still getting the same "illegal instruction" error with latest develop/audio update.

Almost-Done commented 6 years ago

Did you clean the solution and rebuild? The last change I pushed was just a static library change (no code changes) and VS might not have rebuilt the project. Also please try both the Release and Debug versions.

Reda-S commented 6 years ago

@Almost-Done I have tried cleaning the solution and rebuilding it, downloading the GitHub audio branch from scratch, I have even installed VS on a different PC maybe something is cached somewhere since it is working for you, and I have tried to run it on a different HoloLens. But the Debug version is still giving the illegal instruction error.

Just before giving up, I tried the Release version and it is working! 👍 👍 👍

Almost-Done commented 6 years ago

I'm so sorry for the trouble. It was my mistake as I forgot to take out the AVX flag from the Debug configuration. Thank you for your persistence!

Now that you got it to at least run, you will most probably encounter other issues. Please submit any issues you find along the way. The WebAudio implementation is not complete on the script side; however it is complete on the C++ side so it's just a matter of creating projections.

Reda-S commented 6 years ago

Thanks a lot Cristi, I am just happy that it's working. I will submit any issues that may arise. Thank you again for all your support.

Reda-S commented 6 years ago

Hi Cristi,

Since the RS4 update has been released for everyone, can we merge the develop/audio branch to master and maybe we can finally close this issue too?

Thanks

Almost-Done commented 6 years ago

Thank you for reminding me. It is now merged.