Page 1 of 1

Set up music stream

Posted: Mon Aug 17, 2015 11:22 am
by Anakin
hi,

i just have some question about music stream options.

Code: Select all

SoundStream()
{
    Name("rc_shell");
    Pitch(1.0);
    PitchDev(0.0);
    Gain(1.0);
    GainDev(0.0);
    ReverbGain(0.0);
    Bus("ingamemusic");
    Looping(0);
    Pan(0.0);
    Mode3D(0);
    Stream("rcs_music");  //.stm file
    SegmentList()
    {
        Segment("shell_vode", 0.5);
		Segment("shell_vode_voice", 0.5);
    }
}

Code: Select all

Music()
{
    Name("rc_shell");
    Priority(1.0);
    FadeInTime(1.0);
    FadeOutTime(1.0);
    MinPlaybackTime(40.0);
    MinInactiveTime(0.0);
    SoundStream("rc_shell");
}
This is from my ambiente music. I want the two tracks playing random but in full length. How can I do that?

Re: Set up music stream

Posted: Tue Aug 18, 2015 1:51 pm
by Marth8880
In here:

Code: Select all

SoundStream()
{
    Name("rc_shell");
    Pitch(1.0);
    PitchDev(0.0);
    Gain(1.0);
    GainDev(0.0);
    ReverbGain(0.0);
    Bus("ingamemusic");
    Looping(0);
    Pan(0.0);
    Mode3D(0);
    Stream("rcs_music");  //.stm file
    SegmentList()
    {
        Segment("shell_vode", 0.5);
		Segment("shell_vode_voice", 0.5);
    }
}
Add a property called CyclePlayback and give it a value of 0, 1, 2, or 3. Here's what each one does:

Code: Select all

CyclePlayback   | 0 Randomly selects a sample
                | 1 Ignores the playback probabilites of all samples in the 
                | sample list.  Instead each time the sound is triggered 
                | the next sample in the list is played.  The first sample 
                | is randomly selected.
                | 2 Same as 1, except the first sample is the first in the list.
                | 3 Randomly selects a sample but makes sure the same sample 
                | isn't played twice
I personally prefer to use 3 for music streams. Additionally, if you want each segment to loop several times before moving onto the next segment, change the value of Looping to 1 and add a property called MaxPlaybackTime to this:

Code: Select all

Music()
{
    Name("rc_shell");
    Priority(1.0);
    FadeInTime(1.0);
    FadeOutTime(1.0);
    MinPlaybackTime(40.0);
    MinInactiveTime(0.0);
    SoundStream("rc_shell");
}
And set its value to the length (in seconds) of whichever music segment is the longest multiplied by some number. I like to use 5 so the music's a little more consistent.

Here's what MaxPlaybackTime does:
1) Once a music segment stored in the SoundStream property begins playing, a timer is started (whose value is that of MaxPlaybackTime).
2) When the timer elapses, the music segment stops playing and the relevant SoundStream() is called again.
3) Depending on the value of its CycleRandom property, another music segment is selected and starts playing.


If it helps, here's an example of the values that I use for one of the music variations in MEU:

*.snd file:
Hidden/Spoiler:
[code]SoundStream()
{
Name("me5_music_template");
Pitch(1.0);
PitchDev(0.0);
Gain(1.0);
GainDev(0.0);
ReverbGain(0.0);
Bus("ingamemusic");
RollOff(0.0);
Looping(1);
Pan(0.0);
Mode3D(0);
ModeDoppler(0);
CyclePlayback(3);
Priority(7.0);
}

// [...]

// ----------------- ME5 SSV Music ----------------------

SoundStream()
{
Name("ssv_amb_03_start");
Group("Music");
Inherit("me5_music_template");
Stream("ME5n_music_03");
SegmentList()
{
Segment("ssv_amb_03_start-01", 1.0, 0.0, 0.0);
Segment("ssv_amb_03_start-02", 1.0, 0.0, 0.0);
Segment("ssv_amb_03_start-03", 1.0, 0.0, 0.0);
Segment("ssv_amb_03_start-04", 1.0, 0.0, 0.0);
}
}

SoundStream()
{
Name("ssv_amb_03_mid");
Group("Music");
Inherit("me5_music_template");
Stream("ME5n_music_03");
SegmentList()
{
Segment("ssv_amb_03_mid-01", 1.0, 0.0, 0.0);
Segment("ssv_amb_03_mid-02", 1.0, 0.0, 0.0);
Segment("ssv_amb_03_mid-03", 1.0, 0.0, 0.0);
Segment("ssv_amb_03_mid-04", 1.0, 0.0, 0.0);
Segment("ssv_amb_01_mid-end-02", 1.0, 0.0, 0.0);
Segment("ssv_amb_vrm_mid-01", 1.0, 0.0, 0.0);
Segment("ssv_amb_vrm_mid-02", 1.0, 0.0, 0.0);
}
}

SoundStream()
{
Name("ssv_amb_03_end");
Group("Music");
Inherit("me5_music_template");
Stream("ME5n_music_03");
SegmentList()
{
//Segment("ssv_amb_03_end-01", 1.0, 0.0, 0.0);
//Segment("ssv_amb_03_end-02", 1.0, 0.0, 0.0);
Segment("ssv_amb_03_end-03", 1.0, 0.0, 0.0);
Segment("ssv_amb_03_end-04", 1.0, 0.0, 0.0);
Segment("ssv_amb_03_end-05", 1.0, 0.0, 0.0);
}
}[/code]
*.mus file:
Hidden/Spoiler:
[code]// ----------------- ME5 SSV Music ----------------------

Music()
{
Name("ssv_amb_03_start");
Priority(5.0);
FadeInTime(1.2);
FadeOutTime(1.2);
MinPlaybackTime(4.0);
MaxPlaybackTime(260.0);
MinInactiveTime(0.0);
SoundStream("ssv_amb_03_start");
}

Music()
{
Name("ssv_amb_03_mid");
Priority(5.0);
FadeInTime(1.2);
FadeOutTime(1.2);
MinPlaybackTime(4.0);
MaxPlaybackTime(380.0);
MinInactiveTime(0.0);
SoundStream("ssv_amb_03_mid");
}

Music()
{
Name("ssv_amb_03_end");
Priority(5.0);
FadeInTime(1.2);
FadeOutTime(1.2);
MinPlaybackTime(4.0);
MaxPlaybackTime(240.0);
MinInactiveTime(0.0);
SoundStream("ssv_amb_03_end");
}[/code]
Is that enough information? :n