i... i need a minute

Listen with sound, description below because the video alone might look underwhelming.

Okay so please don’t mind too much the song that I used in this video. This is just a couple of chords that I put together in a few minutes, I just needed something real short to test the functionalities.

So my goal here was to allow songs to have an intro that plays only once, followed by a main loop that plays seamlessly afterwards. In the video above, my test audio file is only 8 bars long, 4 for the intro and 4 for the main loop. I know this might not look like much, but the process is a bit more involved than checking the loop box for the audio source, so I’ll detail it more below.

Also kinda shown in the video, each level has its base song and each room in a level can have a song override (example: If the level is a village, there’s a song for the village, but there can also be a different song for when the player enters a house).

Implementation time!

So the trick here is to have multiple audio sources running some kind of relay race. I have 3: IntroSource, MainSource and MainSourceLoop. Whenever you try playing one audio source, you must first check AudioSettings.dspTime and use it to schedule your audio play (AudioSource.PlayScheduled()). Then, I use a coroutine to continually check which audio source is playing. For example, if MainSourceLoop is playing, it means that it is time to pass the baton. I invert the variables:

var temp = MainSource;

MainSource = MainSourceLoop;

MainSourceLoop = MainSource;

So now, MainSource is the one playing. Then, it’s time to schedule MainSourceLoop. To do so, I find when the next loop should begin 

songLength = introLength + mainLength

time = currentTime + songLength - current position in the song

and I do 3 things:

MainSourceLoop.PlayScheduled(time);

MainSourceLoop.SetScheduledEndTime(time + mainLength);

MainSourceLoop.timeSamples = the exact sample where the main part of the song begins.

The last step is because we want the audio source to start playing not at the beginning of the audio file, but at the beginning of the main section of the song. I use samples instead of a time in seconds both for precision and because it’s simply much easier for me to find the correct sample. Since I’m the one making the music and I’m using strictly virtual instruments, I know that the duration of the music will be extremely precise. In this case, the test song is composed at 120 BPM in 4/4 and is 8 bars long with a frequency of 44100 Hz. If the intro is 4 bars long, in 4/4 that makes it 16 beats long. This means that the sample at the end of the intro is:

60 * (16 beats / 120 BPM ) * 44100 Hz

The multiplication by 60 is to make the units match up since BPM is in minutes and Hz is in seconds.

Okay, so that was more of an overview than a tutorial, but if this is something you want to implement yourself, that should get you started. Feel free to ask me questions if you want to know more about the implementation. 

Isn’t it amazing how we all thought Viktor was going to be jealous of Phichit, but Viktor was never really in the picture whenever Phichit and Yuuri were talking? He was leaving Yuuri to have his space and talk with his old friend without getting upset or getting in the middle. 

that’s such a healthy behavior, and better than anything I could have hoped for. 

2

older!Corvo and older!Daud meeting someplace out-of-the-way for a smoke for @yellowcandy

Listen, listen. The fact Eliot Spencer’s response to Parker being upset and asking if they could kill the guy who upset her was a shrug and, “Yeah. I mean, I could.” will never, ever not be important to me.

You see that poster beside Yuuri’s bed? Imagine Yuuri talking to that every night before he goes to sleep.

Yuuri: Viktor, why are you so handsome?
Yuuri:
Viktor, why are you so perfect?
Yuuri:
I really wish you were here, Viktor.
Yuuri:
I love you.
Yuuri:
I know that it’s still early there, but… Good night, Viktor.

i cant believe her name is hekapoo but i love her already