speaker_service

Module Contents

Classes

SpeakerService

Takes sound and publishes it to the default audio topic for the audio_play package

Functions

main()

Set names, collect params, and give service to server

class speaker_service.SpeakerService(name)

Bases: harmoni_common_lib.service_manager.HarmoniServiceManager

Takes sound and publishes it to the default audio topic for the audio_play package

Parameters

HarmoniServiceManager ([type]) – [description]

do(self, data)

Publishes audio to the “/audio/audio” topic for the audio_play module

Converts input audio from bytes or a local/network path to an audio msg.

Parameters

data (str) – This could be a string of: - audio data - path of local wav file - link of wav audio file you want to download and heard from

file_path_to_audio_data(self, path)

Returns audio data from a local path or internet link TODO: Add wget to docker image

Parameters

path (string) – string of: - local folder path - link of audio file you want to listen to

Returns

return an object with two fields:
  • audio_data: string

  • duration: int (duration of the file)

Return type

json

speaker_service.main()

Set names, collect params, and give service to server