random music

hey, i have more than 10 musics in my play scene and i get it to change my music value random at start up , and i've more than 10 rules for each song that check the integer for song.. but this slows my loading of that scene very much.. is there any other fast way to do it... random music playing at startup??

Comments

  • BigDaveBigDave Member Posts: 2,239
    edited September 2016

    just having 10 rules with 10 different tracks
    and one change attribute to get the random integer

    Should not slow down your start up.

    I guess its more the size of your tracks than the execution of logic
    Loading all your tracks could take a while depending on their size

  • jamie_cjamie_c ImagineLabs.rocks Member, PRO Posts: 5,772
    edited September 2016

    Audio is often the largest file size in games, even larger than images. So I imagine that is what the hold up is more than the rules like @BigDave says. If you haven't already you can try to compress your audio so the load time is minimized.

  • adent42adent42 Key Master, Head Chef, Executive Chef, Member, PRO Posts: 3,155

    Are you sure you're playing them as music and not as sound. Music streams through the device's codec chip (no preloading). Sounds are decoded and loaded into memory to be played.

  • SocksSocks London, UK.Member Posts: 12,822
    edited September 2016

    @BigDave said:
    I guess its more the size of your tracks than the execution of logic
    Loading all your tracks could take a while depending on their size

    Music is not loaded into RAM, it's streamed from the device, 'loading' your music tracks should take precisely 0 seconds !

  • i've set them as sound... if i select them as music , won't the slow down loading.?

  • i converted it to music and worked amazing...thanks everyone ... :)

  • SocksSocks London, UK.Member Posts: 12,822
    edited September 2016

    @BigDave said:
    @Socks good to know!

    Yeah, it's definitely worth knowing the difference between the two.

    SOUND.

    Pros: Instant playback, ideal for in-game sounds like button clicks, bullets, impacts (etc) that need to happen instantly at precise points in the game - for example you want a button to feel tactile, you want it to click the moment you press it, rather than a fraction of a second later, for the game to feel solid. With Sound you have expression driven control over pitch and volume, and you can play multiple sounds at once.

    Cons: Sounds loads into RAM so will inevitably slow down game loading somewhat, Sound files also suffer from having their attack faded up from 0 by Creator, making it hard to judge precise timing, and making things with strong attacks (bullet shots and so on) sound much quieter than they do on the device, and in some instances this fading in of the attack can even render very short sounds completely silent - luckily this 'quirk' doesn't transfer to a mobile device, it just makes working with short 'one shot' sounds difficult (I abandoned a GS drum machine long ago because of this issue).

    MUSIC

    Pros: Music files are not loaded into RAM, and instead are streamed through dedicated hardware on the device, so no RAM use and no loading time impact.

    Cons: You can't really use Music for anything other than music or sound effects that don't need to sync to player interactions, for example a slowly evolving atmospheric background sound or the sound of the wind blowing through a forest with rustling leaves would be ideal for 'music', but the sound of footsteps that need to sync to the character animation wouldn't be an ideal use . . as Music is streamed through the device's hardware there is (a lot!) of latency, it seems to change from device to device and even each time it's played, for example on my iMac the difference between Sound and Music is ~2,600 samples (around 0.05 seconds @ 44.1kHz). With Music you do not have control over pitch and you cannot play multiple Music files at once (*except with a bit of weird trickery).

Sign In or Register to comment.