aiy.voice.audio

APIs to record and play audio files.

class aiy.voice.audio.AudioFormat

Bases: aiy.voice.audio.AudioFormat

CD = AudioFormat(sample_rate_hz=44100, num_channels=2, bytes_per_sample=2)
bytes_per_second
class aiy.voice.audio.BytesPlayer

Bases: aiy.voice.audio.Player

play(fmt, device='default')
class aiy.voice.audio.FilePlayer

Bases: aiy.voice.audio.Player

play_raw(fmt, filename, device='default')
play_wav(filename, device='default')
class aiy.voice.audio.Player

Bases: object

join()
class aiy.voice.audio.Recorder

Bases: object

done()
join()
record(fmt, chunk_duration_sec, device='default', num_chunks=None, on_start=None, on_stop=None, filename=None)
aiy.voice.audio.aplay(fmt, filetype='raw', filename=None, device='default')

Returns aplay command line.

aiy.voice.audio.arecord(fmt, filetype='raw', filename=None, device='default')

Returns arecord command line.

aiy.voice.audio.play_raw(fmt, filename_or_data)
aiy.voice.audio.play_raw_async(fmt, filename_or_data)
aiy.voice.audio.play_wav(filename_or_data)
aiy.voice.audio.play_wav_async(filename_or_data)
aiy.voice.audio.record_file(fmt, filename, filetype, wait, device='default')
aiy.voice.audio.record_file_async(fmt, filename, filetype, device='default')
aiy.voice.audio.wave_get_format(wav_file)
aiy.voice.audio.wave_set_format(wav_file, fmt)