Speech Noises 2: Quality of Life, New Sounds (#8044)

* Vending machine jingle much less intense

* SpeechSoundsPrototype has a built in variation parameter

* Sounds in your face are louder but roll off more aggressively so that distant talking sounds are less distracting

* Redo that

* Speech noise system now supports variation of pitch

* license stuff

* PAIs have speech sounds now. Made by altering the pAI sounds.

* Monkeys have sounds from goon now

* New Speech Sounds

* Oops
This commit is contained in:
hubismal
2022-05-08 23:55:23 -05:00
committed by GitHub
parent 7d5c109383
commit 3421e4f4de
13 changed files with 53 additions and 2 deletions

View File

@@ -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<SpeechSoundsPrototype>(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);
}
}
}

View File

@@ -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")]

View File

@@ -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");

View File

@@ -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.

Binary file not shown.

View File

@@ -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

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -636,6 +636,8 @@
state: monkey
sprite: Mobs/Animals/monkey.rsi
- type: Hands
- type: Speech
speechSounds: Monkey
- type: Body
template: PrimateTemplate
preset: PrimatePreset

View File

@@ -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".

View File

@@ -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