Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Audio SDK - Convolution Reverb - How to Use Custom Samples/Impulse Responses

Discussion in 'Audio & Video' started by krkumar11, Jun 26, 2015.

  1. krkumar11

    krkumar11

    Joined:
    Jun 26, 2015
    Posts:
    4
    I'm new to Unity and am trying to familiarize myself with the Audio SDK as part of my research on spatial audio and convolution. Can someone please help me understand how to load my own impulse response (IR) into the demo convolution reverb plugin?

    I see C++ functionality to upload an IR in Plugin_ConvolutionReverb.cpp:

    cppFile.png

    And the C# ConvolutionReverbCustomGUI.cs file declares a GetSampleName function on line 8:

    csFile.png


    Should I be writing additional code within the .cpp file to read an audio file of my choice (using e.g. a library like libsndfile) and manually enter all of the necessary parameters in the code? Or am I perhaps missing something obvious that will enable me to choose an IR file using the included Convolution Reverb GUI? I see a "Use Sample" parameter, but I can't figure out how to actually specify/upload the sample(s) in the first place.

    GUI.png


    Any and all help would be greatly appreciated!
     
  2. krkumar11

    krkumar11

    Joined:
    Jun 26, 2015
    Posts:
    4
    So I managed to put in my own artificial IR (a simple sine wave) by...

    ...declaring the ConvolutionReverbCopy_UploadSample function that's specified at the bottom of the plugin code
    cCode.png

    ...so that I could use the function directly farther down in the CreateCallback function
    cCode2.png

    ...and the sample shows up as I had hoped in the plugin GUI in Unity
    gui.png


    However, I'm still wondering if there's some sort of built-in GUI that let's me do the same thing (i.e. upload my own impulse responses). Since I'm neither familiar with C# nor with Unity scripting in general, I would really appreciate either finding out where I can easily specify files to upload or a starting point for some simple GUI code that can achieve the same thing.
     
  3. stefanm140

    stefanm140

    Joined:
    Aug 31, 2015
    Posts:
    5
    This is extremely helpful thank you! But I still don't quite understand where to declare the ConvolutionReverb_UploadSample. Also how can I upload a sound file of a recorded impulse response? I have absolutely no experience with C++ so i'm struggling to find the appropriate way to do this.
     
  4. stefanm140

    stefanm140

    Joined:
    Aug 31, 2015
    Posts:
    5
    Disregard.. I realised there is a C# Script in Assets/Scripts called "ConvolutionReverbUploadIR" that basically does it for you.
     
  5. MadWork

    MadWork

    Joined:
    Jun 17, 2016
    Posts:
    1
    Hi there,
    I'm struggling to see where/how you upload a recorded impulse response in the ConvolutionReverbUploadIR script. Would anyone be able to give me advice on this please?
     
  6. PsiloCybian

    PsiloCybian

    Joined:
    May 14, 2015
    Posts:
    4
    I know this is a suuuuper old topic but Is the convolution plugin still available, i cant find it in the plugins list
     
  7. ctsalidis

    ctsalidis

    Joined:
    Jun 22, 2015
    Posts:
    3