Using continuous microphone input

Hey there,

I’m trying to make a simple prototype where a user can blow into a microphone and it will move a cube on screen, effectively add force to it.

However I don’t quite understand how to use the microphone in unity… I’ve started with the docs here Unity - Scripting API: Microphone.Start and attached the code to a cube. However nothing happens and I get an error saying missing audio source.

Has anybody got any really useful links they’ve used for microphone input?

Thanks :slight_smile:

2 Answers

2

The sample script at the link expects an AudioSource() component to be attached to the same game object as this source. Select your game object in the hierarchy and do: Component > Audio > AudioSource

The code at the link expects an AudioSource on the same game object as the script. So select that game object in the hierarchy, and do:

 Component > Audio > AudioSource