How to get microphone input event

For a VR training application I need to route a microphone input through Resonance Audio with as short a latency as possible. We’re using Unity. It seems FMOD Studio does not support external audio input, and I haven’t the foggiest idea how I could get the API to work for me. Any leads, help is greatly appreciated!

Jorick

1 Like

FMOD does support recording although it requires the use of the Core API. We also have a code example included in the FMOD API download.

To use this in a Studio Project you would need to play it through a Programmer Instrument, see also the Unity example for Programmer Sounds.

Hey Cameron,
Thanks for this valuable piece of info. I’ve seen the API examples before, but could find out for the life of me where to put or how to use this example. I’ll let you know when I get stuck. :wink:

Jorick

Hey Cameron,

I think the record example does exactly what I need, apart from the “just for fun” reverb. But I think I’ll be able to tear that out myself. Maybe I’ll test with decreasing the latency a bit.

I’ve tried some things but made very little progress, since CPP is quite outside my comfortzone, I have not gotten it to work yet.
So here are some basic questions that I think are keeping me from success.
If I understand correctly, I need to put the record.cpp example as a script in the unity project.
How do I link the script to the Studio Event?
Does it matter where in the unity project I place the script?
Is the DEVICE_INDEX used to select which external audio device is used? Is there a way to set which input channel to use?

Unfortunately it’s not as simple as adding the record.cpp to the Unity project. You will need to manually implement what you need from the cpp into your own CS script.

That is correct, you can see more information in the docs: System::getRecordDriverInfo.

Ok. Well, I guess that’s where it ends for me then. If I understand correctly this means translating code from one language to another, both of which I really can’t work with or will take me weeks to master.

I assume it’s already on the feature-request list to have this function integrated in the FMOD Studio environment?

Currently there are just too many different ways that recording can be used to remove the need for coding, although having a C# example (for all examples really) is probably a good place to start.

We do have plans to add recording to the Studio API, but do not have an ETA at this point.

I would agree with that being a very good place to start.
I’ve been trying to find a programmer who can translate the example to fit our needs, yet unsuccessfully. Our current programmer is unable to do it, since he is a Unity coder.
Meanwhile we’re working on borrowed time with this project.
Is there a way I can receive an update somewhere once theres C# examples?

We can update this thread when it is added and it will be added to the revision history.

1 Like

Hi there. I am working on a very similar project on real-time audio input calculation (with Resonance as well) in VR, using a microphone. Is there any news on the Studio API implementation, by any chance?

1 Like

Hi Alberto,
Thanks for sharing your interest in this.
We started yet another multiplayer VR project where we had to drop FMOD altogether because of this vital function. Which is a real bummer, because now I’m stuck with oculus’ spatializer and their next-to-nonexistent documentation on how their audio manager works. I’m really hoping :pray:t2: on that relieving thread update here.

1 Like

So we’ve tried to use Unity’s native mic input functionality and route it through the Resonance Spatializer, paralel to running the FMOD audio system. But it feels like the two systems interfere somehow, sometimes. It’s a bit unstable and hacky. There is of course also quite some latency on the microphone input, but that could be okay if it is just to add some reverb to your own voice.

Also it’s not very cpu efficient, which makes sense I guess, since there is two instances running of the spatializer if I’m not mistaking. I guess I can’t have both FMOD and Unity using the same spatializer instance, or is that too assumptious? :thinking:

FMOD and Unity’s audio won’t interact because they are completely separate systems and generally you would only want to use one or the other.

You can use FMOD to record input from a microphone, although at the moment it is only supported through the API, ie. System::recordStart. There is an example in our API download but not for C# at this point.