0

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);
    ERRCHECK(result);

    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);
    ERRCHECK(result);

    result = system->getMasterChannelGroup(&mastergroup);

    ERRCHECK(result);

    [self createAllDSP];

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

-(void) playSound
{
    result = system->playSound(sound, 0, false, &channel);
    ERRCHECK(result);
    //result = channel->setLoopCount(1);
   // ERRCHECK(result);
}
badboy_tqj
  • 300
  • 2
  • 14

1 Answers1

1

Your question is quite broad, I encourage you to refocus on the areas you are having trouble with.

To answer your question generally though, there are several APIs you will need to achieve your goal, you have some of them in your code.

To get the FMOD system ready to output a .wav:

  • System_Create
  • System::setOutput
  • System::init

To create and prepare the desired effect:

  • System::createDSPByType
  • System::addDSP

To create and play the desired sound:

  • System::createSound
  • System::playSound

To check when the sound is done:

  • System::update
  • Channel::isPlaying

To shutdown and finialize the .wav

  • Sound::release
  • System::release

This is a basic outline of one way you can achieve your goal with FMOD.

Mathew Block
  • 1,613
  • 1
  • 10
  • 9