def qbo_read_setting(setting): if (setting == 'robotName'): return (SettingsReader.getRobotNameFromSettings().lower().strip()) elif (setting == 'userName'): return (SettingsReader.getUserName().lower().strip()) else: return 'Error: Unknown setting'
def qbo_write_setting(setting, value): if (setting == 'robotName'): SettingsReader.renameRobot(value) return True elif (setting == 'userName'): SettingsReader.renameUser(value) return True else: return 'Error: Unknown setting' return False
def MakeSettings(filename, NewSettings, ForceTypeChange): settings = SR.LoadSettings(filename) for key in NewSettings: if (not ForceTypeChange) and (key in settings) and type( NewSettings[key]) != type(settings[key]): print('Tried to change ' + key + ' from ' + str(settings[key]) + ' to ' + str(NewSettings[key]) + ', but they are of different types.') continue settings[key] = NewSettings[key] SR.PrintSettings(settings, filename)
def modifyAudioPitchVoice(sound): audioVoice = SettingsReader.getRobotAudioVoice() # speed modifier for different text-to-speech sources speed_mod = 1 if (tts_src == "Google"): speed_mod = 1 elif (tts_src == "IBM"): speed_mod = 0.9 if (audioVoice == voice_profile_markus): new_sample_rate = int(sound.frame_rate * speed_mod * (markus_speed**markus_octaves)) sound = sound._spawn(sound.raw_data, overrides={'frame_rate': new_sample_rate}) return sound.speedup(markus_velocidad_X, 150, 25) elif (audioVoice == voice_profile_gustav): new_sample_rate = int(sound.frame_rate * speed_mod * (gustav_speed**gustav_octaves)) sound = sound._spawn(sound.raw_data, overrides={'frame_rate': new_sample_rate}) return sound.speedup(gustav_velocidad_X, 150, 25) elif (audioVoice == voice_profile_anita): new_sample_rate = int(sound.frame_rate * speed_mod * (anita_speed**anita_octaves)) return sound._spawn(sound.raw_data, overrides={'frame_rate': new_sample_rate}) elif (audioVoice == voice_profile_arabella): new_sample_rate = int(sound.frame_rate * speed_mod * (arabella_speed**arabella_octaves)) return sound._spawn(sound.raw_data, overrides={'frame_rate': new_sample_rate}) elif (audioVoice == voice_profile_neutral): new_sample_rate = int(sound.frame_rate * speed_mod * (neutral_speed**neutral_octaves)) return sound._spawn(sound.raw_data, overrides={'frame_rate': new_sample_rate}) else: # std voice (0) return sound
def modifyAudioVolume(sound): return sound + (SettingsReader.getRobotAudioVolume() - 50)
mic1_rms = (par_list[1] << 8 | par_list[0]) / 32767.0 mic2_rms = (par_list[3] << 8 | par_list[2]) / 32767.0 mic3_rms = (par_list[5] << 8 | par_list[4]) / 32767.0 #print mic1_rms #print mic2_rms #print mic3_rms QBO.GetHeadCmd("SET_MIC_INPUT", 0) # Switch to mic 0/1/2 (or 1/2/3?) #--------------------------------------------------------------------------------------------- # MainProgram Start - (entrance point) #--------------------------------------------------------------------------------------------- ChangeMicrophone() SettingsReader.LoadFromServer() QBO.SetMouth(0x1b1f0e04) QBO.SetMouth(0x1b1f0e04) QBO.SetNoseColor(QboCmd.nose_color_green) # init nose QBO.SetNoseColor(QboCmd.nose_color_green) # init nose # wait for wake word while True: try: #SettingsReader.LoadFromServer() robotName = SettingsReader.getRobotNameFromSettings().lower().strip() userName = SettingsReader.getUserName() emergencyMail = SettingsReader.getEmergencyEmail().lower().strip()
SR.PrintSettings(settings, filename) if len(sys.argv) < 2: sys.exit( 'Usage: python ChangeSettings.py {-flags} [varname=value] {varname=value} ... [directory1] {directory2} ...' ) flags = '' if sys.argv[1][0] == '-': flags = sys.argv[1][1:] del sys.argv[1] filenames = [] NewValues = collections.OrderedDict() for argument in sys.argv[1:]: if re.match('.*=.*', argument): parts = argument.split('=', 1) NameAndValue = SR.InterpretVariable(None, parts[0], parts[1]) NewValues[NameAndValue[0]] = NameAndValue[1] else: filenames.append(argument) ChangeTypes = ('f' in flags) for filename in filenames: MakeSettings(filename, NewValues, ChangeTypes)
import os, sys, time, json # audio sys.path.append( '/opt/QBO/catkin_ws/src/RoboGen-QBO/scripts/python/RoboGen_Projects/EmotionAudio' ) import Processing_Audio import Various_Functions # saved settings sys.path.append( '/opt/QBO/catkin_ws/src/RoboGen-QBO/scripts/python/RoboGen_Projects/MyQBOSettings' ) import SettingsReader sleepThreshold = SettingsReader.getSleepThreshold() sleepMinValue = SettingsReader.getSleepMinValue() #calendar = SettingsReader.getCalendar() firstRun = 0 calendarTriggered = 0 launch = time.time() #--------------------------------------------------------------------------------------------- # MainProgram Start - (entrance point) #--------------------------------------------------------------------------------------------- while True: #robotName = SettingsReader.getRobotNameFromSettings().lower().strip() #newSleepThreshold = SettingsReader.getSleepThreshold() #newSleepMinValue = SettingsReader.getSleepMinValue() #newCalendar = SettingsReader.getCalendar()