Sound modding:修订间差异

本页面所适用的版本可能已经过时,最后更新于1.5
(merge from offical wiki)
 
无编辑摘要
 
(未显示另一用户的1个中间版本)
第1行: 第1行:
{{version|1.5}}
{{version|1.5}}
{{需要翻译|译者=霜泽图书馆}}


Sound definitions are found in {{path|sound}}. A sound file should be saved as a '''WAV''' file in Stereo, as a mono channel, at 44100Hz and as a 32-bit float.
Sound definitions are found in {{path|sound}}. A sound file should be saved as a '''WAV''' file in Stereo, as a mono channel, at 44100Hz and as a 32-bit float.
第165行: 第166行:


{{Modding navbox}}
{{Modding navbox}}
[[Category:Modding]]
[[ 分类:Modding]]

2024年9月21日 (六) 20:02的最新版本

Sound definitions are found in /Hearts of Iron IV/sound. A sound file should be saved as a WAV file in Stereo, as a mono channel, at 44100Hz and as a 32-bit float.

All of the sound definition files must be saved as .asset files.

Sound

A sound entry is used to define a sound. It follows this format:

sound = {
    name = <name>
    file = <path>
    always_load = <bool>
    volume = <float>
}

name is the name of the sound definition that is referred to by other files.

file is the path to the sound file, relative to the Hearts of Iron IV sound folder.

always_load defines whether the sound is always loaded.

volume defines the volume of the sound.

Sound Effect

A soundeffect entry is used to define a soundeffect. It follows this format:

soundeffect = {
    name = <name>
    falloff = <name>
    sounds = {
        sound = <name>
    }
    
    loop = <bool>
    is3d = <bool>
    random_sound_when_looping = <bool>
    
    max_audible = <int>
    max_audible_behaviour = <type>
    
    volume = <float>
    fade_in = <float>
    fade_out = <float>
    
    delay_random_offset = {
        <float>
        <float>
    }
    playbackrate_random_offset = {
        <float>
        <float>
    }
    volume_random_offset = {
        <float>
        <float>
    }
}

name is the name of the soundeffect.

falloff is the falloff entry used by the sound effect.

sounds is the sound entries used by the sound effect.

loop defines whether the soundeffect loops.

is3d defines whether the sound effect should utilise 3D sound.

random_sound_when_looping defines whether the soundeffect picks a random sound when looping, rather than picking iteratively.

max_audible defines the maximum amount of instances of the sound effect in one moment.

max_audible_behaviour defines what happens when more than max_audible instances happens. It is always fail.

volume defines the volume of the sound effect.

fade_in defines the fade in duration for the sound effect.

fade_out defines the fade out duration for the sound effect.

delay_random_offset defines the minimum and maximum random offset to the delay between sound loops.

playbackrate_random_offset defines the minimum and maximum random offset to the playback rate between sound loops.

volume_random_offset defines the minimum and maximum random offset to the volume between sound loops.

Falloff

Falloff entries define the falloff attributes for sound. They are added in sound effects, and follow this format:

falloff = {
    name = <name>
    
    min_distance = <float>
    max_distance = <float>
    height_scale = <float>
}

name is the name of the falloff entry.

min_distance is the minimum distance before falloff is applied, i.e. max volume

max_distance is the maximum distance before no sound is heard.

height_scale is a scalar for the height between the sound source and the player camera.

Categories

Sound effects can be placed in sound categories that apply a specific compressor to the sounds. The categories follow this format:

category = {
    name = <name>
    soundeffects = {
        <name>
    }
    compressor = {
        enabled = yes
        pregain = <float>
        postgain = <float>
        ratio = <float>
        threshold = <float>
        attacktime = <float>
        releasetime = <float>
    }
}

name is the name of the soundeffect category.

soundeffects is a list of the sound effects belong to the category.

compressor is the compressor to use for the category, see below for more information on the attributes.

Compressors

There are two global compressors: master_compressor used for sounds and music_compressor used for music. Individual compressors can be defined for sounds within categories.

The compressors use the following format:

<name> = {
    pregain = <float>
    postgain = <float>
    ratio = <float>
    threshold = <float>
    attacktime = <float>
    releasetime = <float>
}