diff --git a/code/__DEFINES/sound.dm b/code/__DEFINES/sound.dm index b14da2441b0..5894daebd38 100644 --- a/code/__DEFINES/sound.dm +++ b/code/__DEFINES/sound.dm @@ -205,5 +205,10 @@ GLOBAL_LIST_INIT(announcer_keys, list( #define SFX_HALLUCINATION_I_M_HERE "hallucination_i_m_here" #define SFX_VOID_DEFLECT "void_deflect" #define SFX_LOW_HISS "low_hiss" - #define SFX_INDUSTRIAL_SCAN "industrial_scan" + +// Default is 45kbps +#define MIN_EMOTE_PITCH 42000 +#define MAX_EMOTE_PITCH 50000 +// ~0.6 - 1.4 at 0.12 +#define EMOTE_TTS_PITCH_MULTIPLIER 0.12 diff --git a/code/datums/emotes.dm b/code/datums/emotes.dm index e3072fcbfd2..d37b442357c 100644 --- a/code/datums/emotes.dm +++ b/code/datums/emotes.dm @@ -52,6 +52,8 @@ var/sound /// Does this emote vary in pitch? var/vary = FALSE + /// If this emote's sound is affected by TTS pitch + var/affected_by_pitch = TRUE /// Can only code call this event instead of the player. var/only_forced_audio = FALSE /// The cooldown between the uses of the emote. @@ -105,7 +107,10 @@ if(tmp_sound && should_play_sound(user, intentional) && TIMER_COOLDOWN_FINISHED(user, "general_emote_audio_cooldown") && TIMER_COOLDOWN_FINISHED(user, type)) TIMER_COOLDOWN_START(user, type, specific_emote_audio_cooldown) TIMER_COOLDOWN_START(user, "general_emote_audio_cooldown", general_emote_audio_cooldown) - playsound(source = user,soundin = tmp_sound,vol = 50, vary = vary, ignore_walls = sound_wall_ignore) + var/frequency = null + if (affected_by_pitch && SStts.tts_enabled && SStts.pitch_enabled) + frequency = rand(MIN_EMOTE_PITCH, MAX_EMOTE_PITCH) * (1 + sqrt(abs(user.pitch)) * SIGN(user.pitch) * EMOTE_TTS_PITCH_MULTIPLIER) + playsound(source = user,soundin = tmp_sound,vol = 50, vary = vary, ignore_walls = sound_wall_ignore, frequency = frequency) var/is_important = emote_type & EMOTE_IMPORTANT var/is_visual = emote_type & EMOTE_VISIBLE diff --git a/code/modules/mob/emote.dm b/code/modules/mob/emote.dm index c812905d58f..4f3687d1c9a 100644 --- a/code/modules/mob/emote.dm +++ b/code/modules/mob/emote.dm @@ -150,6 +150,7 @@ message = "jumps!" // Allows ghosts to jump mob_type_ignore_stat_typecache = list(/mob/dead/observer) + affected_by_pitch = FALSE /datum/emote/jump/run_emote(mob/user, params, type_override, intentional) . = ..() diff --git a/code/modules/mob/living/carbon/emote.dm b/code/modules/mob/living/carbon/emote.dm index 257601977f5..a7d5b3b4e38 100644 --- a/code/modules/mob/living/carbon/emote.dm +++ b/code/modules/mob/living/carbon/emote.dm @@ -23,6 +23,7 @@ hands_use_check = TRUE emote_type = EMOTE_AUDIBLE | EMOTE_VISIBLE vary = TRUE + affected_by_pitch = FALSE /datum/emote/living/carbon/clap/get_sound(mob/living/user) if(!user.get_bodypart(BODY_ZONE_L_ARM) || !user.get_bodypart(BODY_ZONE_R_ARM)) @@ -175,6 +176,7 @@ message_param = "snaps their fingers at %t." emote_type = EMOTE_AUDIBLE | EMOTE_VISIBLE hands_use_check = TRUE + affected_by_pitch = FALSE /datum/emote/living/carbon/snap/get_sound(mob/living/user) if(ishuman(user))