Search Unity

[Released] Dissonance: Unity Voice Chat

Discussion in 'Assets and Asset Store' started by Nyarlathothep, Oct 27, 2016.

  1. olavrv

    olavrv

    Joined:
    May 26, 2015
    Posts:
    515
    What do I do to get this dump?
     
  2. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,938
    I'm not sure, that is going vary based on the platform where this happens. Which platform is the player build for?
     
  3. LastChaos

    LastChaos

    Joined:
    Dec 9, 2013
    Posts:
    39
    Is it possible to show the indicator to a local player that other players hear his speech? Tried using SpeakerIndicator.cs from the demo but it only works for remote players.
     
    Nyarlathothep likes this.
  4. Nyarlathothep

    Nyarlathothep

    Joined:
    Jun 13, 2013
    Posts:
    398
    The information to do that is available:
    • The DissonanceComms.Players collection has a list of all players.
    • Each VoicePlayerState object has a Rooms property which tells you what rooms they are listening to.
    • DissonanceComms.RoomChannels lists which rooms you are transmitting to.
    • DissonanceComms.PlayerChannels lists which players you are transmitting to directly.
    So if you cross reference the list of rooms a player is listening to, with the list of rooms you are transmitting to, that will tell you if that player can (probably) hear you. They may have muted you, but there's no way to detect that.
     
    LastChaos likes this.
  5. Oniros88

    Oniros88

    Joined:
    Nov 15, 2014
    Posts:
    150
    Read from location 0000000000000070 caused an access violation.

    Context:
    RDI: 0x0000027e2bb61a80 RSI: 0x0000027e009086c0 RAX: 0x0000027c90e5bd30
    RBX: 0x0000027e008f1ab0 RCX: 0x0000027e00911810 RDX: 0x0000000000000000
    RIP: 0x00007ff9f2f50356 RBP: 0x0000027dbad89540 SegCs: 0x0000000000000033
    EFlags: 0x0000000000010202 RSP: 0x0000009a4a1bed50 SegSs: 0x000000000000002b
    R8: 0x000000000000009f R9: 0x0000000000000000 R10: 0x0000027c90eba060
    R11: 0x0000000000000001 R12: 0x0000000000000001 R13: 0x0000000000000000
    R14: 0x0000027dbad89540 R15: 0x0000027e00851960


    Bytes at CS:EIP:
    48 8b 52 70 48 8b 42 08 ff d0 48 89 84 24 b8 00

    No mono DLL path set. This app is either running IL2CPP, or the crash occurred before mono was initialized.


    Stack Trace of Crashed Thread 36920:
    0x00007FF9F2F50356 (GameAssembly) [GAME\Library\Bee\artifacts\WinPlayerBuildProgram\il2cppOutput\cpp\Generics104.cpp:18587] VoiceSender_1_OpenRoomChannel_m44E25F8DD04BBECB88C448E0CB60255894D0A7E2_gshared
    0x00007FF9F24476E3 (GameAssembly) [GAME\Library\Bee\artifacts\WinPlayerBuildProgram\il2cppOutput\cpp\Assembly-CSharp17.cpp:22198] MembershipChanged_Invoke_m4C6FA04A2702EC755A0F6B0F364E483D1E78AF3B_Multicast
    0x00007FF9F2FD1D4E (GameAssembly) [GAME\Library\Bee\artifacts\WinPlayerBuildProgram\il2cppOutput\cpp\Generics14.cpp:16004] Channels_2_Open_m2D16FD85CBF74ED144048FF95EB6CB8258E886D4_gshared
    0x00007FF9F2B48260 (GameAssembly) [GAME\Library\Bee\artifacts\WinPlayerBuildProgram\il2cppOutput\cpp\DissonanceVoip.cpp:29506] VoiceBroadcastTrigger_OpenChannel_m9349A4895A384E749393DC488CD4619DDBD4CE7C
    0x00007FF9F2B48CC2 (GameAssembly) [GAME\Library\Bee\artifacts\WinPlayerBuildProgram\il2cppOutput\cpp\DissonanceVoip.cpp:28804] VoiceBroadcastTrigger_Update_m16DEC479330CA6A37151A3DE25C055AE932C3309
    0x00007FF9F27039D6 (GameAssembly) [C:\Program Files\Unity\Hub\Editor\2021.2.0b16\Editor\Data\il2cpp\libil2cpp\vm\Runtime.cpp:577] il2cpp::vm::Runtime::InvokeWithThrow
    0x00007FF9F27034A4 (GameAssembly) [C:\Program Files\Unity\Hub\Editor\2021.2.0b16\Editor\Data\il2cpp\libil2cpp\vm\Runtime.cpp:562] il2cpp::vm::Runtime::Invoke



    Having the same crash. I hope this can ring any bells. It crashes the moment the mic tries to broadcast anything. Until then it doesn't crash.
     
  6. Nyarlathothep

    Nyarlathothep

    Joined:
    Jun 13, 2013
    Posts:
    398
    As far as I can tell this has to be a Unity bug of some kind. The last bit of Dissonance code on the stack in that trace is the
    VoiceSender_1_OpenRoomChannel_m44E25F8DD04BBECB88C448E0CB60255894D0A7E2_gshared
    method which looks like this:

    Code (CSharp):
    1. private void OpenRoomChannel([NotNull] string room, [NotNull] ChannelProperties config)
    2. {
    3.   if (room == null) throw new ArgumentNullException("room");
    4.   if (config == null) throw new ArgumentNullException("config");
    5.  
    6.   using (var delta = _deltas.Lock())
    7.     delta.Value.Add(new ChannelDelta(true, ChannelType.Room, config, room.ToRoomId(), room));
    8. }
    As you can see there's nothing particularly unusual going on here!

    Generics104.cpp looks like it's something that IL2CPP generates, I can't find any details about it. The only generics in this method is the "_deltas" field (which is an instance of
    ReadonlyLockedValue<List<ChannelDelta>>
    , see here).

    @JoshPeterson any ideas on what the problem may be and any potential workarounds?
     
  7. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,938
    No, I'm not sure off the top of my head, sorry! This does look like a bug though. Can you submit a bug report for this?

    https://unity3d.com/unity/qa/bug-reporting
     
    Nyarlathothep likes this.
  8. Nyarlathothep

    Nyarlathothep

    Joined:
    Jun 13, 2013
    Posts:
    398
    @Oniros88 would you mind submitting a big report to Unity, with your repro project attached? Linking this thread for extra details would be a good idea. If you'd rather not do that just say the word and I'll make a bug report instead :)
     
  9. Oniros88

    Oniros88

    Joined:
    Nov 15, 2014
    Posts:
    150
    i'm sorry I can't do that soon! I would be thankful if you could instead
     
    Nyarlathothep likes this.
  10. Oniros88

    Oniros88

    Joined:
    Nov 15, 2014
    Posts:
    150
    Last version 8.0.3 still causes a crash with Il2CPP build upon trying to broadcast audio.
     
    Nyarlathothep and olavrv like this.
  11. olavrv

    olavrv

    Joined:
    May 26, 2015
    Posts:
    515
    Tested 8.0.3 with Unity 2021.2.0f1, still crashes in build (il2cpp)
     
    Nyarlathothep likes this.
  12. Nyarlathothep

    Nyarlathothep

    Joined:
    Jun 13, 2013
    Posts:
    398
    I've reproduced the issue and submitted a bug report to Unity. (link)
     
    Last edited: Oct 28, 2021
    Oniros88 and olavrv like this.
  13. olavrv

    olavrv

    Joined:
    May 26, 2015
    Posts:
    515
    Thank you very much!
     
    Nyarlathothep likes this.
  14. Oniros88

    Oniros88

    Joined:
    Nov 15, 2014
    Posts:
    150
    Nice! Thanks.
     
  15. olavrv

    olavrv

    Joined:
    May 26, 2015
    Posts:
    515
    Still crashing in latest 2021.2.1f1 version of Unity :(
     
  16. Nyarlathothep

    Nyarlathothep

    Joined:
    Jun 13, 2013
    Posts:
    398
    Unfortunately I don't think I can work around it. IL2CPP is just completely miscompiling things for some reason. The only thing I can suggest is to use Mono instead of IL2CPP until Unity fix this.

    I've tried commenting out the offending code, but this just seems to move the error elsewhere. If it was just one or two specific methods breaking I could just rewrite them in a way IL2CPP is ok with
     
  17. olavrv

    olavrv

    Joined:
    May 26, 2015
    Posts:
    515
    This is still not working in Unity 2021.2.2, if this is a Unity bug - when will it be fixed?
     
  18. Nyarlathothep

    Nyarlathothep

    Joined:
    Jun 13, 2013
    Posts:
    398
    It is definitely a Unity bug, unfortunately that means I can't give an ETA on it :(

    If you can reproduce the problem it may help to submit a bug report to Unity (Help > Report a Bug), more reports will bring more attention to the problem. If you do that, I suggest mentioning my issue (https://fogbugz.unity3d.com/default.asp?1376566_fqop67cbvqm9dphb) so they can link them together easily.
     
    olavrv likes this.
  19. PutridEx

    PutridEx

    Joined:
    Feb 3, 2021
    Posts:
    1,136
    Might be worth making a thread about this as a bug in the scripting section, some il2cpp developers are active there
     
    Nyarlathothep and olavrv like this.
  20. Nyarlathothep

    Nyarlathothep

    Joined:
    Jun 13, 2013
    Posts:
    398
    That's a good idea, I've started this thread. If you've encountered this error yourself feel free to add more information, that'll bring some more attention to it :)
     
    olavrv likes this.
  21. Nyarlathothep

    Nyarlathothep

    Joined:
    Jun 13, 2013
    Posts:
    398
    The IL2CPP bug seems to be fixed in Unity 2021.2.3f1 :D
     
  22. Oniros88

    Oniros88

    Joined:
    Nov 15, 2014
    Posts:
    150
    Wow for real? I have 2021.2.2, will update inmediately and try! I was already dreading having to ditch this asset as it works great in my project, very lightweight on the network.

    By the way did they tell what caused the bug and did they directly address it? I mean to know if they will be wary of breaking it again in a future update.
     
    Nyarlathothep likes this.
  23. Nyarlathothep

    Nyarlathothep

    Joined:
    Jun 13, 2013
    Posts:
    398
    Unity haven't really responded to the bug report yet it was another Dissonance user (olavrv) who spotted that it's fixed in 2021.2.3f1.

    FWIW we've never had an issue with IL2CPP miscompiling things before, so I think Unity generally do a pretty good job of avoiding this kind of bug. Personally I'm not too worried about it happening again :)
     
  24. Oniros88

    Oniros88

    Joined:
    Nov 15, 2014
    Posts:
    150
    I just tested it, and it works again! I hope it doesnt break anymore in the future, as it was broken for a long time until now. Finally we have voice chat ingame again!
     
    Nyarlathothep likes this.
  25. gokul_n_v

    gokul_n_v

    Joined:
    Mar 17, 2021
    Posts:
    5
    @Nyarlathothep had some issues in the latest version.. said the packages were changed when my project got upgraded and found these errors

    VoiceChat/Plugins/Dissonance/Core/Audio/Playback/DecoderPipeline.cs(159,17): error CS0815: Cannot assign void to an implicitly-typed variable

    VoiceChat/Plugins/Dissonance/Core/Networking/Server/ServerRelay.cs(68,20): error CS0029: Cannot implicitly convert type 'void' to 'System.ArraySegment<byte>'

    VoiceChat/Plugins/Dissonance/Core/Networking/Client/PeerVoiceReceiver.cs(126,21): error CS0815: Cannot assign void to an implicitly-typed variable

    VoiceChat/Mirror/Runtime/Transport/KCP/kcp2k/highlevel/KcpConnection.cs(178,13): error CS0177: The out parameter 'message' must be assigned to before control leaves the current method


    Could you please help me out??
    Thank You
     
    Nyarlathothep likes this.
  26. Nyarlathothep

    Nyarlathothep

    Joined:
    Jun 13, 2013
    Posts:
    398
    It looks like you may have an outdated version of Dissonance. Search in DecoderPipeline.cs for "CopyTo", you should only find "CopyToSegment". If you find any uses of "CopyTo" you've got an outdated version and need to upgrade. We've had some issues with Unity occasionally serving outdated content from the asset store downloader, so you may want to clear the cache before downloading and updating.

    The cause is that we used to have an extension method named `CopyTo` but Unity added a method with the same name but a different signature. The Dissonance calls to CopyTo resolve to the Unity method and cause these issues. We've renamed our method CopyToSegment to work around it.

    This isn't a Dissonance error, but I would guess it's a similar problem with outdated source files.
     
    gokul_n_v likes this.
  27. gokul_n_v

    gokul_n_v

    Joined:
    Mar 17, 2021
    Posts:
    5
    Hey @Nyarlathothep , thanks for the reply.

    Yes, I saw a 'CopyTo' function used in DecoderPipeline.cs and that is where I got the first error.
    I will try the updated code and will let you know. :)
     
    Nyarlathothep likes this.
  28. gokul_n_v

    gokul_n_v

    Joined:
    Mar 17, 2021
    Posts:
    5
    Hey @Nyarlathothep , sorry for the late feedback, I took a break after that.

    I have updated Dissonance and now I could successfully take a build. No errors.
    When I join a room and start speaking, I cant hear and also a warning is shown whenever I speak something.

    "[Dissonance:Network] (06:18:10:551) VoiceSender`1: Attempted to send voice before assigned a client ID by the host(100 packets discarded so far)"

    Can you please help me out with this?
    Thank you.
     
    Nyarlathothep likes this.
  29. Nyarlathothep

    Nyarlathothep

    Joined:
    Jun 13, 2013
    Posts:
    398
    If you run the demo scenes (included in the Dissonance+Mirror integration folder) do you see this error?
     
  30. gokul_n_v

    gokul_n_v

    Joined:
    Mar 17, 2021
    Posts:
    5

    Sorry for the late reply.. got hung up with work..
    I actually didn't try using the demo scenes.. I tried the demo scene only once with the older version..
     
  31. Nyarlathothep

    Nyarlathothep

    Joined:
    Jun 13, 2013
    Posts:
    398
    If you've still got this problem could you try out the demo scene, that'll narrow down if the issue is a setup issue in your scene or something else.
     
  32. gokul_n_v

    gokul_n_v

    Joined:
    Mar 17, 2021
    Posts:
    5
    Hey @Nyarlathothep ,
    Thank you for helping me.
    I'm using Unity 2020.1.0f1, So everything is fixed. No issues.
    Thanks a lot. <3
     
    Nyarlathothep likes this.
  33. Oniros88

    Oniros88

    Joined:
    Nov 15, 2014
    Posts:
    150
    Do you plan on any extension for Fish Networking?
     
    Nyarlathothep likes this.
  34. Nyarlathothep

    Nyarlathothep

    Joined:
    Jun 13, 2013
    Posts:
    398
    I haven't heard of Fish Networking before, so it's not something we have planned. Of course if enough people request it, we'll probably release a free integration!
     
  35. olavrv

    olavrv

    Joined:
    May 26, 2015
    Posts:
    515
    Hello @Nyarlathothep, just purchased NatDevice and added it to my project together with the dissonance NatDevice integration. Get 3 error messages in Unity (2021.2.12f1):

    Assets\Dissonance\Integrations\NatDevice\NatDeviceMicrophoneInput.cs(56,37): error CS1503: Argument 1: cannot convert from 'method group' to 'Action<AudioBuffer>'

    Assets\Dissonance\Integrations\NatDevice\NatDeviceMicrophoneInput.cs(58,37): error CS1503: Argument 1: cannot convert from 'method group' to 'Action<AudioBuffer>'

    Assets\Dissonance\Integrations\NatDevice\NatDeviceMicrophoneInput.cs(60,37): error CS1503: Argument 1: cannot convert from 'method group' to 'Action<AudioBuffer>'

    Using latest version of NatDevice (published february 15. 2022)
     
    Last edited: Feb 22, 2022
  36. Nyarlathothep

    Nyarlathothep

    Joined:
    Jun 13, 2013
    Posts:
    398
    The NatDevice package was recently changed in a way which has broken that integration, we'll publish a fix very soon.

    As a workaround, replacing the NatDeviceMicrophoneInput.cs file with this should work (that hasn't been fully reviewed/tested yet, so I'd advise upgrading to the version from the store when it comes out).
     
    olavrv likes this.
  37. olavrv

    olavrv

    Joined:
    May 26, 2015
    Posts:
    515
    Thank you very much for quick reply - you are always a lifesaver!
     
    Nyarlathothep likes this.
  38. olavrv

    olavrv

    Joined:
    May 26, 2015
    Posts:
    515
    @Nyarlathothep NatDevice now working, only having one issue - it chooses a line device instead of a microphone on startup. Is this possible to fix? Thanks!
     
    Nyarlathothep likes this.
  39. Nyarlathothep

    Nyarlathothep

    Joined:
    Jun 13, 2013
    Posts:
    398
    Another change that was made in this new version of NatDevice was exposing information about which device is the system default. So another change we're going to make in the integration is to properly use this information (previously we had to make an educated guess, which is obviously not working well in your case).

    Replace the
    ChooseAudioDevice
    method with this code. This will choose the default microphone device if you have clicked "Use System Default" in the inspector.

    Again, this hasn't been fully code reviewed yet so I recommend replacing it with the package when it comes out on the store!
     
    olavrv likes this.
  40. olavrv

    olavrv

    Joined:
    May 26, 2015
    Posts:
    515
    I tested NatDevice with Dissonance, but did not get any improvement in latency. Is there anything specific I need to do to improve latency with NatDevice? Thanks!
     
  41. Nyarlathothep

    Nyarlathothep

    Joined:
    Jun 13, 2013
    Posts:
    398
    There's nothing specific you need to do (other than simply using the new microphone input behaviour). The Unity `Microphone` class (which Dissonance normally uses) adds a lot of unnecessary buffering wheras NatDevice does not (instead it's providing audio directly from the device in callbacks). In my own tests (using a "USB Blue Snowball" mic) I get around 30ms less latency.
     
  42. olavrv

    olavrv

    Joined:
    May 26, 2015
    Posts:
    515
    @Nyarlathothep Sir, we found out that latency builds up when loading scenes runtime, so we tried running restart transmission pipeline after scene load is completed. This works great when we load large scenes (latency is almost zero), but the strange thing is that when loading smaller scenes (shorter load time) the latency becomes very long.

    We can't figure out what is causing this, and the only logic my old head can come up with, is that there is somewhere dissonance resets the buffer when "delay" is very long, but when the delay is shorter, it doesn't reset. But what do I know!? Just guessing and speculating...

    Appreciate any help with this, tips on how to solve it. Thanks you very much!!
     
    Last edited: Mar 4, 2022
    Nyarlathothep likes this.
  43. Nyarlathothep

    Nyarlathothep

    Joined:
    Jun 13, 2013
    Posts:
    398
    That's not something anyone else has reported to me. If you can reliably reproduce this could you turn Dissonance logging up to Debug for all categories (Window > Dissonance > Diagnostics) and send me the logs. Ideally one log from the sending side and another log from the receiving side so I can match up the timestamps.
     
  44. JWiser

    JWiser

    Joined:
    May 25, 2021
    Posts:
    1
    @Nyarlathothep, I wanted to include some situation specific latency and packet dropping based on the state of some of my game objects.
    I found what seems to be the perfect solution in DebugSettingsEditor.cs but it is commented out.
    In this Placeholder Software video from 2016, it appears in the editor:


    After looking through the changelog I couldn't find anything about this being removed/deprecated. Does it still work?
    Also is there a way to change the min/max latency and PacketLoss while a scene is running?

    Failing this, other distortions or noise filters would be okay if the above is not possible.
    If it comes to this, what would you recommend?
    (using Unity netcode for GameObjects)

    Any help would be very much appreciated!
     
    Last edited: Mar 11, 2022
    Nyarlathothep likes this.
  45. Nyarlathothep

    Nyarlathothep

    Joined:
    Jun 13, 2013
    Posts:
    398
    The latency/loss simulation settings were removed a very long time ago during some other changes to the network system. For testing it always made more sense to use something like Clumsy instead which affects the entire network system instead of just Dissonance.

    This was never something that you should use for something other than debugging though! Applying audio filters to the output is definitely the right way to go if you want some kind of distortion effect. Before I explain how to do this, a note of caution: it can be tempting to apply extreme audio effects to voip (e.g. totally deafen a player when a flashbang grenade goes off), however all this will do is push players to not use your in game voip at all! If you're going to apply audio effects to voip I strongly recommend that you keep them very mild.

    To apply an effect create a custom playback prefab (docs) and attach an audio filter to that. You can attach other scripts to modulate the filter on a per-speaker level (there's a unique instance per remote speaker). You need to attach some of the scripts in a specific order:
    • AudioSource
    • VoicePlayback
    • SamplePlaybackComponent
    • Audio filter
    • Audio filter
    • Audio filter
    • etc
    If you want to identify which player an instance if for you can get the Dissonance player ID from the
    VoicePlayback.PlayerName
    property.
     
  46. Neltor

    Neltor

    Joined:
    Sep 9, 2015
    Posts:
    5
    Has anyone tested Dissonance on a Hololens 2? Does it work?
     
  47. Nyarlathothep

    Nyarlathothep

    Joined:
    Jun 13, 2013
    Posts:
    398
    Hi Neltor, I haven't personally tested it on a Hololens 2 but we've had quite a few customers who have reported that it all works as expected :)
     
  48. ChrisHandzlik

    ChrisHandzlik

    Joined:
    Dec 2, 2016
    Posts:
    205
    Hi, I'm having some issues with dissonance and Oculus Quest 2. It doesn't capture voice when quest-native screen(and voice recording) is enabled.

    I'm wondering if that means Quest itself is consuming the stream (when native-recording is on) and simply not passing it to the application?

    If so is there any workaround?

    Thanks
     
  49. Nyarlathothep

    Nyarlathothep

    Joined:
    Jun 13, 2013
    Posts:
    398
    I'm not certain (I don't have a Quest) but it looks like the Quest takes direct control of the mic and prevents any other applications from using it while screen recording is enabled. I've looked through the docs but unfortunately I can't see any way to work around that.
     
    ChrisHandzlik likes this.
  50. CloudyVR

    CloudyVR

    Joined:
    Mar 26, 2017
    Posts:
    715
    Does this asset work in Unity 2019?

    In the asset store it said 2020.3.23 or higher so I didn't purchase it.

    But my project is Unity 2019.4.39f1, and Mirror does work in Unity 2019 so I was wondering why this asset needs 2020 to work?
     
    Nyarlathothep likes this.