if len(argv) < 2:
    rospy.logerr('Need path to configfile as first parameter!')
    exit('1')
path_to_config = argv[1]
data = yaml.safe_load(open(path_to_config))

rospy.loginfo('Creating emotion recognizer instance...')

wrapper = Emotion_rec(data)

emotion_publisher = rospy.Publisher(nodename + '/' + 'emotion',
                                    EmotionInfo,
                                    queue_size=10)

rospy.loginfo('Creating esiaf handler...')
handler = pyesiaf.Esiaf_Handler('emotion_recognizer',
                                pyesiaf.NodeDesignation.Emotion, sys.argv)

rospy.loginfo('Setting up esiaf...')
esiaf_format = pyesiaf.EsiafAudioFormat()
esiaf_format.rate = pyesiaf.Rate.RATE_16000
esiaf_format.bitrate = pyesiaf.Bitrate.BIT_INT_16_SIGNED
esiaf_format.endian = pyesiaf.Endian.LittleEndian
esiaf_format.channels = 1

esiaf_audio_info = pyesiaf.EsiafAudioTopicInfo()
esiaf_audio_info.topic = data['esiaf_input_topic']
esiaf_audio_info.allowedFormat = esiaf_format

rospy.loginfo('adding input topic...')

# read config
rospy.loginfo('Loading config...')
argv = sys.argv
if len(argv) < 2:
    rospy.logerr('Need path to configfile as first parameter!')
    exit('1')
path_to_config = argv[1]
data = yaml.safe_load(open(path_to_config))

rospy.loginfo('Creating pocketsphinx instance...')

wrapper = Wrapper(nodename=nodename, **data)

rospy.loginfo('Creating esiaf handler...')
handler = pyesiaf.Esiaf_Handler('pocketsphinx',
                                pyesiaf.NodeDesignation.SpeechRec, sys.argv)

rospy.loginfo('Setting up esiaf...')
esiaf_format = pyesiaf.EsiafAudioFormat()
esiaf_format.rate = pyesiaf.Rate.RATE_16000
esiaf_format.bitrate = pyesiaf.Bitrate.BIT_INT_16_SIGNED
esiaf_format.endian = pyesiaf.Endian.LittleEndian
esiaf_format.channels = 1

esiaf_audio_info = pyesiaf.EsiafAudioTopicInfo()
esiaf_audio_info.topic = data['esiaf_input_topic']
esiaf_audio_info.allowedFormat = esiaf_format

rospy.loginfo('adding input topic...')

Esempio n. 3
0
        for f in listdir(data['file_directory'])
        if isfile(join(data['file_directory'], f)) and '.wav' in f
    ]
else:
    files.append(join(data['file_directory'], data['file']))

rospy.loginfo('Playback of files: ' +
              str([file.split('/')[-1] for file in files]))

rospy.loginfo(
    'Acquiring wav format, assuming every file has the same format...')

info = soundfile.info(files[0])

rospy.loginfo('Creating esiaf handler...')
handler = pyesiaf.Esiaf_Handler("wav_player", pyesiaf.NodeDesignation.Other,
                                sys.argv)

rospy.loginfo('Setting up esiaf...')
esiaf_format = esiaf_format_from_soundfile_info(info)
esiaf_audio_info = pyesiaf.EsiafAudioTopicInfo()
esiaf_audio_info.topic = data['esiaf_output_topic']
esiaf_audio_info.allowedFormat = esiaf_format

rospy.loginfo('adding output...')
handler.add_output_topic(esiaf_audio_info)
handler.start_esiaf()


# create the wav players
def player_loop():
    time.sleep(2)
Esempio n. 4
0
argv = sys.argv
if len(argv) < 2:
    rospy.logerr('Need path to configfile as first parameter!')
    exit('1')
path_to_config = argv[1]
data = yaml.safe_load(open(path_to_config))

rospy.loginfo('Adding SSLInfo publisher...')
ssl_publisher = rospy.Publisher(nodename + '/' + 'SSL', SSLInfo, queue_size=10)

rospy.loginfo('Creating direction of arrival instance...')

wrapper = DOA(data, plot=data['plot_spectra'])

rospy.loginfo('Creating esiaf handler...')
handler = pyesiaf.Esiaf_Handler(nodename, pyesiaf.NodeDesignation.SSL,
                                sys.argv)

rospy.loginfo('Setting up esiaf...')
esiaf_format = pyesiaf.EsiafAudioFormat()
esiaf_format.rate = pyesiaf.Rate.RATE_16000
esiaf_format.bitrate = pyesiaf.Bitrate.BIT_INT_16_SIGNED
esiaf_format.endian = pyesiaf.Endian.LittleEndian
esiaf_format.channels = len(data['mic_array'])

esiaf_audio_info = pyesiaf.EsiafAudioTopicInfo()
esiaf_audio_info.topic = data['esiaf_input_topic']
esiaf_audio_info.allowedFormat = esiaf_format

rospy.loginfo('adding output topic...')
esiaf_audio_out_info = pyesiaf.EsiafAudioTopicInfo()
esiaf_audio_out_info.topic = data['esiaf_output_topic']
# read config
rospy.loginfo('Loading config...')
argv = sys.argv
if len(argv) < 2:
    rospy.logerr('Need path to configfile as first parameter!')
    exit('1')
path_to_config = argv[1]
data = yaml.safe_load(open(path_to_config))

rospy.loginfo('Creating direction of arrival instance...')

splitter = esiaf_channel_utils.Splitter()

rospy.loginfo('Creating esiaf handler...')
handler = pyesiaf.Esiaf_Handler('esiad_splitter',
                                pyesiaf.NodeDesignation.Other, sys.argv)

rospy.loginfo('Setting up esiaf...')
esiaf_format = esiaf_channel_utils.create_esiaf_audio_format_from_dict(
    data['esiaf_input']['format'])

esiaf_audio_info = pyesiaf.EsiafAudioTopicInfo()
esiaf_audio_info.topic = data['esiaf_input']['topic']
esiaf_audio_info.allowedFormat = esiaf_format

rospy.loginfo('adding output topics...')
output_topics = []
channels = esiaf_format.channels
esiaf_format.channels = 1

for each in range(channels):