New sound engine needs testing! Help a bro out!

A place for people with an interest in developing new shmups.
Post Reply
User avatar
BPzeBanshee
Posts: 4859
Joined: Sun Feb 08, 2009 3:59 am

New sound engine needs testing! Help a bro out!

Post by BPzeBanshee »

Download here: http://www.mediafire.com/download/1u3zd ... ereTest.7z

TLDR:
Please run this on whatever Windoze PCs you've got especially if they're old, and let me know if it loops well without stopping or inconsistently stuttering or if it spews an error or stays in Task Manager after it quits or anything weird like that. Left-mouse click on the black line to set position, CTRL to make it go slow-mo and SHIFT for chipmunk punk edition.

Backstory:
I've been looking to get a replacement music engine to GMFMODSimple in GMOSSE for a while now, and following shennanigans from the author of GMFMODSimple in response to FMOD's new licensing concerning two different products this has given me the kick in the behind I needed to look for a replacement.

Key part is the loop point support to allow you to have a track with an intro and main piece like most arcade OSTs ever and be able to correctly loop them, followed by a friendly license and OGG support (because MP3s cant reliably be used for looping at all and OGG is superior anyway). SuperSound has inconsistency issues on some machines on unload leading to either a black screen or staying in Task Manager, Caster does not support loop points or setting track position of an existing sound, SG Audio's function to set track positions only works for WAVs due to a bug which is useless for me and everything else has a non-commercial clause or uses FMOD anyway.

Then I found this thing, which runs on LGPL (which in a nutshell means you only have to release the source for anything concerning it if you edit XeAudiere itself, which nobody in GM-land wants to do). It supports setting track position and I use this to "manually" (as opposed to the DLL doing it by itself like FMOD does) loop the track back to a loop point. It's also really fucking easy to figure out its scripts, unlike GMFMODSimple which I've hidden behind my own generic script functions anyway. The song in question is Gleylancer's stage 4 tune, also used in GMOSSE's "vintage" music pack for Stage 2 and I have the percentage value in GMOSSE downpat. You can see exactly my loop point code here, note for the moment this is hardcoded not kept in INIs unlike GMOSSE:

Code: Select all

pos=XmusicPosition(music) // Get current position (frame) of music element
if pos > XmusicLength(music)-3200
    {
    XmusicSeek(music,XmusicLength(music)*0.1333335816614642);
    //XmusicPlay(music);
    }
My concern is with the magic number I've had to use in the if statement. I was able to get loop points working after some chat with S20-TBL for SuperSound years ago but had to use an offset of 6400 which was too high a value for XeAudiere in this case. If you guys think it'd be better for me to externalise that value so you can edit it yourself I'll do that tomorrow after work. 5000 is too much, 2500 sometimes loops or stops inconsistently. If I can get confirmation there's no outlying issues I'll implement this into GMOSSE and associated projects ASAP and update within the month.
User avatar
S20-TBL
Posts: 440
Joined: Mon Jan 18, 2010 6:48 am
Location: Frying over a jungle and saving the nature
Contact:

Re: New sound engine needs testing! Help a bro out!

Post by S20-TBL »

Good thing you brought up that black screen / Task Manager issue. I'll try to see how the magic number works--maybe I can use this SFX engine myself since SuperSound is one of the things preventing me from completely making the jump to Studio due to a function recognition error with ClipCursor.

Part of me thinks the magic number is some sort of arbitrary buffer, if it's caused the issues you described.
--Papilio v0.9 Beta now on itch.io! (development thread)--
Xyga wrote:Blondest eyelashes ever.
User avatar
BPzeBanshee
Posts: 4859
Joined: Sun Feb 08, 2009 3:59 am

Re: New sound engine needs testing! Help a bro out!

Post by BPzeBanshee »

Doing a bit more investigating (I made this thread at 2 am this morning, my bad), it seems the key difference is purely in the measuring system used by the different DLLs. Of course if you're going to use different measuring systems the number isn't going to stay the same, like writing down 35*C in Fahrenheit. From what I hear about low-level timings in Windows though it's very likely there isn't going to be a uniform magic number as response times between the DLLs may be different but I've attempted to write my math logic below.

Game Maker Studio, simplifying things for the average idiot as they like to, uses plain ol seconds. I used a value of 0.025 seconds as the offset here without too much testing effort and it seemed okay but I noticed in testing that decimal support in audio_sound_length is only up to two places so it may not be that precise.

