VOX Updated to limit max words per statement. (No more spamming voxtest2.)

This commit is contained in:
Rob Nelson
2014-06-27 21:10:20 -07:00
parent 24902ee817
commit 663ded5f3f
11 changed files with 72 additions and 23 deletions

View File

@@ -1,6 +1,6 @@
// AUTOMATICALLY GENERATED, DO NOT EDIT.
// List is required to compile the resources into the game when it loads. // List is required to compile the resources into the game when it loads.
// Dynamically loading it has bad results with sounds overtaking each other, even with the wait variable. // Dynamically loading it has bad results with sounds overtaking each other, even with the wait variable.
var/list/vox_sounds = list( var/list/vox_sounds = list(
"," = 'sound/vox/,.wav', "," = 'sound/vox/,.wav',
"." = 'sound/vox/..wav', "." = 'sound/vox/..wav',
@@ -254,6 +254,7 @@ var/list/vox_sounds = list(
"escape" = 'sound/vox_fem/escape.ogg', "escape" = 'sound/vox_fem/escape.ogg',
"evacuate" = 'sound/vox_fem/evacuate.ogg', "evacuate" = 'sound/vox_fem/evacuate.ogg',
"every" = 'sound/vox_fem/every.ogg', "every" = 'sound/vox_fem/every.ogg',
"everywhere" = 'sound/vox_fem/everywhere.ogg',
"exchange" = 'sound/vox_fem/exchange.ogg', "exchange" = 'sound/vox_fem/exchange.ogg',
"execution" = 'sound/vox_fem/execution.ogg', "execution" = 'sound/vox_fem/execution.ogg',
"exit" = 'sound/vox_fem/exit.ogg', "exit" = 'sound/vox_fem/exit.ogg',
@@ -332,6 +333,7 @@ var/list/vox_sounds = list(
"hacking" = 'sound/vox_fem/hacking.ogg', "hacking" = 'sound/vox_fem/hacking.ogg',
"handling" = 'sound/vox_fem/handling.ogg', "handling" = 'sound/vox_fem/handling.ogg',
"hangar" = 'sound/vox_fem/hangar.ogg', "hangar" = 'sound/vox_fem/hangar.ogg',
"happening" = 'sound/vox_fem/happening.ogg',
"harm" = 'sound/vox_fem/harm.ogg', "harm" = 'sound/vox_fem/harm.ogg',
"has" = 'sound/vox_fem/has.ogg', "has" = 'sound/vox_fem/has.ogg',
"have" = 'sound/vox_fem/have.ogg', "have" = 'sound/vox_fem/have.ogg',
@@ -388,6 +390,8 @@ var/list/vox_sounds = list(
"k" = 'sound/vox_fem/k.ogg', "k" = 'sound/vox_fem/k.ogg',
"key" = 'sound/vox_fem/key.ogg', "key" = 'sound/vox_fem/key.ogg',
"kill" = 'sound/vox_fem/kill.ogg', "kill" = 'sound/vox_fem/kill.ogg',
"killed" = 'sound/vox_fem/killed.ogg',
"killing" = 'sound/vox_fem/killing.ogg',
"kilo" = 'sound/vox_fem/kilo.ogg', "kilo" = 'sound/vox_fem/kilo.ogg',
"kit" = 'sound/vox_fem/kit.ogg', "kit" = 'sound/vox_fem/kit.ogg',
"kitchen" = 'sound/vox_fem/kitchen.ogg', "kitchen" = 'sound/vox_fem/kitchen.ogg',
@@ -429,7 +433,9 @@ var/list/vox_sounds = list(
"magnetic" = 'sound/vox_fem/magnetic.ogg', "magnetic" = 'sound/vox_fem/magnetic.ogg',
"main" = 'sound/vox_fem/main.ogg', "main" = 'sound/vox_fem/main.ogg',
"maintenance" = 'sound/vox_fem/maintenance.ogg', "maintenance" = 'sound/vox_fem/maintenance.ogg',
"malf" = 'sound/vox_fem/malf.ogg',
"malfunction" = 'sound/vox_fem/malfunction.ogg', "malfunction" = 'sound/vox_fem/malfunction.ogg',
"malfunctioning" = 'sound/vox_fem/malfunctioning.ogg',
"man" = 'sound/vox_fem/man.ogg', "man" = 'sound/vox_fem/man.ogg',
"mass" = 'sound/vox_fem/mass.ogg', "mass" = 'sound/vox_fem/mass.ogg',
"materials" = 'sound/vox_fem/materials.ogg', "materials" = 'sound/vox_fem/materials.ogg',
@@ -717,6 +723,7 @@ var/list/vox_sounds = list(
"traitor" = 'sound/vox_fem/traitor.ogg', "traitor" = 'sound/vox_fem/traitor.ogg',
"traitors" = 'sound/vox_fem/traitors.ogg', "traitors" = 'sound/vox_fem/traitors.ogg',
"transportation" = 'sound/vox_fem/transportation.ogg', "transportation" = 'sound/vox_fem/transportation.ogg',
"triggering" = 'sound/vox_fem/triggering.ogg',
"truck" = 'sound/vox_fem/truck.ogg', "truck" = 'sound/vox_fem/truck.ogg',
"tunnel" = 'sound/vox_fem/tunnel.ogg', "tunnel" = 'sound/vox_fem/tunnel.ogg',
"turn" = 'sound/vox_fem/turn.ogg', "turn" = 'sound/vox_fem/turn.ogg',
@@ -807,4 +814,21 @@ var/list/vox_sounds = list(
"zero" = 'sound/vox_fem/zero.ogg', "zero" = 'sound/vox_fem/zero.ogg',
"zone" = 'sound/vox_fem/zone.ogg', "zone" = 'sound/vox_fem/zone.ogg',
"zulu" = 'sound/vox_fem/zulu.ogg', "zulu" = 'sound/vox_fem/zulu.ogg',
)
// How long each "word" really is (in words). Single-word phrases are skipped for brevity.
var/list/vox_wordlen = list(
"ce" = 2,
"cmo" = 3,
"hop" = 3,
"hos" = 3,
"iaa" = 3,
"rd" = 2,
"shitlord" = 2,
"ss13" = 3,
"vox_420" = 4,
"voxtest" = 3,
"voxtest2" = 42,
"voxtest3" = 22,
"woody" = 2,
) )

View File

@@ -91,6 +91,7 @@ var/const/VOX_DELAY = 600
if(words.len > 30) if(words.len > 30)
words.len = 30 words.len = 30
var/total_word_len=0
for(var/word in words) for(var/word in words)
word = lowertext(trim(word)) word = lowertext(trim(word))
if(!word) if(!word)
@@ -98,6 +99,14 @@ var/const/VOX_DELAY = 600
continue continue
if(!vox_sounds[word]) if(!vox_sounds[word])
incorrect_words += word incorrect_words += word
// Thank Rippetoe for this!
var/wordlen = 1
if(word in vox_wordlen)
wordlen=vox_wordlen[word]
if(total_word_len+wordlen>50)
src << "<span class='notice'>There are too many words in this announcement.</span>"
return
total_word_len+=wordlen
if(incorrect_words.len) if(incorrect_words.len)
src << "<span class='notice'>These words are not available on the announcement system: [english_list(incorrect_words)].</span>" src << "<span class='notice'>These words are not available on the announcement system: [english_list(incorrect_words)].</span>"

Binary file not shown.

BIN
sound/vox_fem/happening.ogg Normal file

Binary file not shown.

BIN
sound/vox_fem/killed.ogg Normal file

Binary file not shown.

BIN
sound/vox_fem/killing.ogg Normal file

Binary file not shown.

BIN
sound/vox_fem/malf.ogg Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -36,12 +36,12 @@ THE SOFTWARE.
##Voice you want to use ##Voice you want to use
#VOICE='rab_diphone' #VOICE='rab_diphone'
# This is the nitech-made ARCTIC voice, tut on how to install: # This is the nitech-made ARCTIC voice, tut on how to install:
# http://ubuntuforums.org/showthread.php?t=751169 ("Installing the enhanced CMU Arctic voices" section) # http://ubuntuforums.org/showthread.php?t=751169 ("Installing the enhanced Nitech HTS voices" section)
#VOICE='nitech_us_bdl_arctic_hts' #VOICE='nitech_us_bdl_arctic_hts'
#VOICE='nitech_us_jmk_arctic_hts' #VOICE='nitech_us_jmk_arctic_hts'
#VOICE='nitech_us_awb_arctic_hts' #VOICE='nitech_us_awb_arctic_hts'
VOICE='nitech_us_slt_arctic_hts' # DEFAULT, less bored US female VOICE='nitech_us_slt_arctic_hts' # less bored US female
#VOICE='nitech_us_clb_arctic_hts' # OLD default: bored US female (occasionally comes up with british pronunciations?!) #VOICE='nitech_us_clb_arctic_hts' # DEFAULT, bored US female (occasionally comes up with british pronunciations?!)
#VOICE='nitech_us_rms_arctic_hts' #VOICE='nitech_us_rms_arctic_hts'
#PHONESET='mrpa' #PHONESET='mrpa'
@@ -49,34 +49,34 @@ PHONESET=''
# What we do with SoX: # What we do with SoX:
SOX_ARGS = '' SOX_ARGS = ''
SOX_ARGS += ' pitch -500' # Lol I male now SOX_ARGS += ' pitch -500'
SOX_ARGS += ' stretch 1.2' # Starts the gravelly sound, lowers pitch a bit. SOX_ARGS += ' stretch 1.2' # Starts the gravelly sound, lowers pitch a bit.
#SOX_ARGS += ' synth tri fmod 60' #SOX_ARGS += ' synth tri fmod 60'
SOX_ARGS += ' synth sine amod 60' # Now REALLY gravelly. SOX_ARGS += ' synth sine amod 60'
#SOX_ARGS += ' synth tri amod 60' #SOX_ARGS += ' synth tri amod 60'
SOX_ARGS += ' chorus 0.7 0.9 55 0.4 0.25 2 -t' SOX_ARGS += ' chorus 0.7 0.9 55 0.4 0.25 2 -t'
SOX_ARGS += ' phaser 0.9 0.85 4 0.23 1.3 -s' SOX_ARGS += ' phaser 0.9 0.85 4 0.23 1.3 -s'
SOX_ARGS += ' compand 0.01,1 -90,-90,-70,-70,-60,-20,0,0 -5 -20' # Dynamic range compression.
SOX_ARGS += ' echos 0.8 0.5 100 0.25 10 0.25' # Good with stretch, otherwise sounds like bees.
SOX_ARGS += ' bass -40' SOX_ARGS += ' bass -40'
SOX_ARGS += ' highpass 22 highpass 22' SOX_ARGS += ' highpass 22 highpass 22'
SOX_ARGS += ' compand 0.01,1 -90,-90,-70,-70,-60,-20,0,0 -5 -20' # Dynamic range compression.
SOX_ARGS += ' echos 0.8 0.5 100 0.25 10 0.25' # Good with stretch, otherwise sounds like bees.
#SOX_ARGS += ' delay 0.5' #SOX_ARGS += ' delay 0.5'
SOX_ARGS += ' norm' SOX_ARGS += ' norm'
# Have to do the trimming seperately. # Have to do the trimming seperately.
PRE_SOX_ARGS = 'trim 0 -0.1' # Trim off last 0.1s. PRE_SOX_ARGS = 'trim 0 -0.1' # Trim off last 0.2s.
# Shit we shouldn't change or overwrite. (Boops, pauses, etc) # Shit we shouldn't change or overwrite. (Boops, pauses, etc)
preexisting=[ preexisting = {
'.', '.':1,
',', ',':1,
'bloop', 'bloop':1,
'bizwarn', # Is this a misspelling of the below? 'bizwarn':1, # Is this a misspelling of the below?
'buzwarn', 'buzwarn':1,
'doop', 'doop':1,
'dadeda', 'dadeda':1,
'woop', 'woop':1,
] }
################################################ ################################################
## ROB'S AWFUL CODE BELOW (cleanup planned) ## ROB'S AWFUL CODE BELOW (cleanup planned)
@@ -84,10 +84,10 @@ preexisting=[
REGEX_SEARCH_STRINGS = re.compile(r'(\'|")(.*?)(?:\1)') REGEX_SEARCH_STRINGS = re.compile(r'(\'|")(.*?)(?:\1)')
wordlist=[]+preexisting
othersounds=[] othersounds=[]
known_phonemes={} known_phonemes={}
wordlist = dict(preexisting.items())
def md5sum(filename): def md5sum(filename):
md5 = hashlib.md5() md5 = hashlib.md5()
@@ -208,7 +208,7 @@ def GenerateForWord(word,wordfile):
logging.info('Skipping {0}.ogg (Marked as PRE_EXISTING)'.format(wordfile)) logging.info('Skipping {0}.ogg (Marked as PRE_EXISTING)'.format(wordfile))
return return
if '/' not in wordfile: if '/' not in wordfile:
wordlist += [wordfile] wordlist[wordfile] = len(word.split(' '))
else: else:
othersounds += [wordfile] othersounds += [wordfile]
md5=hashlib.md5(word).hexdigest() md5=hashlib.md5(word).hexdigest()
@@ -312,11 +312,11 @@ soundsToKeep=set()
for sound in othersounds: for sound in othersounds:
soundsToKeep.add(sound+'.ogg') soundsToKeep.add(sound+'.ogg')
with open(os.path.join(CODE_BASE,'vox_sounds.dm'),'w') as w: with open(os.path.join(CODE_BASE,'vox_sounds.dm'),'w') as w:
w.write("// AUTOMATICALLY GENERATED, DO NOT EDIT.\n")
w.write("// List is required to compile the resources into the game when it loads.\n") w.write("// List is required to compile the resources into the game when it loads.\n")
w.write("// Dynamically loading it has bad results with sounds overtaking each other, even with the wait variable.\n") w.write("// Dynamically loading it has bad results with sounds overtaking each other, even with the wait variable.\n")
w.write("\n")
w.write("var/list/vox_sounds = list(\n") w.write("var/list/vox_sounds = list(\n")
for word in sorted(wordlist): for word,wordlen in sorted(wordlist.items()):
if '/' in word: if '/' in word:
continue continue
filename='' filename=''
@@ -327,6 +327,15 @@ with open(os.path.join(CODE_BASE,'vox_sounds.dm'),'w') as w:
w.write('\t"{0}" = \'{1}\',\n'.format(word,filename)) w.write('\t"{0}" = \'{1}\',\n'.format(word,filename))
soundsToKeep.add(filename) soundsToKeep.add(filename)
w.write(')') w.write(')')
w.write('\n\n// How long each "word" really is (in words). Single-word phrases are skipped for brevity.')
w.write('\nvar/list/vox_wordlen = list(\n')
for word,wordlen in sorted(wordlist.items()):
if wordlen == 1: continue
if '/' in word:
continue
w.write('\t"{0}" = {1},\n'.format(word,wordlen))
w.write(')')
for root, dirs, files in os.walk('sound/', topdown=False): for root, dirs, files in os.walk('sound/', topdown=False):
for name in files: for name in files:

View File

@@ -687,6 +687,7 @@ engineer
engineering engineering
engineers engineers
every every
everywhere
execution execution
fire fire
fore fore
@@ -696,6 +697,7 @@ gray
hacker hacker
hackers hackers
hacking hacking
happening
harm harm
hop = Head of Personnel hop = Head of Personnel
hos = Head of Security hos = Head of Security
@@ -705,12 +707,16 @@ hunger
hydroponics hydroponics
iaa = internal affairs agent iaa = internal affairs agent
kitchen kitchen
killed
killing
law law
laws laws
lawyer lawyer
lizard lizard
loose loose
love love
malfunctioning
malf
me me
medbay medbay
mommi = mommy mommi = mommy
@@ -768,6 +774,7 @@ tide
toxins toxins
traitor traitor
traitors traitors
triggering
update update
updated updated
updating updating