Looped menu music?

Yeah the thread icon is 2 fold.
Probably been asked but is it possible to use lua to get a sound file to loop in the menu?
Example would be the Portal still alive.(Doing it like this rather than using gamestartupmusic01) Is there a way to use that file from portal and loop it for the menu startup music? I wouldn’t know where to start at all. It’s know that hard to get the music, I know, but the menu start up is the part I’m confused with.

I don’t really know if the lua menustate allows it buy you can make use of the “play” concommand.

You gotta make a lua file that goes to menu_plugins.


I’m not sure but that should work.

Also run stopsounds to stop the music(it will stop ALL sounds).

Play concommand is same as **[Surface.PlaySound


And, what menu?

Forgot about that function :v:

Anyway I’m pretty sure with menu he means the startup menu.

That function will only play it once.
You could get the number of seconds the song plays and make a timer that will play it again after that or something.

local music = Sound(“music/yourmusic.wav”) – precache
local duration = 300 – duration of songs in seconds
timer.Create(“PlayMyToons”, duration, 0, function()

– and when you’re done with the music:

I’m wondering, is there any better way to do it? I’ve just always done it like that.

I’ve seen music files that loop when played using the play concommand.

I have no idea how it’s done though, maybe a custom header in the file or something?

There’s cues you can add to make the sound loop. I think there was an article on the Valve Developer Wiki if I remember correctly. (Found it: here)

wav files can be looped

Gonna try this, if anyone wants to tell me that it only works for mods go ahead before I am disappointed.

Well it loops but doesn’t want to play on menu start up (Have to play it with the ‘play’ command) any help?