Search Unity

Official DOTS Audio Discussion

Discussion in 'Entity Component System' started by harini, Mar 28, 2019.

  1. mikaelK

    mikaelK

    Joined:
    Oct 2, 2013
    Posts:
    284
    ok thanks. Location in space of course.

    Cool. Nice to see your project progressing. I don't know much about unity co licensing. Does it allow me to use your framework and make profit with tools I use it in?

    As much I like to share. I have a mission to try to learn the system of how to make with money with the assetstore :D
     
    Last edited: Dec 1, 2021
  2. DreamingImLatios

    DreamingImLatios

    Joined:
    Jun 3, 2017
    Posts:
    4,266
    It is the same license as most of the DOTS packages. My understanding (I'm not a lawyer) is that you can use it as a dependency for commercial games and assets as long as it is used in a Unity project and is not used to develop a competing product (competing to Unity as a whole, having an alternate solution to a "free" feature of Unity that works exclusively in Unity seems to be fine).

    However, Unity owns all source and modified versions of the UCL package itself. So while you can modify it, you can't sell the modification standalone. And you can't prevent someone who hasn't paid for your product from using the modified version of the UCL package.

    So yeah. You can easily use it as a dependency for a Unity asset. Even better if you make it an optional dependency using assembly definition files. But if you need to make modifications to it directly, you probably want to PM me about it.
     
  3. mikaelK

    mikaelK

    Joined:
    Oct 2, 2013
    Posts:
    284
    Sounds good.
    I think I will give your framework a shot and maybe recheck megacity and how they created the audio there. I'll pm you later. Latest on the weekend.
     
    DreamingImLatios likes this.
  4. woodwindblues

    woodwindblues

    Joined:
    Nov 3, 2021
    Posts:
    4
    Are there any resources to get started with DOTS Audio? I am mostly interested in programming procedural/generative audio/compositions and from what I have seen, DOTS would be the way to go inside unity, but I have a hard time finding any resources on how to get started.
     
  5. webbgb

    webbgb

    Joined:
    Jan 26, 2019
    Posts:
    3
    There isn’t much. The simplest is the Demo project written by unity that has a sample oscillator and state variable filter to play with. But not sure it works out of the box because since it was written, the way the buffers work have changed (they were interleaved buffers but now separate buffers) so the project probably needs tweaking to work. That shows the basics. After that you will have to write your own DSP code.
     
  6. bashis

    bashis

    Joined:
    Mar 18, 2013
    Posts:
    8
    Can we have an update on this feature? At least a roadmap or something. It's been a while since we had no news whatsoever and honestly it doesn't sound like this is under any development.
     
  7. julian-moschuering

    julian-moschuering

    Joined:
    Apr 15, 2014
    Posts:
    529
    DOTS Roadmap | Unity |
     
  8. M-A_Ferguson

    M-A_Ferguson

    Unity Technologies

    Joined:
    Mar 17, 2022
    Posts:
    2
    @bashis, thanks for the question, and thanks to Julian for the quick reply.
    As you'll see with us going very public on DOTS development, I can say that DOTS audio evolved from an experiment into something part of a greater whole. High-performance, scalability and editor-wide workflows make more sense, and audio can exist in this new ECS-enabled engine when the time is right. In the public roadmap, there is now a card for ECS-based Audio, where we collect specific feedback on your expectations. Please use this tool as it makes it easier for us to process feedback. All you need to do is log in with your Unity ID in order to vote and comment on features.

    This is also why we have been exploring audio authoring workflows, hence the feedback we are gathering on these subjects in the audio authoring roadmap.

    Thanks for your understanding :)
     
    apkdev and Anthiese like this.
  9. webbgb

    webbgb

    Joined:
    Jan 26, 2019
    Posts:
    3
    I got to say that this is so disappointing - In reality the only way to implement current audio features (such as Interactive Music and Procedural Audio) will be through middleware and I think you will be seriously left behind with no hope of catching your competitors......so the result is inevitable. I will stop there as you have left me speechless.........
     
    cecarlsen likes this.
  10. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,789
    I think moving to middleware like FMOD Studio is a net gain for the community though. Not only is it pretty good, using it is also knowledge that will be useful to you even after you switch engines.

    Unity has completely abandoned audio since Unity 5.x.
     
  11. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Seemingly yes. FMOD, Fabric, WWISE, and even Master Audio give a lot of help. Self-plug here, but I am mentioning the rest.

    Who said anything about switching engines :)
     
  12. nathanjams

    nathanjams

    Joined:
    Jul 27, 2016
    Posts:
    304
    When I discovered this thread I was so excited.
     
  13. Zeroneth01

    Zeroneth01

    Joined:
    May 15, 2016
    Posts:
    4
    I have submitted my feedback on the public roadmap on the ECS-based Audio card. I do appreciate the work that was put into this originally, but I think this being delayed may be a good thing in the long run (even though it is a showstopper for me in the short term, with my specific use case). I think this will be good because they can take more time to create a user-friendly developer scripting interface, rather than the way DSPGraph was shaping up before. It was the exact functionality we needed, but it did not allow for simpler dsp graphs to be coded in an elegant way. Now they will also be able to build it on top of the improved ECS system as they continue to refine it, so it will likely end up more efficient and better designed. I think the only thing probably stopping them at the end of the day is probably finding the right person, and I hope that person will create a really good scripting interface. They could look at other DSP audio libraries with elegant interfaces (but huge amounts of possible functionality). It is possible to create an elegant interface and still allow for virtually any dsp use case or complex graph under the sun. And when it is finally built, the libraries can start to be built on top and ported, which is where the real fun begins. I have been watching this thread for three years, but I can always continue to work on other projects in the meantime. :)
     
  14. nathanjams

    nathanjams

    Joined:
    Jul 27, 2016
    Posts:
    304
    Yeah, that's a good point. Hopefully they are able to follow through as you suggest. There is a lot of potential.

    And you're right, there are other options. Currently setting up a project with FMOD and Csound, which will definitely cover my needs at the moment.
     
  15. mitaywalle

    mitaywalle

    Joined:
    Jul 1, 2013
    Posts:
    251
    Waiting for news about it. My Important usecase - realistic audio car engine by granular synthesizer, based on 1 sample,
    - like REV:

    - like GTA 5 vehicle audio:

    I've made some experiments with built-in ( FMOD-based) audio system, but its a bit less performance efficient, then could be with DSPGraph, and no performance-space left for any neat post-processing
     
  16. cecarlsen

    cecarlsen

    Joined:
    Jun 30, 2006
    Posts:
    862
    I have been following Unity's audio development for years with the naive hope that one day we would be able to work with realtime audio synthesis. So disappointing :(.

    Meanwhile, have you seen what can be done with UE5 Metasound?
    https://www.kvraudio.com/forum/viewtopic.php?t=567752
     
  17. deus0

    deus0

    Joined:
    May 12, 2015
    Posts:
    256
    Last edited: May 4, 2022
    videon and Anthiese like this.
  18. tomachinz

    tomachinz

    Joined:
    Mar 2, 2019
    Posts:
    15
    I agree it would be a game changer - pun intended - if we can access less than 128 sample buffers like an extreme 16 sample buffers if needed, with 32, 64 samples probably the sweet spot for me, and 256 the max for interactive music work.

    The Dante signal format defaults to 128 samples of 64 channels (4 ms), which is fine for sound re-inforcement and live audio because musicians onstage equipment and analog monitors provide analog feedback from gear putting out analog signals. By the time the sound comes out the PA it's moving away from the stage. 4 ms is fair.

    I like to use 32 samples when recording virtual instruments - so I can hear what I'm playing. A singer can dial in a headphone using no-latency analog electronics is how it's done in studios. While multi-tracking drums a bigger buffer is fine as it does not affect my ability to sync to my headphone click. It's the virtual and computer made synths that need it most.

    Spinning up 2700 hardware CPU interrupts per second sure is a job for her L1 caches (at 4 KB per CPU core is equal to 11 megabytes per second !) in terms of kernel to driver memory bandwidth to masturbate the CPU so close to the brink of collapse). Extra cores does not help. Only frequency.

    A leisurely 512 sample buffer only slaps the CPU in the face a mere 86 times per second only wasting 352 KB/sec on needless chit-chat and zeroing the registers etc. Ideally each channel can have it's own latency setup.
     
    Verne33 and Marald like this.
  19. dbarrade

    dbarrade

    Joined:
    Sep 13, 2013
    Posts:
    1
    Hi, firstly, thanks all for an awesome forum and thanks to Unity and the Dev's for DOTS and especially the fantastic work on DSPGraph! I don't want to sound ungrateful but have a couple of quesions...

    I'm trying to add sine wave sounds on collisions to a simple Android based vertical multiplayer pong style game, like the Hanimex TV game we had when I was a kid.

    The collision code is working... well, so far as in I can get a Debug.Log to tell me a collision happened and where:

    Code (CSharp):
    1.        
    2.  
    3.         private struct CollisionEventJob : ICollisionEventsJob
    4.         {
    5.             [ReadOnly]
    6.             public PhysicsWorld physicsWorld;
    7.  
    8.             public void Execute(CollisionEvent collisionEvent)
    9.             {
    10.  
    11.                 Debug.Log("Collision");
    12.                 CollisionEvent.Details collisionDetails = collisionEvent.CalculateDetails(ref physicsWorld);
    13.  
    14.                 PlaySineTone(300f + (collisionDetails.AverageContactPointPosition.y * 3f), 0.1f);
    15.  
    16.             }
    17.         }
    18.  
    19.  
    I'm trying to base my PlaySineTone(Frequency, Duration) code on the sample given in DSPGraph Audio Framework 0.10-preview.22 and the bit that I am having trouble with looks like this in the sample SineToneBehaviour.cs

    Code (CSharp):
    1.        
    2.  
    3. void OnGUI()
    4.         {
    5.             if (GUI.Button(new Rect(10, 10, 150, 100), "Play"))
    6.             {
    7.                 var output = new SineToneOutput { Frequency = Frequency };
    8.  
    9.                 if (m_Handle.Valid)
    10.                     m_Handle.Dispose();
    11.                 m_Handle = output.AttachToDefaultOutput();
    12.                 StartCoroutine(TimeoutSine(Duration));
    13.             }
    14.         }
    15.  
    16.         IEnumerator TimeoutSine(float time)
    17.         {
    18.             yield return new WaitForSeconds(time);
    19.  
    20.             if (m_Handle.Valid)
    21.                 m_Handle.Dispose();
    22.         }
    23.  
    24.  
    I really would like to see some sample code where SineToneOutput includes a duration as well as a frequency.

    The use of StartCoroutine here in the middle of a DOTS sample has totally thrown me and I just don't know where to start to implement something similar that I can use within a DOTS System.

    I'd really appreciate if someone could point me in the right direction please. What is best practice to implement a pure DOTS Duration timer, and should I do this by having a counter on an entity as a component? Should I spawn a new entity at the point of the collision that plays the Sine Tone? Can I just do something quick and easy at the point where I do the Debug.Log in my code above, I feel like that is probably a bad idea?

    On a side note, the bit that does if (m_Handle.Valid) and m_Handle.Dispose() doesn't seem to work on my Android device, I did something very inefficient to get around it, basically creating an array of handles and incrementing the handle index with every sound I played, and not bothering with the Valid check, otherwise it just seemed to hang.
     
  20. thiagolrosa

    thiagolrosa

    Joined:
    Feb 22, 2017
    Posts:
    60
    Hi all,

    Unity 2020.3.36f1

    If I'm not using DOTS, how could I have hundreds of fatal crashes related to DSPGraph?

    Code (CSharp):
    1.       #00 pc 00000000000f1d68 (?? ??:0)
    2.       #01 pc 000000000021e3f4 (PlayableDirector::RebindPlayableGraphOutputs(ScriptingExceptionPtr*) at ??:?)
    3.       #02 pc 000000000021e3b0 (PlayableDirector::RebindPlayableGraphOutputs(ScriptingExceptionPtr*) at ??:?)
    4.       #03 pc 000000000021b534 (DSPGraph::QueueCommand(DSPCommandBlockHandle const&, DSPGraphCommandType, void*) at ??:?)
    or

    Code (CSharp):
    1.       #00 pc 00000000000f8754 (?? ??:0)
    2.       #01 pc 000000000021e480 (ScriptPlayableOutput* PlayableGraph::CreateOutput<ScriptPlayableOutput>(char const*) at ??:?)
    3.       #02 pc 000000000021bb14 (AtomicNode* DSPGraph::FetchCommandNode<DisconnectByPortsCommand, DSPNodeHandle&, unsigned int&, DSPNodeHandle&, unsigned int&>(DSPNodeHandle&, unsigned int&, DSPNodeHandle&, unsigned int&)
    4.       #03 pc 000000000029f04c (dynamic_array<SearchEntry, 0ul>::~dynamic_array() at ??:?)
     
  21. WAYNGames

    WAYNGames

    Joined:
    Mar 16, 2019
    Posts:
    992
    An asset is using it maybe ?
    In the advanced setting of the package manager enable the "show dependencies" option and chack if you see the package after that.
     
  22. thiagolrosa

    thiagolrosa

    Joined:
    Feb 22, 2017
    Posts:
    60
    I checked the dependencies and didn't find anything related to DOTS or DSPGraph.

    Maybe some third party asset not installed through package manager? I'm using MasterAudio plugin for example...
     
  23. zollenz

    zollenz

    Unity Technologies

    Joined:
    Jun 4, 2019
    Posts:
    27
    Any mentions of com.unity.audio.dspgraph in Packages/manifest.json or Packages/packages-lock.json?

    Re: third party assets, try to add one at a time to a blank project and see if someone might be adding the package through script.