external audio trigger... how to do this?

Hello everyone. I’m new to Unity, an experienced concept and 3D artist, but not much of a programmer. I can deal with scripts, but not much beyond that. I have a concept that involves characters reacting to external sound… a sort of ‘dumb-audio’ trigger. The user makes a sound and unity receives that as a trigger for an event. All of the audio queries I’ve been able to find deal with audio sources from in-game sources.

  1. Is it possible to receive external audio?
    (I’m not interested in recognition etc. just a simple threshold filter that says “if audio level more than x, then launch event”
  2. If it’s not in the basic unity package, how involved would it be to program this?
    (Intended use is for iOS / android devices with built in audio mics).

I would appreciate any pointers to how to query better search results, etc. And of course, any direct feedback. Thanks!

Hey,
Whilst I don’t have the answer for you (what you’re talking about sounds like something which you’d have to become quite a programmer to achieve), what I suspect you should be looking at is the Microphone class. Information here: Unity - Scripting API: Microphone

You’ll need to get access to the audio stream from the Mic (no idea how - I’ve never used it), and once you’ve done that, you’ll need to work into audio recognition in order to try to pick out the sounds you’re after. You’ll probably have to use something like fourier transforms, based on multiple samples to ‘train’ your recognition system to do this.

Key issue being that unless you want very simple sound triggering (like an input over a certain db level), it’s going to be quite a task.

Sorry it isn’t better news - I guess there might be a plugin library available for unity to do what you’re after, but as I said, it’s a pretty specialist request, so I’d be surprised…

Best of luck. :slight_smile:

S7arbVck: thanks!
That’s exactly what I was hoping for… of course, having a nodal hookup interface or something would be great, but I don’t expect to be able to do this project without a programmer anyway. And yeah - we are looking at a fairly stupid yes/no trigger: no fancy filtering or voice recognition. Not yet, anyway. One step after the other.