Search Unity

Control Audio Mixer Group Volume by Code AND Snapshot

Discussion in 'Audio & Video' started by KayaOrsan, Jun 4, 2015.

  1. KayaOrsan

    KayaOrsan

    Joined:
    Jan 22, 2013
    Posts:
    20
    As you know, if you expose a variable in your mixer, and then set it using SetFloat, any Snapshots and Snapshot transitions will lose control of that variable.

    Here's my problem:

    Say I have groups Master, and Music. I want to give the player volume control. So I expose the Attenuation -> Volume variables, and hook em up to sliders.

    What if I want to use a "Menu" Snapshot where I'd like to only have 50% volume on my Music group? If the player set the Music volume to 100%, then even in the Menu Snapshot, Music will always be at full volume. Whereas I'd want it to be 50% if the user set the volume to 100%. And 30% if the player set his volume to 60%, etc. You get the idea.

    I can't have a second Attenuation effect on a group, so I got a problem here.

    Would appreciate any tips. Thanks.
     
  2. blizzy

    blizzy

    Joined:
    Apr 27, 2014
    Posts:
    775
    Use another group as a wrapper. So basically your "Music" group gets input from the music audio source, and the volume is driven by snapshots. Then another group wrapping the "Music" group could have the volume exposed to scripts.

    Edit: Uh, I guess I meant "mixer" instead of group. I don't have access to Unity right now, and haven't played with the mixer for a while. But I hope you get the idea.
     
  3. KayaOrsan

    KayaOrsan

    Joined:
    Jan 22, 2013
    Posts:
    20
    Hey blizzy,

    I've thought about that too, but unfortunately that leads to a very awkward setup of groups and/or mixers.
    For example, you might have a SFX group. You could make it the child of a "SFX Wrapper" group, and control the SFX Wrapper volume via code. But this becomes unwieldy the more groups you have.

    Using groups only:

    Code (CSharp):
    1. - Master
    2.     - Master Wrapper
    3.         - SFX Wrapper
    4.             - SFX
    5.         - Music Master
    6.             - Music
    7.         - Dialogue Master
    8.             - Dialogue
    9.  
    10. etc.
    I mean just imagine a bunch of groups in SFX alone you'd wanna set via code and snapshots. Foley, Ambiance, etc.

    Second method, what I believe is what you meant, is to make different Mixers for each parent group. For example, a Mixer for SFX, a Mixer for Music etc. And then link those Mixers to the groups of a Wrapper Mixer. The problem there is that if you want to use snapshots, you'd have to set up your snapshots across all your mixers. If you have 10 groups, you need 1 snaptshot on each and every one, and you need to transition them simultaneously. Can't use snapshots on the Wrapper since that's the one we control via code.

    It looks like it would be great if we could just add more than one "Attenuation" effect to our groups. That would solve this entire problem. Let one be used by the Snapshots, and one by the exposed variables.
     
  4. blizzy

    blizzy

    Joined:
    Apr 27, 2014
    Posts:
    775
    Yes, that's what I meant. Sorry for causing any confusion there - like I've said, I can't play with the mixer at the moment. The question is, do you really have 10 groups? And aside from that, I guess you probably will want to separate them anyway to be able to separately control their volume using snapshots.

    But I agree, the current situation is not ideal.
     
  5. Hikiko66

    Hikiko66

    Joined:
    May 5, 2013
    Posts:
    1,304
    Maybe it's easier to just cap it in code
    Times their selection by 0.5 before sending it to the mixer
     
  6. KayaOrsan

    KayaOrsan

    Joined:
    Jan 22, 2013
    Posts:
    20
    That would defeat the entire purpose of Audio Mixer Snapshots
     
  7. Hikiko66

    Hikiko66

    Joined:
    May 5, 2013
    Posts:
    1,304
    Oh right, the snapshots lol. Pretty much sub groups then as already suggested, and rejected.

    It would be nice to have someone from Unity in this thread giving advice on how to do this, or taking notes about these issues so Unity can provide solutions in a future version.
     
    Last edited: Jun 5, 2015
    blizzy and aihodge like this.
  8. KayaOrsan

    KayaOrsan

    Joined:
    Jan 22, 2013
    Posts:
    20
    blizzy likes this.
  9. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    That's your opinion, and you're definitely entitled to it. My opinion: if it was the best one, it wouldn't be free. It's free because no one was buying it (same as SoundManagerPro) for many months - zero reviews at that time. InAudio may or may not be able to do something our plugin can't do, and vice versa. It does look good, although the UI is not very intuitive IMHO (definitely miles better than Audio Toolkit though). Master Audio can definitely solve this problem too. But yeah, it's not free and never will be. For the free solutions on the Asset Store, it does look best. Outside the Asset Store, there's Fabric, FMod and WWISE, all of which are very complex and can be used for free if your game budget is under I think $100,000.

    I'd definitely appreciate you sharing your thoughts with us privately about Master Audio, if it was one of the ones you tried. Or did you only "research" without downloading and using the plugins?

    Anyway, I don't want to detail the thread, so I'd appreciate a private conversation with you if you're willing. I can also give you a voucher for Master Audio if you didn't buy it for research.

    -Brian
     
  10. KayaOrsan

    KayaOrsan

    Joined:
    Jan 22, 2013
    Posts:
    20
    "Best one" wasn't a scientific, factual statement on my part, please don't get offended. I know InAudio is not the be all end all solution, but it's well on its way, which is IIRC exactly what I said in my review of it on the Asset Store.

    I know Master Audio is amazing too. In some ways more, and in some ways less than other audio assets. I know this because I bought it a while back. I tried Audio Toolkit, Master Audio, SoundManagerPro, Sectr Audio, and Fabric. I know what each of these can and cannot do, so I think I can use the word "researched" without putting it into quotes.

    Like everyone else, I like sharing my thoughts, especially if they help. But your invitation to do so didn't sound very welcoming, sorry.
     
    terrehbyte likes this.
  11. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Sounds like you did a lot of research, that's cool. If you don't want to help us possibly improve our product by having a conversation, that's fine. That is what our motivation is for talking. So please don't take that the wrong way.

    Sorry for any intrusion here. Carry on!
     
  12. elhispano

    elhispano

    Joined:
    Jan 23, 2012
    Posts:
    52
    My solution was to have the same attenuation values in the Default Snapshot and Pause Snapshot. The only thing i change in Pause Snapshot is the Master attenuation and a Lowpass filter. It's a limited solution but it was enough in my case.
     
  13. marcdhall

    marcdhall

    Joined:
    Oct 5, 2016
    Posts:
    6
    AudioClips have a pre-mixer mute and gain property. Would it not be easier to use those?
     
  14. doublegumbo

    doublegumbo

    Joined:
    Oct 24, 2013
    Posts:
    53
    MUGIK, PeachyPixels and joechatfield like this.
  15. Redrag

    Redrag

    Joined:
    Apr 27, 2014
    Posts:
    181
    My solution is to use Normalise. Set the low to 0 and then the users can set the max. I'm not sure if this is having any weird side effects though it seems to work at the moment.
     
  16. gaterooze

    gaterooze

    Joined:
    Jul 17, 2019
    Posts:
    16
    I used the Duck Volume effect on the pause snapshot and lowered the Makeup Gain, seems to have the desired effect (allows user to set master volume that effects both snapshots, and the paused one goes lower again).