# Adjust the sound effect without playing the sound

**URL:** <https://qa.fmod.com/t/adjust-the-sound-effect-without-playing-the-sound/19186>\
**Category:** FMOD Engine\
**Tags:** cpp\
**Created:** [August 25, 2022, 1:31pm UTC](https://qa.fmod.com/t/adjust-the-sound-effect-without-playing-the-sound/19186 "2022-08-25T13:31:19Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![FineJared8](https://avatars.discourse-cdn.com/v4/letter/f/e19adc/32.png) [@FineJared8](https://qa.fmod.com/u/FineJared8)\
**Post date:** [August 25, 2022, 1:31pm UTC](https://qa.fmod.com/t/adjust-the-sound-effect-without-playing-the-sound/19186/1 "2022-08-25T13:31:19Z")

</div>

We are developing various audio data processes such as this one: first, through processing to the current way, such as adding MOD to PCM by collecting PCM data, after processing, input the processed data into virtual sound. The problem I am currently encountering is how to make the FMOD engine work without playing. I have seen a lot of examples, all of them are called, and the playback code is like this:  
result = system-\>playSound(sound, 0, 0, &channel);

---

<div class="post-metadata">

**Author:** ![jeff\_fmod](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/jeff_fmod/32/1766_2.png) [@jeff\_fmod](https://qa.fmod.com/u/jeff_fmod)\
**Post date:** [August 29, 2022, 2:15am UTC](https://qa.fmod.com/t/adjust-the-sound-effect-without-playing-the-sound/19186/2 "2022-08-29T02:15:40Z")

</div>

You only need to call `System::playSound` if you want to play the sound back, and you do not need to play the `Sound` in order to modify its audio data. To get a pointer to the `Sound`’s audio data call [`Sound::lock`](https://fmod.com/docs/2.02/api/core-api-sound.html#sound_lock). With that you can manipulate the audio data as required, and when you are finished call [`Sound::unlock`](https://fmod.com/docs/2.02/api/core-api-sound.html#sound_unlock) to give control back to FMOD before playing it back with `System::playSound`.

---

<div class="post-metadata">

**Author:** ![FineJared8](https://avatars.discourse-cdn.com/v4/letter/f/e19adc/32.png) [@FineJared8](https://qa.fmod.com/u/FineJared8)\
**Post date:** [August 30, 2022, 3:26am UTC](https://qa.fmod.com/t/adjust-the-sound-effect-without-playing-the-sound/19186/3 "2022-08-30T03:26:30Z")

</div>

Thanks for your reply. throught calling Sound::lock and Sound::unlock, I can modify pcm with my own algorithm. But I want to adjust pcm using FMOD not calling playSound. The below is my demo:

1. Read PCM from a vector cache:

FMOD\_RESULT F\_CALLBACK FmodService::pcmreadcallback(FMOD\_SOUND\* /_sound_/, void\* data, unsigned int datalen)  
{  
signed short\* stereo16bitbuffer = (signed short\*)data;  
do {  
mtx.lock();  
if (pcmVector-\>size() \<= 0) {  
mtx.unlock();  
Common\_Sleep(10);  
std::cout \<\< “read pcm failed.” \<\< std::endl;  
continue;  
}  
std::cout \<\< “read pcm” \<\< std::endl;  
\* stereo16bitbuffer++ = \*pcmVector-\>begin();  
pcmVector-\>erase(pcmVector-\>begin());  
mtx.unlock();  
datalen -= 2;  
} while (running && datalen \> 0);  
std::cout \<\< “read pcm ok!!!” \<\< std::endl;  
return FMOD\_OK;  
}

exinfo.pcmreadcallback = pcmreadcallback;  
result = system-\>createSound(0, mode, &exinfo, &sound);

// Is there a way to do dsp tuning without calling playSound?

result = system-\>playSound(sound, 0, 0, &channel);

1. Add Fmod Dsp effect the reason I used Fmod:

result = system-\>createDSPByType(FMOD\_DSP\_TYPE\_ECHO, &dspecho);  
result = mastergroup-\>addDSP(0, dspecho);

1. Get the pcm atfer DSP effect:  
result = captureDSP-\>getParameterData(0, (void\*\*)&captureData, &length, valuestr, 0);  
ERRCHECK(result);  
outf.write((char\*)captureData-\>buffer, captureData-\>length\_samples \* sizeof(float));

---

<div class="post-metadata">

**Author:** ![jeff\_fmod](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/jeff_fmod/32/1766_2.png) [@jeff\_fmod](https://qa.fmod.com/u/jeff_fmod)\
**Post date:** [September 6, 2022, 1:51am UTC](https://qa.fmod.com/t/adjust-the-sound-effect-without-playing-the-sound/19186/4 "2022-09-06T01:51:17Z")

</div>

I see- you cannot add a `DSP` to a `Sound`, you add a `DSP` to a `Channel`, and the `Channel` only exists after calling `System::playSound`. So you must call `System::playSound` to apply an effect.  
Why is it you don’t want to call `System::playSound`? If you don’t want to hear the sound then you can set the system’s output type to [FMOD\_OUTPUTTYPE\_NOSOUND\_NRT](https://fmod.com/docs/2.02/api/core-api-system.html?search=https%3A%2F%2Ffmod.com%2Fdocs%2F2.02%2Fapi%2Fcore-api-system.html%23FMOD_OUTPUTTYPE_NOSOUND_NRT#fmod_outputtype), though that will disable all sound for that system object. If you don’t want to hear just that sound, you can add a [FMOD\_DSP\_TYPE\_FADER](https://fmod.com/docs/2.02/api/core-api-common-dsp-effects.html#fmod_dsp_type_fader) to the end of the signal chain and set its volume to 0 so that no audio reaches the mixer.

---

<div class="post-metadata">

**Author:** ![FineJared8](https://avatars.discourse-cdn.com/v4/letter/f/e19adc/32.png) [@FineJared8](https://qa.fmod.com/u/FineJared8)\
**Post date:** [September 8, 2022, 7:39am UTC](https://qa.fmod.com/t/adjust-the-sound-effect-without-playing-the-sound/19186/5 "2022-09-08T07:39:13Z")

</div>

Thanks, I solve this problem by accustoming my own DSP.
