Procedural Music Generator.

SocksSocks London, UK.Member Posts: 12,822

Here's an idea for game music, procedural music generation, well strictly speaking in my example (attached below) it's the arrangement that's procedural rather than the actual music itself, but the effect is much the same, a piece of music that slowly evolves and changes over time, this is great for games where the background music can sometimes get a bit repetitive.

Another advantage to this approach is that you can have very high quality audio that goes on (literally) forever if you want, always subtlety changing, and still keep the file size much lower than a single MP3 file, the audio in the example takes up just 631kB, whereas a 3.5 minute MP3 of the same quality would come to around 5.5MB (almost x9 the size).

The technique is pretty simple, the music is made from separate 'stems' and their volumes are driven by sine waves of varying pitch, so the stems slowly drift in and out as the track progresses.

(P.S. click on the white square to 'pause' the track)

Comments

  • AlchimiaStudiosAlchimiaStudios Member Posts: 1,069

    Nice one. That's a clever way to implement something like this.

    Follow us: Twitter - Website

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

    @AlchimiaStudios said:
    Nice one. That's a clever way to implement something like this.

    @BigDave said:
    calming procedural song
    math music! nice!

    @Hopscotch said:
    Nice @Socks!

    Cheers, here's another one (attached below), a different tune, with this one you can set the 'tape speed' (play around with some values, I quite like 80), there's just the one actor, it only references self.attributes, so if you want to use these in a project then simply drag the audio files into your project, drag the actor across and place it into a scene.

    This one is a mere 561kb ! :)

    P.S, almost forgot, with this version each of the elements now starts at a random place in their changing volume pattern, so basically the start of the track is alway subtly different.

  • HopscotchHopscotch Member, PRO Posts: 2,782

    Cool @Socks

    yeah, I already played around with "tape speed" on your previous version, in combo with a platformer with slow-mo effect. To bad we can't go in reverse that easily. :)

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

    @Hopscotch said:
    Cool @Socks

    yeah, I already played around with "tape speed" on your previous version, in combo with a platformer with slow-mo effect. To bad we can't go in reverse that easily. :)

    Here's a quick example (attached) of a track you can reverse (click and hold on the actor), the maths is a little bit thrown together, but I'm sure it could be tidied it up.

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

    @socks, these are very cool. Such a good idea. Thanks for sharing.

  • HopscotchHopscotch Member, PRO Posts: 2,782
    edited October 2016

    Great stuff @Socks, now it is easy to mash this with @LumpApps' DIGMEE concept for more variation, while controlling the timing of cross-fades with the "tape speed".

  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,879

    @Socks -- Clever, Clever, Clever!

  • RowdyPantsRowdyPants Member Posts: 465

    Here are some maths for you @socks = rock:star:

  • RedRoboRedRobo Member, PRO Posts: 680

    Great idea!

  • fmakawafmakawa Member Posts: 565

    This is amazing. Now folks, how do I make the stems to make my own music. Can I take tracks and have them stripped into different stems?

  • SocksSocks London, UK.Member Posts: 12,822

    @jamie_c said:
    @socks, these are very cool. Such a good idea. Thanks for sharing.

    Cheers Jamie.

    @Hopscotch said:
    Great stuff @Socks, now it is easy to mash this with @LumpApps' DIGMEE concept for more variation, while controlling the timing of cross-fades with the "tape speed".

    Sounds good, the idea can definitely be extended, I was thinking you could have a 4 bar section of music that only comes in every 16 bars or so, or even every 32 bars, this can easily be achieved by recording a 4 bar section of music and then having a 12 or 28 bar section of silence, the way that Vorbis (OGG) compresses means when this file is compressed the silent parts use up almost no additional memory - for example if you had a 4 bar section that came to 102kb and you then added 12 bars of silence (and compressed to OGG), the file would come to something like 104kb - this could add a lot more variation with next to zero overhead.

    @strag said:
    Great idea!

    Cheers strag.

    @RowdyPants said:
    Here are some maths for you @socks = rock:star:

    Cheers =cheers !

    @RThurman said:
    @Socks -- Clever, Clever, Clever!

    Cheers, cheers, cheers.

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

    @fmakawa said:
    This is amazing. Now folks, how do I make the stems to make my own music. Can I take tracks and have them stripped into different stems?

    The idea is that you throw together a track in something like Garageband, Logic (etc) - if you're not much of a musician then a few carefully selected Apple Loops should work, but the best results are from tracks you create yourself, an 8 or 16 bar section should be fine, then simply bounce the track to 5 or 6 six separate stems, these should be either of the same length (so a bunch of 16 bar stems) or multiples of each other (so a couple of 8 bar stems, a couple of 16 bar stems, and a 32 bar background ambient effect . . etc) so as to stay in sync.

    Hope that makes sense, basically get a bunch of musical loops that work together.

    A 'stem' here is simply a range of tracks grouped into one, so imagine you have a song in Garageband, it's made up from 20 tracks, you'd bounce - for example - the strings, the piano and the xylophone into one stereo stem - then you'd get the low strings and the bass and make them a second stem, then the sound effects and all the percussion and bounce that to another stereo track . . . (etc) . . basically reducing the 20 tracks down to 5 or 6.

  • Braydon_SFXBraydon_SFX Member, Sous Chef, PRO, Bowlboy Sidekick Posts: 9,271

    Dang man! With the power invested in me as a Sous Chef, I command you to stop being so awesome.....so I can pass you in forum points. :P

  • SocksSocks London, UK.Member Posts: 12,822

    @Braydon_SFX said:
    Dang man! With the power invested in me as a Sous Chef, I command you to stop being so awesome.....so I can pass you in forum points. :P

    Never, it will never happen, I am the Donald Trump of the forum and you will always be the Hilary Clinton, or the other way around depending on who wins.

    P.S that stuff I said about "grabbing people's attributes", that was a total set up, I didn't know I was being recorded.

  • PhilipCCPhilipCC Encounter Bay, South AustraliaMember Posts: 1,390

    @Socks said:

    P.S that stuff I said about "grabbing people's attributes", that was a total set up, I didn't know I was being recorded.

    @Braydon_SFX Flag him, he snatched at my pistola! :o

  • SocksSocks London, UK.Member Posts: 12,822

    @PhilipCC said:

    @Socks said:

    P.S that stuff I said about "grabbing people's attributes", that was a total set up, I didn't know I was being recorded.

    @Braydon_SFX Flag him, he snatched at my pistola! :o

    I deny everything, no video, no case.

Sign In or Register to comment.