custom music (repost)

false

Member
Apr 23, 2024
9
0
130
How can i make a custom music mod everything helps. i heard it was easy plus we don't want to listen to mid sm64 Ost
 
create a sound folder in your mod's folder, put the mp3 audio file in it and use this code (you will need to change it to fit what you need):
LUA:
local audio = audio_stream_load("AUDIO_FILENAME.mp3")

function on_warp()
    audio_stream_play(audio, true, 1)
end
hook_event(HOOK_ON_WARP, on_warp)
 
  • Like
Reactions: false
how to i put this code in is there some application i need to install or????
In your mods root folder, create a text file. Post the following in that text file:

create a sound folder in your mod's folder, put the mp3 audio file in it and use this code (you will need to change it to fit what you need):
LUA:
local audio = audio_stream_load("AUDIO_FILENAME.mp3")

function on_warp()
    audio_stream_play(audio, true, 1)
end
hook_event(HOOK_ON_WARP, on_warp)
Save that file as "main.lua". You don't need another program. Any basic text editor should work.
 
In your mods root folder, create a text file. Post the following in that text file:


Save that file as "main.lua". You don't need another program. Any basic text editor should work.
hey can you make it so that it replaces the main audio? Because you can hear it, but you can also the hear still hear the slider theme in Peaches Secret Slide along with it, for example.
 
Last edited:
hey can you make it so that it replaces the main audio? Because you can hear it, but you can also the hear still hear the slider theme in Peaches Secret Slide along with it, for example.
yeah, here's the code:

LUA:
local audio = audio_stream_load("audio file.ogg")

function on_warp()
  if gNetworkPlayers[0].currLevelNum == LEVEL_LEVELNAME then
    stop_background_music(get_current_background_music())
    audio_stream_set_looping(audio, true)
    audio_stream_play(audio, true, 1)
    else
    audio_stream_play(audio, true, 0)
  end
end

hook_event(HOOK_ON_WARP, on_warp)

make sure to change audio file.ogg and LEVEL_LEVELNAME to level you want to replace the music, for example LEVEL_BOWSER2 or LEVEL_JRB
 
yeah, here's the code:

LUA:
local audio = audio_stream_load("audio file.ogg")

function on_warp()
  if gNetworkPlayers[0].currLevelNum == LEVEL_LEVELNAME then
    stop_background_music(get_current_background_music())
    audio_stream_set_looping(audio, true)
    audio_stream_play(audio, true, 1)
    else
    audio_stream_play(audio, true, 0)
  end
end

hook_event(HOOK_ON_WARP, on_warp)

make sure to change audio file.ogg and LEVEL_LEVELNAME to level you want to replace the music, for example LEVEL_BOWSER2 or LEVEL_JRB
How i can add 2 or more music?
 
you copy these parts:
LUA:
local audio = audio_stream_load("audio file.ogg")
LUA:
function on_warp()
  if gNetworkPlayers[0].currLevelNum == LEVEL_LEVELNAME then
    stop_background_music(get_current_background_music())
    audio_stream_set_looping(audio, true)
    audio_stream_play(audio, true, 1)
    else
    audio_stream_play(audio, true, 0)
  end
end
LUA:
hook_event(HOOK_ON_WARP, on_warp)
but now you change the "audio", "audio file.ogg", "on_warp", "LEVEL_LEVELNAME"
 
you copy these parts:
LUA:
local audio = audio_stream_load("audio file.ogg")
LUA:
function on_warp()
  if gNetworkPlayers[0].currLevelNum == LEVEL_LEVELNAME then
    stop_background_music(get_current_background_music())
    audio_stream_set_looping(audio, true)
    audio_stream_play(audio, true, 1)
    else
    audio_stream_play(audio, true, 0)
  end
end
LUA:
hook_event(HOOK_ON_WARP, on_warp)
but now you change the "audio", "audio file.ogg", "on_warp", "LEVEL_LEVELNAME"
Oh thanks. But how i can add the music in castle main floor or castle grounds?
 

Users who are viewing this thread