From EDukeWiki
Jump to navigation Jump to search

definesound <value> <filename> <pitch1> <pitch2> <priority> <type> <volume>

The definesound command defines a sound and assigns various properties to it. The maximum number of sounds that can be defined is 4096 for EDuke32, and 450 for Duke v1.5. Sound defines over 1000 won't work with the MUSICANDSOUNDFX sprite, so bear that in mind if you're working on a mod with many custom sound files.

  • <value>: This can be either the sound's number or the name that has been defined for that number.
  • <filename>: The name of the sound file. Sound files are assumed to be in the same directory as the program unless a folder path is specified. Assume that the user's OS is case sensitive, and directory delimiters are forward slashes (/) rather than backslashes (\).
  • <pitch1> and <pitch2>: These are a random pitch variation range. Values may be positive or negative. For example, if you want you sound to have a chance of both moderate increase and decrease in pitch, you would use values such as -512 512.
  • <priority>: A value of 0 to 255 indicates the priority the sound has over other sounds that are playing simultaneously. The higher the value, the greater its priority. This is due to the limit on the number of sounds that can play at once. Take a look at the original USER.CON to see what kinds of sounds get what kinds of priority. For example, most Duke remarks are maxed out at 255.
  • <type>: This flag is a bitfield which indicates what type of sound you are defining.
Bit #0 (1): The sound repeats if continually played.
Bit #1 (2): The sound is an ambient effect. Disabling ambience in the menu will mute this sound.
Bit #0 + Bit #1 (3): The sound will loop until instructed to stop.
Bit #2 (4): The sound is a player voice. Disabling "Duke Talk" in the menu will mute this sound.
Bit #3 (8): The sound contains offensive content. Disabling "Adult Mode" or enabling the parental lock in the menu will mute this sound.
Bit #4 (16): The sound will always be heard from anywhere in the level. (See globalsound.) (sndist = 0)
Bit #7 (128): The sound is used in Duke-Tag.
  • <volume>: Negative values increase volume; positive ones soften it. Can range from -32768 to 32767. Note that this value does not actually affect the sound's volume, but rather it modifies the distance registered between it and any listening players. As such, this has no effect on global sounds or sounds made by the player.