# Get sound data after dsp processing

**URL:** <https://qa.fmod.com/t/get-sound-data-after-dsp-processing/16089>\
**Category:** Unity\
**Created:** [August 19, 2020, 7:57am UTC](https://qa.fmod.com/t/get-sound-data-after-dsp-processing/16089 "2020-08-19T07:57:12Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![ouya](https://avatars.discourse-cdn.com/v4/letter/o/9e8a1a/32.png) [@ouya](https://qa.fmod.com/u/ouya)\
**Post date:** [August 27, 2020, 2:01am UTC](https://qa.fmod.com/t/get-sound-data-after-dsp-processing/16089/3 "2020-08-27T02:01:22Z")

</div>

hey cameron

Thank you for your reply. I have already finished using Sound::lock to access to the audio data. But it seems that the data is from the original sound. What I want is to get the PCM data from the processed sound by some DSP effect.

I try to add a custom DSP and I read the example ‘dsp\_custom’, but I can not fully understand this callback function. Is the data in the ‘data-\>buffer’ PCM data？ I save these data in a text file and when I try to play sound from this file, it just sound like noise. I do some conversion for the type of the data because I need data in Int16.

PS: Is the function ‘getParameterData’ can be used to get the PCM data in this circumstance?

```auto
FMOD_RESULT F_CALLBACK myDSPCallback(FMOD_DSP_STATE* dsp_state, float* inbuffer, float* outbuffer, unsigned int length, int inchannels, int* outchannels)
{
	mydsp_data_t* data = (mydsp_data_t*)dsp_state->plugindata;
	//FILE* saveFile;
	ofstream savefile("G:\\app_zhanan\\data.txt", ios::app);
	int16_t buffer;

	for (unsigned int samp = 0; samp < length; samp++)
	{

		for (int chan = 0; chan < *outchannels; chan++)
		{

			data->buffer[(samp * *outchannels) + chan] = outbuffer[(samp * inchannels) + chan] = inbuffer[(samp * inchannels) + chan] * data->volume_linear;
			float num = data->buffer[(samp * *outchannels) + chan];
			int32_t temp = *(int*)& num;
			int16_t conversion = temp & ~(0xFFFF << 16);
			//int16_t conversion = (int16_t) num;
			//int16_t* conversion = reinterpret_cast<int16_t*>(&num);
			savefile << conversion << endl;
			//cout << *conversion << endl;

		}
	}
	data->channels = inchannels;
	savefile.close();
	return FMOD_OK;
}

```

---

_[View the full topic](https://qa.fmod.com/t/get-sound-data-after-dsp-processing/16089)._
