Is there a demo for add effects and export to wav files?

(tianqiujie) #1

Is there a demo for add effects and export to wav files?

I have searched, but not find a way to solve it.

Add effects to a input.wav file, and play it. and then export a new wav file with effects. please help me.

my code is :

 result = FMOD::System_Create(&system);
    result = system->getVersion(&version);
    if (FMOD_OK != result) {
        printf("FMOD lib version %08x doesn't match header version %08x", version, FMOD_VERSION);
   // result = system->setOutput(FMOD_OUTPUTTYPE_WAVWRITER);
   // ERRCHECK(result);
    char cDest[200] = {0};
    NSString *fileName=[NSString stringWithFormat:@"%@/addeffects_sound.wav", [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0]];
    [fileName getCString:cDest maxLength:200 encoding:NSASCIIStringEncoding];
    result = system->init(32, FMOD_INIT_NORMAL | FMOD_INIT_PROFILE_ENABLE, cDest);
    //result = system->init(32, FMOD_INIT_NORMAL, extradriverdata);
    result = system->getMasterChannelGroup(&mastergroup);
    [self createAllDSP];

-(void)createSound:(NSString *)filename
    //printf("really path = %s", getPath(filename));
    result = system->createSound(getPath(filename),  FMOD_DEFAULT, 0, &sound);
    [self playSound];

-(void) playSound
    result = system->playSound(sound, 0, false, &channel);
    //result = channel->setLoopCount(1);
   // ERRCHECK(result);

(Mathew Block) #2

It looks like you are most of the way there, the basic procedure is as follows:

  • Select wav writer output mode
  • Initialize FMOD system
  • Create sound
  • Create DSP effects
  • Play sound
  • Add DSP effect to playing channel
  • Call update regularly on the FMOD system
  • When playback is complete shutdown the FMOD system

It’s important to shutdown the FMOD system when you are done, this ensures the file is flushed to disk and the length is updated.