Search Unity

  1. If you have experience with import & exporting custom (.unitypackage) packages, please help complete a survey (open until May 15, 2024).
    Dismiss Notice
  2. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice

Question JUCE Plugins for Unity for Generative Audio from Game Objects

Discussion in 'Audio & Video' started by tgorti, Mar 17, 2023.

  1. tgorti

    tgorti

    Joined:
    Jun 1, 2021
    Posts:
    1
    Not sure if this question belongs on the JUCE forums or here. And apologies in advance if this topic is already covered somewhere, but after spending a day searching to no avail, I thought I’d ask here.

    I have a synth plugin that I’ve programmed in JUCE with build target as a Unity plugin (.bundle) and it works as intended when added to a mixer group in Unity, but is there a way to attach such a plugin to a game object to take advantage of Unity’s built-in 3d ambisonic spatialization for sound that is output from the plugin? Generally speaking, what are the preferred work flows for achieving generative game audio using JUCE? Is there a C# script required in Unity to work with the C++ plugin code?
     
  2. SeventhString

    SeventhString

    Unity Technologies

    Joined:
    Jan 12, 2023
    Posts:
    430
    I believe the synth plugin uses the Native Audio Plugin SDK which is only goes through the AudioMixer. Sadly there is currently no built-in way to emit sound that would be generated from a plugin from an AudioSource, which I believe is what you're looking for.

    However...

    DISCLAIMER: I have not personally tried what I am about to suggest.

    You could probably expose your C++ plugin in a canonical C# fashion and use it to feed an AudioSource sample buffer by implementing the OnAudioFilterRead method. According to the documentation :
    Keep me posted if you try that, I'm genuinely curious :D

    Cheers!
     
    Last edited: Mar 17, 2023
  3. pleasantPretzel

    pleasantPretzel

    Joined:
    Jun 12, 2013
    Posts:
    34
    I don't have any answers, sorry... BUT I do have a couple links that might help you go in the right direction.

    1. Gordon Webb YoutubeTutorial. Here, you can listen to him talk about your exact question, and that he plans to handle AudioSources and spatialization. So keep an eye out for a new video from him, or maybe you can reach out to him. youtube.com/watch?v=AyAQXPPXTNs&t=2236s

    2. Audio Helm Unity Asset. Are you familiar with this deprecated asset? The developer was able to create a audio native plugin synth (with JUCE), add it to a unity mixer as an effect, and then add a synth controller script to any game object that in turn would add an AudioSource component that could be set as a 3D audio source, which made use of the built-in 3D audio. Here's a video of him setting up his asset to provide a little more clear insight: youtube.com/watch?v=1oNWX0igFMo&t=80s

    I'm really sorry if this is not helpful to you! I figure at least these people have some relevant experience, and perhaps they can help out. Good luck!
     
    Last edited: Mar 19, 2023
    spakment likes this.