diff --git a/code/__HELPERS/unsorted.dm b/code/__HELPERS/unsorted.dm index 4c53337a2b7..e1a70bb3a14 100644 --- a/code/__HELPERS/unsorted.dm +++ b/code/__HELPERS/unsorted.dm @@ -1606,4 +1606,6 @@ proc/check_target_facings(mob/living/initator, mob/living/target) /mob/proc/texttospeech(var/text, var/speed, var/pitch, var/accent, var/voice, var/echo) text = texttospeechstrip(text) lastspeak = text - ext_python("voice.py", "\"[accent]\" \"[voice]\" \"[pitch]\" \"[echo]\" \"[speed]\" \"[text]\" \"[src.ckey]\"") \ No newline at end of file + ext_python("voice.py", "\"[accent]\" \"[voice]\" \"[pitch]\" \"[echo]\" \"[speed]\" \"[text]\" \"[src.ckey]\"") + + diff --git a/code/controllers/configuration.dm b/code/controllers/configuration.dm index 0e83de642da..f28dd677fc5 100644 --- a/code/controllers/configuration.dm +++ b/code/controllers/configuration.dm @@ -455,7 +455,7 @@ if(world.system_type == UNIX) config.python_path = "/usr/bin/env python2" else //probably windows, if not this should work anyway - config.python_path = "python" + config.python_path = "pythonw" if("assistant_limit") config.assistantlimit = 1 diff --git a/code/modules/client/preferences.dm b/code/modules/client/preferences.dm index 58abc3e81c5..31a6c26db44 100644 --- a/code/modules/client/preferences.dm +++ b/code/modules/client/preferences.dm @@ -102,7 +102,10 @@ datum/preferences var/list/organ_data = list() var/list/player_alt_titles = new() // the default name of a job like "Medical Doctor" - + var/accent = "en-us" + var/voice = "m1" + var/pitch = 50 + var/talkspeed = 175 var/flavor_text = "" var/med_record = "" var/sec_record = "" @@ -176,6 +179,10 @@ datum/preferences dat += "
" dat += "Species: [species]
" dat += "Secondary Language:
[language]
" + dat += "Accent: [accent]
" + dat += "Voice: [voice]
" + dat += "Pitch: [pitch]
" + dat += "Talking Speed: [talkspeed]
" dat += "Blood Type: [b_type]
" dat += "Skin Tone: [-s_tone + 35]/220
" // dat += "Skin pattern: Adjust
" @@ -302,6 +309,7 @@ datum/preferences dat += "Ghost ears: [(toggles & CHAT_GHOSTEARS) ? "Nearest Creatures" : "All Speech"]
" dat += "Ghost sight: [(toggles & CHAT_GHOSTSIGHT) ? "Nearest Creatures" : "All Emotes"]
" dat += "Ghost radio: [(toggles & CHAT_GHOSTRADIO) ? "Nearest Speakers" : "All Chatter"]
" + dat += "Hear player voices: [(toggles & SOUND_VOICES) ? "Yes" : "No"]
" if(config.allow_Metadata) dat += "OOC Notes: Edit
" @@ -1087,6 +1095,23 @@ datum/preferences underwear = underwear_options.Find(new_underwear) ShowChoices(user) + if("accent") + var/new_accent = input(user, "Choose your accent. en-us:American, en:British, en-sc:Scottish", "Character Preference") as null|anything in list("en-us", "en", "en-sc") + if(new_accent) + accent = new_accent + if("voice") + var/new_voice = input(user, "Choose your voice. f:Female, m:Male", "Character Preference") as null|anything in list("f1","m1","f2","m2","f3","m3","f4","m4","f5","m5","m6","m7") + if(new_voice) + voice = new_voice + if("pitch") + var/new_pitch = input(user, "Choose your character's voice pitch:\n(0-99) Default is 50.", "Character Preference") as num|null + if(new_pitch) + pitch = max(min( round(text2num(new_pitch)), 99),0) + if("talkspeed") + var/new_talkspeed = input(user, "Choose your character's voice talk speed:\n(140-240) Default is 175.", "Character Preference") as num|null + if(new_talkspeed) + talkspeed = max(min( round(text2num(new_talkspeed)), 240),140) + if("eyes") var/new_eyes = input(user, "Choose your character's eye colour:", "Character Preference") as color|null if(new_eyes) @@ -1267,6 +1292,9 @@ datum/preferences if("ghost_radio") toggles ^= CHAT_GHOSTRADIO + if("player_voices") + toggles ^= SOUND_VOICES + if("save") save_preferences() save_character() diff --git a/code/modules/client/preferences_savefile.dm b/code/modules/client/preferences_savefile.dm index 4152a8f0bd6..262f27330bb 100644 --- a/code/modules/client/preferences_savefile.dm +++ b/code/modules/client/preferences_savefile.dm @@ -120,6 +120,10 @@ S["underwear"] >> underwear S["backbag"] >> backbag S["b_type"] >> b_type + S["accent"] >> accent + S["voice"] >> voice + S["pitch"] >> pitch + S["talkspeed"] >> talkspeed //Jobs S["alternate_option"] >> alternate_option @@ -174,6 +178,10 @@ underwear = sanitize_integer(underwear, 1, underwear_m.len, initial(underwear)) backbag = sanitize_integer(backbag, 1, backbaglist.len, initial(backbag)) b_type = sanitize_text(b_type, initial(b_type)) + accent = sanitize_text(accent, initial(accent)) + voice = sanitize_text(voice, initial(voice)) + pitch = sanitize_text(pitch, initial(pitch)) + talkspeed = sanitize_text(talkspeed, initial(talkspeed)) alternate_option = sanitize_integer(alternate_option, 0, 2, initial(alternate_option)) job_civilian_high = sanitize_integer(job_civilian_high, 0, 65535, initial(job_civilian_high)) @@ -352,6 +360,10 @@ S["underwear"] << underwear S["backbag"] << backbag S["b_type"] << b_type + S["accent"] << accent + S["voice"] << voice + S["pitch"] << pitch + S["talkspeed"] << talkspeed //Jobs S["alternate_option"] << alternate_option diff --git a/code/modules/client/preferences_toggles.dm b/code/modules/client/preferences_toggles.dm index 1ab2d13bf50..9e9c8218ef0 100644 --- a/code/modules/client/preferences_toggles.dm +++ b/code/modules/client/preferences_toggles.dm @@ -25,7 +25,7 @@ src << "As a ghost, you will now [(prefs.toggles & CHAT_GHOSTRADIO) ? "hear all radio chat in the world" : "only hear from nearby speakers"]." prefs.save_preferences() feedback_add_details("admin_verb","TGR") - + /client/proc/toggle_hear_radio() set name = "Show/Hide RadioChatter" set category = "Preferences" @@ -85,6 +85,15 @@ src << sound(null, repeat = 0, wait = 0, volume = 85, channel = 1) // stop the jamsz feedback_add_details("admin_verb","TLobby") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! +/client/verb/togglevoices() + set name = "Toggle player voices" + set category = "Preferences" + set desc = "Toggle hearing player voice sounds" + prefs.toggles ^= SOUND_VOICES + prefs.save_preferences() + src << "You will [(prefs.toggles & SOUND_VOICES) ? "now" : "no longer"] hear voices of players around you, or your own voice." + feedback_add_details("admin_verb","TVoice") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! + /client/verb/togglemidis() set name = "Hear/Silence Midis" set category = "Preferences" @@ -181,4 +190,4 @@ prefs.UI_style_alpha = UI_style_alpha_new prefs.UI_style_color = UI_style_color_new prefs.save_preferences() - usr << "UI was saved" + usr << "UI was saved" diff --git a/code/modules/mob/living/say.dm b/code/modules/mob/living/say.dm index 927865f65b1..30dd2d400ef 100644 --- a/code/modules/mob/living/say.dm +++ b/code/modules/mob/living/say.dm @@ -375,6 +375,23 @@ var/list/department_radio_keys = list( if(M != src && is_speaking_radio) M:show_message("[src] talks into [used_radios.len ? used_radios[1] : "radio"]") + if(message_mode == null) + var/accent = "en-us" + var/voice = "m7" + var/speed = 175 + var/pitch = 0 + var/echo = 10 + if(istype(src, /mob/living/silicon/ai)) + echo = 90 + if(istype(src, /mob/living/silicon/robot)) + echo = 60 + if(src.client && src.client.prefs) + accent = src.client.prefs.accent + voice = src.client.prefs.voice + speed = src.client.prefs.talkspeed + pitch = src.client.prefs.pitch + src:texttospeech(message, speed, pitch, accent, "+[voice]", echo) + var/rendered = null if (length(heard_a)) @@ -389,6 +406,11 @@ var/list/department_radio_keys = list( for (var/mob/M in heard_a) //BEGIN TELEPORT CHANGES + if(message_mode == null && fexists("sound/playervoices/[src.ckey].ogg")) + if(M.client) + if(M.client.prefs) + if(M.client.prefs.toggles & SOUND_VOICES) + playsound(src.loc, "sound/playervoices/[src.ckey].ogg", 70, 0, 5, 1) if(!istype(M, /mob/new_player)) if(M && M.stat == DEAD) if ((M.client.prefs.toggles & CHAT_GHOSTEARS) && M in onscreen) diff --git a/code/setup.dm b/code/setup.dm index 33734fe20a1..032bef27bf3 100644 --- a/code/setup.dm +++ b/code/setup.dm @@ -659,6 +659,7 @@ var/list/TAGGERLOCATIONS = list("Disposals", #define CHAT_DEBUGLOGS 2048 #define CHAT_LOOC 4096 #define CHAT_GHOSTRADIO 8192 +#define SOUND_VOICES 16384 #define TOGGLES_DEFAULT (SOUND_ADMINHELP|SOUND_MIDI|SOUND_AMBIENCE|SOUND_LOBBY|CHAT_OOC|CHAT_DEAD|CHAT_GHOSTEARS|CHAT_GHOSTSIGHT|CHAT_PRAYER|CHAT_RADIO|CHAT_ATTACKLOGS|CHAT_LOOC) diff --git a/scripts/voice.py b/scripts/voice.py index fd0dc45b480..0e5bab19d52 100644 --- a/scripts/voice.py +++ b/scripts/voice.py @@ -19,17 +19,18 @@ playervoicespath = "Z:/Git/Space Station 13/Baystation12/sound/playervoices/" soxpath = "C:/Program Files (x86)/sox-14-4-1/" oggencpath = "C:/Program Files (x86)/WinVorbis/" text = string.replace(text, "39", "'") -command = "\""+espeakpath+"espeak.exe\" -w "+playervoicespath+""+ckey+"u.wav -v"+accent+""+voice+" \""+text+"\" -p "+pitch+" -s "+speed+" -a 100" +command = "\""+espeakpath+"espeak.exe\" -w \""+playervoicespath+""+ckey+"u.wav\" -v"+accent+""+voice+" \""+text+"\" -p "+pitch+" -s "+speed+" -a 100" # First we make the voice file, sounds/playervoice/keyu.wav +print(command) call(command, shell=True) -command2 = "\""+soxpath+"sox.exe\" "+playervoicespath+""+ckey+"u.wav \""+playervoicespath+""+ckey+".wav\" echo 1 0.5 "+echo+" .5" +command2 = "\""+soxpath+"sox.exe\" \""+playervoicespath+""+ckey+"u.wav\" \""+playervoicespath+""+ckey+".wav\" echo 1 0.5 "+echo+" .5" +print(command2) # Now we apply effects to it, like echo (there's lots of other effects too) call(command2, shell=True) -#remove the old keyu.wav -os.remove(playervoicespath+""+ckey+"u.wav") -command3 = "\""+oggencpath+"OggEnc.exe\" "+playervoicespath+""+ckey+".wav" +command3 = "\""+oggencpath+"OggEnc.exe\" \""+playervoicespath+""+ckey+".wav\"" #Now we turn key.wav into key.ogg to reduce bandwidth call(command3, shell=True) #delete the wav +os.remove(playervoicespath+""+ckey+"u.wav") os.remove(playervoicespath+""+ckey+".wav") sys.exit() \ No newline at end of file