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

Muting and Unmuting stems for an interactive score

Discussion in 'Audio & Video' started by iCompose, Jun 11, 2015.

  1. iCompose

    iCompose

    Joined:
    Jun 4, 2015
    Posts:
    6
    Hey everyone,

    I am creating a game in unity that requires an interactive score as there is a huge number of things you can be doing. In order to keep the scripting simple I want to just make stems and have them mute and unmute (preferably with a fade) so that I can control the intensity of the music. How would I create such a thing in C#? I assume I would start with an if statement, for example, if combat == true unmute this clip else do nothing.
     
  2. carljohnfred

    carljohnfred

    Joined:
    Dec 28, 2012
    Posts:
    31
    I assume you're just talking about one song, with stems for guitar, bass, drums, vocals, etc.? Are all of your clips the same duration? If so, you can have them all start playing at the same time using different audio sources, then change the volume property of an audio source to mute/unmute individual stems.
     
  3. iCompose

    iCompose

    Joined:
    Jun 4, 2015
    Posts:
    6
    I ended up figuring it out, I am just using mixer snapshots to fade the music in and out. Thanks though!
     
  4. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,555
    People sometimes report trouble keeping multiple stems in sync with each other, just FYI. If you run into that, you'll have to handle it somehow. Some go more out of sync over time.
     
  5. iCompose

    iCompose

    Joined:
    Jun 4, 2015
    Posts:
    6
    How far out of sync? At the moment I think I will be using a combat mix and a non-combat mix of songs and just fading between the two once combat starts and ends.