SuperSound uses "bytes", which using SS_GetSoundBytesPerSecond on my stage2.ogg returns 176,400, and a total length of 7,516,936. It's not the actual size of the file however, at least according to 7-Zip, and it always returns 176,400 no matter how high a quality the OGG is encoded in so the measurement is only "bytes" in name I would think. I used 6400 "bytes" as the offset for SS which seemed to be the sweet spot.

XeAudiere on the other hand uses samples which is a more familiar term - Audacity uses it as a method of measurement and XeAudiere's XmusicPosition matches Audacity's idea of the length of the song, which is 1,879,234 samples long. I used 3200 here in the current build which lines up to be about 0.0720 seconds.

As to why it's needed and its purpose? It does indeed seem to be some kind of buffer. Someone with a bit more knowledge on sound engines than I may be able to elaborate more but I'm thinking its similar to what you see in some audio programs and emulators concerning the buffer settings (ie in some emulators you can set sound buffer length to stop crackling).
User avatar
emphatic
Posts: 7984
Joined: Mon Aug 18, 2008 3:47 pm
Location: Alingsås, Sweden
Contact:

Re: New sound engine needs testing! Help a bro out!

Post by emphatic »

Looks really cool. I have no time to test this right now, but I'll shoot off some questions I have instead. :)

Is it possible to jump from one set point in a track to another if conditions are met, say from a midboss fight (CAVE style with a looping stage section) to the aftermath of said fight?

Start song at beginning of stage
enter midboss fight, begin loop at bar 24 of song (i.e. coordinates in the sound engine)
while bossfight is happening, loop bar 24-36 of song
boss is killed, jump to bar 37 the moment the current loop reaches a good exit point, bar 26, 28, 30, 32, 34 or 36

^^This way, the music should feel in sync with the action in an almost orchestrated way, even if the player stalls at the midboss fight and it goes on a long time.

Also, does this sound engine have any effects, like a small reverb? When used in moderation, it should smooth over any otherwise jarring loop points.
Image | My games - http://www.emphatic.se
RegalSin wrote:Street Fighters. We need to aviod them when we activate time accellerator.
User avatar
S20-TBL
Posts: 440
Joined: Mon Jan 18, 2010 6:48 am
Location: Frying over a jungle and saving the nature
Contact:

Re: New sound engine needs testing! Help a bro out!

Post by S20-TBL »

BPzeBanshee wrote:SuperSound uses "bytes", which using SS_GetSoundBytesPerSecond on my stage2.ogg returns 176,400, and a total length of 7,516,936. It's not the actual size of the file however, at least according to 7-Zip, and it always returns 176,400 no matter how high a quality the OGG is encoded in so the measurement is only "bytes" in name I would think. I used 6400 "bytes" as the offset for SS which seemed to be the sweet spot.
I use the SS_GetSoundLength() function instead to help return the filesize and then divide it by the song length in seconds, though you're right about there being a buffer existing as using loop points does not cause my songs to loop at the exact positions I want them to--usually I'll have to sneak in an allowance of a fraction of a second.
emphatic wrote:Looks really cool. I have no time to test this right now, but I'll shoot off some questions I have instead. :)

Is it possible to jump from one set point in a track to another if conditions are met, say from a midboss fight (CAVE style with a looping stage section) to the aftermath of said fight?

Start song at beginning of stage
enter midboss fight, begin loop at bar 24 of song (i.e. coordinates in the sound engine)
while bossfight is happening, loop bar 24-36 of song
boss is killed, jump to bar 37 the moment the current loop reaches a good exit point, bar 26, 28, 30, 32, 34 or 36

^^This way, the music should feel in sync with the action in an almost orchestrated way, even if the player stalls at the midboss fight and it goes on a long time.
It's theoretically possible by inputting the specific bytes (SuperSound) or samples (XeAudiere) using conditional object-controlled loops.

Here's part of my SuperSound code from Papilio, which loops the second boss music from a point after the intro:

Code: Select all

Create: boss02_tl = (SS_GetSoundLength(boss02) / 108);
I divided it by the length of the song in seconds; as BPzeBanshee noted, it's not 100% accurate due to the buffer, leading to the decimal shenanigans below. This is to help me measure the points when and where I want to loop the song specifically]

Code: Select all

Step: if (SS_GetSoundPosition(boss02) > boss02_t l *84.75) { SS_SetSoundPosition (boss02, boss02_tl * 2.5); }
I then loop the song back to 2.5 seconds from the start (which is when the intro ends) once it passes a certain point. It's for this purpose that I leave a short buffer in my tracks before the end is reached.

