filoe / cscore

An advanced audio library, written in C#. Provides tons of features. From playing/recording audio to decoding/encoding audio streams/files to processing audio data in realtime (e.g. applying custom effects during playback, create visualizations,...). The possibilities are nearly unlimited.
Other
2.17k stars 450 forks source link

[QUESTION] How to setup a Reverberation in Unity #489

Open zenhund74 opened 1 month ago

zenhund74 commented 1 month ago

Hi, I'm trying to find a good reverb for streaming audio in unity with OnAudioFilterRead. I managed to get Freeverb working in an older Version approximately like this:

` fluid_revmodel Reverb = new fluid_revmodel(48000, 256);

 void OnAudioFilterRead(float[] data, int numChannels)
{
   int monoLength = data.Length / numChannels;
   float[] monobuffer = new float[monoLength];
   float[] left_out = new float[monoLength];
    float[] right_out = new float[monoLength]; 

  //Convert Stereo to mono if necessary

    Reverb.fluid_revmodel_processmix(monobuffer, left_out, right_out);

         int j = 0;
        for (int i = 0; i < data.Length - 1; i += 2)
        {
            data[i] = left_out[j];
            data[i + 1] = right_out[j];
            j++;
        }

} ` Can you explain to me on how to do that with the CSCore effects?

zenhund74 commented 1 month ago

I understand now why I found reverb related cs files with only parameters in them. So waves reverb is a part of DirectX.Audio Thank you, still!