Game Development Community

Audio Capture Asset

by Samuel Cartwright · in Torque 2D Professional · 02/22/2013 (9:17 pm) · 7 replies

I've implemented an Audio Capture Asset (my own asset class) to grab an audio stream from the microphone - this will be to integrate pitch and amplitude detection into a game (my test OSX and iOS apps work fine, not I'm trying to work my code into T2D).

I'm ok with how the assets plug into the framework, but so far I'm at a loss as to how I can implement a callback - say, when my stream buffer is full it returns the data to the torque script, or when a certain pitch it detected a torquescript callback is called.

I played around a bit with the old TGB, but the new engine seems a bit more complicated and I'm still wrapping my head around everything.

Is there anyone who can point me in the right direction?

Cheers,
Sam

#1
02/28/2013 (1:57 pm)
An asset is just that. An asset. It is the pipeline for feeding asset data into the engine.

You'll want to write a SimObject that can then take your new asset in, and use it. The asset would provide raw audio data that you can pull into your SimObject and use however you want (callbacks, etc).

#2
03/01/2013 (12:40 pm)
How are you doing pitch detection? I am doing FFT for general spectrum analysis in T3D, but if I were doing discrete pitch detection there is another algorithm that would be better to pick out notes. That is why I am asking as this is something I am doing. I will also be releasing my code soon so that if you wanted to pick stuff out of it you could.
#3
03/01/2013 (1:07 pm)
I'm using the Aubio framework. Its a little involved to get going, but does pretty much everything.
#4
03/02/2013 (2:36 am)
Cool looking library. Other than it being GPL it looks pretty good. For free apps it would be fine, though it will require you release your code as GPL. For a commercial app I would steer clear.
#5
03/04/2013 (1:02 pm)
I'm using the Aubio framework. Its a little involved to get going, but does pretty much everything.
#6
03/04/2013 (1:52 pm)
Aubio is licensed GPL: aubio.org/

Sorry I was not clear as to which library I was talking about.
#7
03/04/2013 (2:08 pm)
Frank,
You were totally clear. Just looks like the forum posted my post twice... odd.
Just fooling around at the moment, so not too concerned with licences. But I'll see where it leads.