Tags

, , , , , , , , , , , , ,

I took two days. And into a second night. I ate baked beans and toast, and drunk black coffee. But, finally, I pulled it off.

Scratching the stubble on my chin, I listened again to the miraculous sound that I had recorded on my Yamaha PSR-78 keyboard. I had set the voice to number 97, Harp. I had pressed the top A note, followed by the top F note. Magix Music Maker had captured the audio waves from the Rode microphone. By Jove, the greatest doorbell sound had just been recorded!

By the way, if anyone knows how to play said keyboard with a drum beat but without triggering an accompaniment on the lower notes, drop me a line.

Anyway, the bell was in the can. So I dropped it into my C++ Microsoft Visual Studio application (with OpenGL graphics library and the Oculus SDK for Windows) and put on the Oculus Rift virtual reality headset.

Here’s a video of my index finger pressing the doorbell:

Those two long days and the moon in the studio paid off. What a jingle!

But how to code such wonders?

Well, first I had to build the door with a chisel in Blender (the 3D creation suite). The video Blender – Creating a Simple Door helped me.

Next I made use of the FMOD API to turn the doorbell .wav file into 3D audio for my virtual world. Be sure to negate the various z axis so that FMOD behaves with a right-handed coordinate system.

Finally, I must detect collision of my hand with the doorbell. My post Holding a cup in VR has the detail. But I have one further requirement – the doorbell should only ring out if I prod it with my index finger:

bool leftIndexPointing = (inputState.Touches & ovrTouch_LIndexPointing);

Splendid. I am now checking whether the index finger of my left Oculus Touch controller is pointing. And I take the same approach with my right index finger.

Happy and content, I collapsed on my bed and slept for a full week. And when I awoke, I did so with a huge smile upon my face. For the doorbell sound had peppered my many dreams, a condiment of gorgeous tinnitus. Ring on!

Advertisements