0
0

Is it possible to design an event that will use input from a microphone as its sound content?

I want to make it so that a user can record their own voice and then be able to manipulate it according to some pre-determined parameters.

  • You must to post comments
0
0

[quote="luckysnorkel":2bs0sw2s]Is it possible to design an event that will use input from a microphone as its sound content?

I want to make it so that a user can record their own voice and then be able to manipulate it according to some pre-determined parameters.[/quote:2bs0sw2s]

[b:2bs0sw2s]Note: I haven’t actually tried this =)[/b:2bs0sw2s]

You should be able to make an event using a ‘Programmer sound’ entry, applying whatever DSP effects are required.

Then in the program code attach the microphone input to the callback, when the FMOD engine tries to play the ‘Programmer sound’ at run-time.

Give it a try, and let us know how it goes!

cheers,
Templar

  • You must to post comments
0
0

Hi,

I am also trying to do the exact same thing. I have looked at the programmer sounds example, where the event callback is used. However I don’t understand how a sound is actually provided for the event?

I see
[code:1kwrutr0]
result = g_fsb->getSubSound(g_index_map[g_sound_index], subSound);[/code:1kwrutr0]
but don’t understand how this relates to the programmer sound event. Could someone explain this please?

Thanks
Tom

  • You must to post comments
0
0

[quote="td0239":1y53w0or]Hi,

I am also trying to do the exact same thing. I have looked at the programmer sounds example, where the event callback is used. However I don’t understand how a sound is actually provided for the event?

I see
[code:1y53w0or]
result = g_fsb->getSubSound(g_index_map[g_sound_index], subSound);[/code:1y53w0or]
but don’t understand how this relates to the programmer sound event. Could someone explain this please?

Thanks
Tom[/quote:1y53w0or]

FMOD Designer is used with the Event System, which doesn’t expose the low-level recording functionality. The above was an untested idea of how the programmer could connect data from the microphone (recording) and to an event (with a DSP chain defined by the sound designer in Designer) at run-time.

When the event system attempts to play a ‘programmer sound’ it generates a callback (as you have seen in the programmer sound example). The idea was instead of passing it a subsound from an FSB you’d send it the contents of the recording buffer.

I’m not sure it is worth all the trouble – as it requires the programmer to implement it. You might as well just implement the recording using the low level API.

cheers,
Templar

  • You must to post comments
0
0

I appreciate that, the reason I want to do it this way is so the designer can provide parameters to add effects. I know I can add effects in FMOD Ex but I want to try and maintain the designer->programmer model.

My problem is how to use the FMOD::Sound object of my recording in the callback. I believe I have to pass that handle into param2 of the callback, but is that as simple as:
[code:lnd1q415]param2 = sound[/code:lnd1q415]
(where sound is my recorded sound)?

Thanks
Tom

  • You must to post comments
0
0

Yes it is basically as simple as that. Probably something more like:

param2 = (void *)sound;

The recording example shows how to set up the FMOD::Sound object for recording.

-Pete

  • You must to post comments
0
0

Hmm thanks for the help, but this is just not working for me.

I have taken a step backwards, forgetting the recording part for now and using a mp3 resource just trying to get my sound to play in the programmer sound event. Here is a snippet from my callback method:

[code:2mc79rva]
case FMOD_EVENT_CALLBACKTYPE_SOUNDDEF_CREATE :
{
char *name = (char *)param1; // [in] (char *) name of sound definition
int entryIndex = *((int *)param2); // [in] (int) index of sound definition entry
FMOD::Sound **subSound = (FMOD::Sound **)param2; // [out] (FMOD::Sound *) a valid lower level API FMOD Sound handle
char soundName[128] = {0};

        subSound =  &sound;

        result = (*subSound)->getName(soundName, 128);
        ERRCHECK(result);

        status.text = [NSString stringWithFormat:@"SoundDef create callback '%s' (%d)", soundName, g_index_map[g_sound_index]];
        break;
    }

[/code:2mc79rva]

The status label correctly prints out the name of the sound, but just nothing is heard! If playing the sound directly on the System object it is heard.

I also tried the more direct:
[code:2mc79rva]param2 = (void *) sound[/code:2mc79rva] but no luck there either.

Here is how I create my sound:
[code:2mc79rva]
[[NSString stringWithFormat:@"%@", [[NSBundle mainBundle] pathForResource:@"01 Highway to Hell" ofType:@"mp3"]] getCString:buffer maxLength:200 encoding:NSASCIIStringEncoding];
result = system->createSound(buffer, FMOD_SOFTWARE | FMOD_LOOP_NORMAL, NULL, &sound);
ERRCHECK(result);

[/code:2mc79rva]

I am doing this directly in the programmer_sound example now so everything else is exactly the same as that. Does anyone know what I am doing wrong?

Thanks
Tom

  • You must to post comments
0
0

I have it working now – if anyone is wondering, this is the line you need in the callback:

[code:3sawxp1p]
*((FMOD::Sound **)param2) = sound;
[/code:3sawxp1p]

  • You must to post comments
0
0

[quote="td0239":12pu5wfh]I have it working now – if anyone is wondering, this is the line you need in the callback:

[code:12pu5wfh]
*((FMOD::Sound **)param2) = sound;
[/code:12pu5wfh][/quote:12pu5wfh]

Great to hear you’ve got it working. I’m interested to hear how the designer event is constructed. Is the programmer sound instance set to looping or one-shot? How is the performance? Have you attached any additional DSP yet?

cheers,
Templar

  • You must to post comments
0
0

Hi

The Programmer Sound is a one-shot. I tried using a looped one, but this didn’t make any difference. I had the System record loop flag set to true but it just plays back once. My workaround is to do looped record of 100 seconds length, and start my one-shot Event every 100 seconds. This effectively gives infinite playback.

I have tried different parameters set by the designer, and up to around 6 or 7 was handled nicely, with the GUI remaining responsive. These were things like echo, reverb, low pass / hi pass filters.

The designer also made a programmer sound with 2 tracks. They read the same input, but one had some effects on and a parameter to change the volume (so you were effectively mixing it in and out of the output) That was fine but having 3 of those slowed things down.

If anyone could get the real looping working i’d like to hear about it!

Thanks
Tom

  • You must to post comments
Showing 9 results
Your Answer

Please first to submit.