diff --git a/Content.Server/Speech/SpeechNoiseSystem.cs b/Content.Server/Speech/SpeechNoiseSystem.cs index d5fec29672..97969ca56c 100644 --- a/Content.Server/Speech/SpeechNoiseSystem.cs +++ b/Content.Server/Speech/SpeechNoiseSystem.cs @@ -6,6 +6,7 @@ using Content.Shared.Sound; using Robust.Shared.Player; using Robust.Shared.Prototypes; using Robust.Shared.Timing; +using Robust.Shared.Random; using System; namespace Content.Server.Speech @@ -14,6 +15,7 @@ namespace Content.Server.Speech { [Dependency] private readonly IGameTiming _gameTiming = default!; [Dependency] private readonly IPrototypeManager _protoManager = default!; + [Dependency] private readonly IRobustRandom _random = default!; public override void Initialize() { @@ -35,6 +37,7 @@ namespace Content.Server.Speech // Play speech sound string contextSound; var prototype = _protoManager.Index(component.SpeechSounds); + var message = args.Message; // Different sounds for ask/exclaim based on last character switch (args.Message[^1]) @@ -50,8 +53,22 @@ namespace Content.Server.Speech break; } + // Use exclaim sound if most characters are uppercase. + int uppercaseCount = 0; + for (int i = 0; i < message.Length; i++) + { + if (char.IsUpper(message[i])) uppercaseCount++; + } + if (uppercaseCount > (message.Length / 2)) + { + contextSound = contextSound = prototype.ExclaimSound.GetSound(); + } + + var scale = (float) _random.NextGaussian(1, prototype.Variation); + var pitchedAudioParams = component.AudioParams.WithPitchScale(scale); + component.LastTimeSoundPlayed = currentTime; - SoundSystem.Play(Filter.Pvs(uid, entityManager: EntityManager), contextSound, uid, component.AudioParams); + SoundSystem.Play(Filter.Pvs(uid, entityManager: EntityManager), contextSound, uid, pitchedAudioParams); } } } diff --git a/Content.Shared/Speech/SharedSpeechComponent.cs b/Content.Shared/Speech/SharedSpeechComponent.cs index 784ea7240c..4440ba0f3e 100644 --- a/Content.Shared/Speech/SharedSpeechComponent.cs +++ b/Content.Shared/Speech/SharedSpeechComponent.cs @@ -25,7 +25,7 @@ namespace Content.Shared.Speech public string? SpeechSounds; [DataField("audioParams")] - public AudioParams AudioParams = AudioParams.Default.WithVolume(5f); + public AudioParams AudioParams = AudioParams.Default.WithVolume(6f).WithRolloffFactor(4.5f); [ViewVariables(VVAccess.ReadWrite)] [DataField("soundCooldownTime")] diff --git a/Content.Shared/Speech/SpeechSoundsPrototype.cs b/Content.Shared/Speech/SpeechSoundsPrototype.cs index 1e3bafb69a..5e1976d135 100644 --- a/Content.Shared/Speech/SpeechSoundsPrototype.cs +++ b/Content.Shared/Speech/SpeechSoundsPrototype.cs @@ -15,6 +15,11 @@ namespace Content.Shared.Speech [IdDataFieldAttribute] public string ID { get; } = default!; + //Variation is here instead of in SharedSpeechComponent since some sets of + //sounds may require more fine tuned pitch variation than others. + [DataField("variation")] + public float Variation { get; set; } = 0.1f; + [DataField("saySound")] public SoundSpecifier SaySound { get; set; } = new SoundPathSpecifier("/Audio/Voice/Talk/speak_2.ogg"); diff --git a/Resources/Audio/Animals/license.txt b/Resources/Audio/Animals/license.txt index 0de2a75a5c..d613b12f11 100644 --- a/Resources/Audio/Animals/license.txt +++ b/Resources/Audio/Animals/license.txt @@ -1,3 +1,7 @@ +monkey_scream.ogg from +https://github.com/goonstation/goonstation/blob/4059e4be90832b02b1228b1bee3db342094e4f1e/sound/voice/screams/monkey_scream.ogg +licensed under CC BY-NC-SA 3.0 + The following sounds were used from freesound: cat_meow.ogg: modified from "Meow 4.wav" by freesound user "TRNGLE" (https://freesound.org/people/TRNGLE/sounds/368006/) licensed under CCBY 3.0. The original audio was trimmed, split to mono, and converted from WAV to OGG format. diff --git a/Resources/Audio/Animals/monkey_scream.ogg b/Resources/Audio/Animals/monkey_scream.ogg new file mode 100644 index 0000000000..cd20c721de Binary files /dev/null and b/Resources/Audio/Animals/monkey_scream.ogg differ diff --git a/Resources/Audio/Machines/vending_jingle.ogg b/Resources/Audio/Machines/vending_jingle.ogg index 548aa2a1f4..052da16f50 100644 Binary files a/Resources/Audio/Machines/vending_jingle.ogg and b/Resources/Audio/Machines/vending_jingle.ogg differ diff --git a/Resources/Audio/Voice/Talk/license.txt b/Resources/Audio/Voice/Talk/license.txt index 01f4445cb3..a8343a0aa3 100644 --- a/Resources/Audio/Voice/Talk/license.txt +++ b/Resources/Audio/Voice/Talk/license.txt @@ -1,3 +1,7 @@ +pai.ogg +pai_ask.ogg +pai_exclaim.ogg +all made by github.com/hubismal licensed under CC-BY-3.0 speak_1_ask.ogg speak_1_exclaim.ogg speak_1.ogg diff --git a/Resources/Audio/Voice/Talk/pai.ogg b/Resources/Audio/Voice/Talk/pai.ogg new file mode 100644 index 0000000000..fa9099b427 Binary files /dev/null and b/Resources/Audio/Voice/Talk/pai.ogg differ diff --git a/Resources/Audio/Voice/Talk/pai_ask.ogg b/Resources/Audio/Voice/Talk/pai_ask.ogg new file mode 100644 index 0000000000..badef6d4e0 Binary files /dev/null and b/Resources/Audio/Voice/Talk/pai_ask.ogg differ diff --git a/Resources/Audio/Voice/Talk/pai_exclaim.ogg b/Resources/Audio/Voice/Talk/pai_exclaim.ogg new file mode 100644 index 0000000000..59f35c2e90 Binary files /dev/null and b/Resources/Audio/Voice/Talk/pai_exclaim.ogg differ diff --git a/Resources/Prototypes/Entities/Mobs/NPCs/animals.yml b/Resources/Prototypes/Entities/Mobs/NPCs/animals.yml index 189071e141..1f36518e10 100644 --- a/Resources/Prototypes/Entities/Mobs/NPCs/animals.yml +++ b/Resources/Prototypes/Entities/Mobs/NPCs/animals.yml @@ -636,6 +636,8 @@ state: monkey sprite: Mobs/Animals/monkey.rsi - type: Hands + - type: Speech + speechSounds: Monkey - type: Body template: PrimateTemplate preset: PrimatePreset diff --git a/Resources/Prototypes/Entities/Objects/Fun/pai.yml b/Resources/Prototypes/Entities/Objects/Fun/pai.yml index 54a81dc8ab..4721e1d6ac 100644 --- a/Resources/Prototypes/Entities/Objects/Fun/pai.yml +++ b/Resources/Prototypes/Entities/Objects/Fun/pai.yml @@ -36,6 +36,8 @@ - type: GhostRadio - type: DoAfter - type: Actions + - type: Speech + speechSounds: Pai # This has to be installed because otherwise they're not "alive", # so they can ghost and come back. # Note that the personal AI never "dies". diff --git a/Resources/Prototypes/Voice/speech_sounds.yml b/Resources/Prototypes/Voice/speech_sounds.yml index 9a5d411d91..c72b088ec9 100644 --- a/Resources/Prototypes/Voice/speech_sounds.yml +++ b/Resources/Prototypes/Voice/speech_sounds.yml @@ -52,3 +52,20 @@ exclaimSound: path: /Audio/Machines/vending_jingle.ogg +- type: speechSounds + id: Pai + saySound: + path: /Audio/Voice/Talk/pai.ogg + askSound: + path: /Audio/Voice/Talk/pai_ask.ogg + exclaimSound: + path: /Audio/Voice/Talk/pai_exclaim.ogg + +- type: speechSounds + id: Monkey + saySound: + path: /Audio/Animals/monkey_scream.ogg + askSound: + path: /Audio/Animals/monkey_scream.ogg + exclaimSound: + path: /Audio/Animals/monkey_scream.ogg