How to record user audio?

Can someone provide me a small code snippet/project where we can record user audio and get the data?
My use case is to teleport to some places in my scene, when the user says: “Teleport to X area”. Can someone share a project to record the audio in playcanvas, so that later it can be converted into text.


Hi @yaswanth,

I think you aren’t looking only for a way to record audio, but to convert it to text so you can understand in your code what the user is requesting.

That’s called speech recognition. There is some partial support in some browsers, start studying this article and there are tutorials linked as well:

@Leonidas, Thanks for the reply.
I prefer to use cloud speech-to-text services since the API you’ve shared is not supported by all browsers. I would primarily like to know how to record user audio and the get audio data in playcanvas.

Right, similarly you will be using a browser API to do that. Check this:

Does this work in immersive VR?

Yes it works, it’s a native browser API.

1 Like