# How to save music effect

**URL:** <https://qa.fmod.com/t/how-to-save-music-effect/13688>\
**Category:** Unreal Engine\
**Created:** [February 2, 2018, 8:44am UTC](https://qa.fmod.com/t/how-to-save-music-effect/13688 "2018-02-02T08:44:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![790280811](https://avatars.discourse-cdn.com/v4/letter/7/f04885/32.png) [@790280811](https://qa.fmod.com/u/790280811)\
**Post date:** [February 2, 2018, 8:44am UTC](https://qa.fmod.com/t/how-to-save-music-effect/13688/1 "2018-02-02T08:44:16Z")

</div>

hi,dear:  
We have a feature, to save changed voice effect. But now I can play sound effect,can not save it.  
Could you give me a help ?

now I try it below,it can not success. I also can not add dsp effect to it. because I do not know how to add it . thanks for help .

```
    //start save file----------------------------------

    const char *path_cstr = env->GetStringUTFChars(path_jstr, NULL);
    system->createSound(path_cstr, FMOD_DEFAULT | FMOD_OPENONLY, NULL, &sound);
    /*
    Retrieve the sound information for the Impulse Response input file
*/
    FMOD_RESULT result;
    FMOD_SOUND_FORMAT irSoundFormat;
    FMOD_SOUND_TYPE irSoundType;
    int irSoundBits, irSoundChannels;
    result = sound->getFormat(&irSoundType, &irSoundFormat, &irSoundChannels, &irSoundBits);
    unsigned int irSoundLength;
    result = sound->getLength(&irSoundLength, FMOD_TIMEUNIT_PCM);

    if (irSoundFormat != FMOD_SOUND_FORMAT_PCM16)
    {
        /*
            For simplicity of the example, if the impulse response is the wrong format just display an error
        */
        LOGI("%s", "not pcm");
    }

    /*
        The reverb unit expects a block of data containing a single 16 bit int containing
        the number of channels in the impulse response, followed by PCM 16 data
    */
    unsigned int irDataLength = sizeof(short) * (irSoundLength * irSoundChannels + 1);
    short* irData = (short*)malloc(irDataLength);
    irData[0] = (short)irSoundChannels;
    unsigned int irDataRead;
    result = sound->readData(&irData[1], irDataLength - sizeof(short), &irDataRead);
    FILE *fpw = fopen("sdcard/voice_changed.pcm","wb+");
    fwrite(&irData[1], irDataLength, sizeof(short), fpw);
    fclose(fpw);
    free(irData);
    //end save file----------------------------------
```

---

<div class="post-metadata">

**Author:** ![cameron-fmod](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/cameron-fmod/32/261_2.png) [@cameron-fmod](https://qa.fmod.com/u/cameron-fmod)\
**Post date:** [February 7, 2018, 2:52am UTC](https://qa.fmod.com/t/how-to-save-music-effect/13688/2 "2018-02-07T02:52:09Z")

</div>

> [@](#):
>
> hi,dear:  
> We have a feature, to save changed voice effect. But now I can play sound effect,can not save it.  
> Could you give me a help ?
> 
> now I try it below,it can not success. I also can not add dsp effect to it. because I do not know how to add it . thanks for help .
> 
> ```
> //start save file----------------------------------
> 
> const char *path_cstr = env->GetStringUTFChars(path_jstr, NULL);
> system->createSound(path_cstr, FMOD_DEFAULT | FMOD_OPENONLY, NULL, &sound);
> /*
> Retrieve the sound information for the Impulse Response input file
> */
> FMOD_RESULT result;
> FMOD_SOUND_FORMAT irSoundFormat;
> FMOD_SOUND_TYPE irSoundType;
> int irSoundBits, irSoundChannels;
> result = sound->getFormat(&irSoundType, &irSoundFormat, &irSoundChannels, &irSoundBits);
> unsigned int irSoundLength;
> result = sound->getLength(&irSoundLength, FMOD_TIMEUNIT_PCM);
> 
> if (irSoundFormat != FMOD_SOUND_FORMAT_PCM16)
> {
> /*
> For simplicity of the example, if the impulse response is the wrong format just display an error
> */
> LOGI("%s", "not pcm");
> }
> 
> /*
> The reverb unit expects a block of data containing a single 16 bit int containing
> the number of channels in the impulse response, followed by PCM 16 data
> */
> unsigned int irDataLength = sizeof(short) * (irSoundLength * irSoundChannels + 1);
> short* irData = (short*)malloc(irDataLength);
> irData[0] = (short)irSoundChannels;
> unsigned int irDataRead;
> result = sound->readData(&irData[1], irDataLength - sizeof(short), &irDataRead);
> FILE *fpw = fopen("sdcard/voice_changed.pcm","wb+");
> fwrite(&irData[1], irDataLength, sizeof(short), fpw);
> fclose(fpw);
> free(irData);
> //end save file----------------------------------
> 
> ```

It looks like you are using our convolution reverb example as a guide, it also shows you how to make and add a DSP to channel or channelgroup.

Are you getting any errors or warnings?
