Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Mike800

Music randomizer?

Recommended Posts

Most music players have shuffle option, which makes the tracks play in random order.

Oh, wait, you meant music in Doom maps.. well, sorry, can't help you here, I think it's impossible.

Share this post


Link to post

This randomizer is limited to the included midis.
I'm looking for a randomizer for music of my choice.

Share this post


Link to post

Well you could modify it to use your music. I don't think you could make a mod that would play any music you wanted on the fly. You could just turn off the music in doom and play your music in Spotify or iTunes or whatever

Share this post


Link to post

This can be done via a mod with LOADACS, and would work in ZDoom based mods. This effect won't be possible in vanilla/boom ports.

The code below is untested, but it's an example of what you could do.

Script playRandomSong OPEN {
    // First, define all songs lumpnames in an array.
    str randomSong["D_SONG01", "D_SONG02", "D_SONG03", "D_SONG04", "D_SONG05", "D_SONG06"];

    // Get a random number between 1 and the amount of songs, then subtract by one so it matches the array.
    var randomChoice = (random(1, 6))-1;

    // Play the song which was randomly selected.
    SetMusic(randomSong[randomChoice]);
}
Also, I guess this is a question for anyone else who happens upon this thread - can you get the size of the array within ACS? For example, random(1, randomSong[]);?

Share this post


Link to post
Mike800 said:

This randomizer is limited to the included midis.
I'm looking for a randomizer for music of my choice.

If you want something that dynamically creates a list of music tracks and randomly choose between them, you won't get that. You'll have to create the list of music files yourself.

But hey, if you use ZDoom, you can try playing a playlist instead of normal music. You might find updating an .m3u playlist easier than recompiling ACS all the time.

(Jimmy's Jukebox uses an advanced script where you don't need to recompile ACS to change the list, because it's reading values out of a LANGUAGE lump, but you still need to update it manually.)

Dragonfly said:

Also, I guess this is a question for anyone else who happens upon this thread - can you get the size of the array within ACS? For example, random(1, randomSong[]);?

No.

Or if you can, I'm not aware of how.

Share this post


Link to post
Gez said:

an .m3u playlist

-snip-

No.

Or if you can, I'm not aware of how.



I had no idea it was possible to use a playlist! That's pretty cool. Also, total bummer about not having the ability to get the length of an array; which is actually a pretty common thing to be able to do in many programming languages. Oh well!

Share this post


Link to post
Mike800 said:

This randomizer is limited to the included midis.

Not true. It actually allows you to add up to 9999 songs (as well as replace the existing 350 songs).

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×