So in theory, assuming a certain event occurs, you could code something in the Step event of an object to wait until the song passes a certain point in bytes / samples before jumping to a different location in the sound file. Here's a possible example using two specific points (the snippet below could be wrong, I'm going by some informed guesswork here):

Code: Select all

if (bossdeath = true) && bgm_skip = 1 //the second variable is for controlling the song skipping; you'll have to extend this flag check somehow to help buffer the skip
{
     if (SS_GetSoundPosition (boss_bgm) >= boss02_tl * x_seconds && SS_GetSoundPosition (boss_bgm) <= boss02_tl * y_seconds) or
        (SS_GetSoundPosition (boss_bgm) >= boss02_tl * a_seconds && SS_GetSoundPosition (boss_bgm) <= boss02_tl * b_seconds)
     {
          SS_SetSoundPosition (boss02, boss02_tl * new_movement);
     }
}
--Papilio v0.9 Beta now on itch.io! (development thread)--
Xyga wrote:Blondest eyelashes ever.
User avatar
emphatic
Posts: 7984
Joined: Mon Aug 18, 2008 3:47 pm
Location: Alingsås, Sweden
Contact:

Re: New sound engine needs testing! Help a bro out!

Post by emphatic »

Cool! And since the entered values refer only to the music and not the game play, fps drops shouldn't affect the looping of the music as the music will play smoothly even if the game itself slows down, right?
Image | My games - http://www.emphatic.se
RegalSin wrote:Street Fighters. We need to aviod them when we activate time accellerator.
User avatar
emphatic
Posts: 7984
Joined: Mon Aug 18, 2008 3:47 pm
Location: Alingsås, Sweden
Contact:

Re: New sound engine needs testing! Help a bro out!

Post by emphatic »

Oh, and can you put these numbers into an external file along with the sound files to be distributed for music mod packs?
Image | My games - http://www.emphatic.se
RegalSin wrote:Street Fighters. We need to aviod them when we activate time accellerator.
User avatar
S20-TBL
Posts: 440
Joined: Mon Jan 18, 2010 6:48 am
Location: Frying over a jungle and saving the nature
Contact:

Re: New sound engine needs testing! Help a bro out!

Post by S20-TBL »

emphatic wrote:Cool! And since the entered values refer only to the music and not the game play, fps drops shouldn't affect the looping of the music as the music will play smoothly even if the game itself slows down, right?
For the most part, at least. Since the routines and files are accessed mostly separately from the game functions, unless your PC hiccups or something (i. e. running out of resources) you'll experience very little stuttering. I've tested it on an old MSI Wind u-100 with weak processor, RAM and intel GPU and despite the game running at a mere 35 FPS on average, the BGM plays smoothly except when the laptop decides to nurse its digital lumbago.
emphatic wrote:Oh, and can you put these numbers into an external file along with the sound files to be distributed for music mod packs?
This is the problem. In older versions of Game Maker it's possible, but Studio's file sandboxing makes things a tad more complicated (everything in one installation folder; very little wiggle room for handling external files unless you force the game to read from specific folder paths). Thing is though, I haven't touched Studio very much yet, so maybe BP, Rozyrg or eezbrogi could shed more light on this one.

EDIT: stuttering does occur, but only when your PC resources are running really low.
--Papilio v0.9 Beta now on itch.io! (development thread)--
Xyga wrote:Blondest eyelashes ever.
User avatar
BPzeBanshee
Posts: 4859
Joined: Sun Feb 08, 2009 3:59 am

Re: New sound engine needs testing! Help a bro out!

Post by BPzeBanshee »

Was going to write a long and detailed response but damn cookies expired and Chrome decided it wanted to delete my text when I hit 'back'.

Regarding the sandbox bullshit GM:Studio makes us put up with I found this which may fix all our problems: http://gmc.yoyogames.com/index.php?showtopic=567528

For those who don't want to mess with that, the Installer and ZIP export version EXEs in GMS will allow READING files in the same directory as the EXE but not WRITING to it, any writes even with the same file open will be transferred to %LocalAppData%\<projectname> or %LocalAppData%\Temp\IXP001.TMP for the single runtime version. GM has an option to set it to %AppData% instead but not to switch the sandbox off which is annoying. Furthermore attempts to read outside the working directory fails outright, and a few other really stupid things as well.
Post Reply