Jump to content

How to use Weidu's ADD_MUSIC?


Recommended Posts

Posted

I used the following script to create an .acm file from an .ogg file.

BEGIN ~Add MUSIC~
COPY ~my_mod/audio/music/RB_MUS01.ogg~ ~music~
COPY_EXISTING ~songlist.2da~ ~override~
LAF HANDLE_AUDIO
  INT_VAR
    music = 1
  STR_VAR
    audio_path = ~my_mod/audio/music~
END

From the Weidu documentation, I'm attempting to use the ADD_MUSIC function using:

//ADD_MUSIC internalMusicName newMUSFile
ADD_MUSIC ~RB_MUS01~ ~my_mod/audio/music/RB_MUS01.mus~

But I receive a parsing error. How is this function used exactly?

Posted

I've just noticed this note from the Weidu documentation:

  • INT_VAR music if this variable is not 0 and the game is BG:EE, the audio files are given the extension .acm instead of .wav. This variable has no effect if the game is not BG:EE. By default its value is 0.

I'm guessing IW:EE uses the same engine as an .acm file is produced...?

In addition to how to use the ADD_MUSIC funtion, is there any other steps required to incorporate music or can I just use the PlaySong() function to play the music?

Posted

Managed to get it done manually with NI but boy was it an ordeal... would rather go down the scirpting route! I don't think there's a thread in this forum which describes how to add music manually (if so then please correct me) in which case, I'll include the steps I did once I've remembered exactly what I did...

Posted
3 hours ago, pete_smith1229 said:

But I receive a parsing error. How is this function used exactly?

I am not sure why you have a parse error here, I use exactly the same code to add music in my mod: https://github.com/abalabokhin/NWNForBG/blob/main/NWNForBG/Setup-NWNForBG.tp2#L438 and it works.

As far as I understand, ADD_MUSIC just add an entry into songlist.2da and copy *.mus file. All *.acm files should be copied manually (into the dedicated directory - see also in the code). Idk how to play the added music, I was using it in the areas (like here https://github.com/abalabokhin/NWNForBG/blob/main/NWNForBG/Setup-NWNForBG.tp2#L955). PlaySound() should work with any ogg/wav files, no need to add music for that.

Posted (edited)

@paladin84 Thanks for confirming and elaborating on the ADD_MUSIC function. In addition to your description of manually copying files, I've included the steps I did to add music to the game:

1. Use VLC (or similar) to convert mp3/wav file to .ogg file and save to my_mod/audio/music/
2. Run the following script to create .acm file

COPY_EXISTING ~songlist.2da~ ~override~
LAF HANDLE_AUDIO
  INT_VAR
    music = 1
  STR_VAR
    audio_path = ~my_mod/audio/music/~
END

3. Create new folder (e.g. "rb_mus") in main_game_EE/music/
4. Move .acm file to main_game_EE/music/rb_mus/
5. Rename .acm file by appending "a" (i.e. rb_musa.acm)
6. Create .mus file (text file) with the following where: Rb_mus = folder name; 1 = no. of acm files; A is character used to point to the .acm file; @TAG end = interrupt state (more info)

Rb_mus
1
A         @TAG end

7. Append songlist.2da with following where: 85 = new unique ID; rb_mus = folder name containing acm files; rb_mus01.mus = name of .mus file

85 rb_mus rb_mus01.mus

8. Music can be called using the following:

PlaySong(0) // Play blank
PlaySong(85) // Play new music
SetMusic(DAY,rb_mus01) // Play new music during the day (check MUSIC.IDS for other parameters)
StartMusic(COMBAT_NORMAL,PLAY) // Configure "songs" parameter in .ARE file where COMBAT_NORMAL = rb_mus01.mus (rb_mus) - 85

 

Edited by pete_smith1229

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...