API

I/O’s managements

Audio module to manage I/Os and streams.

This module manages the audio I/Os of the computer and send the stream to the speech recognition engine. It’s purpose is to unify all type of sources (physical or application streams) into one unique system without having worriying about source types.

Note

At the moment, this module takes only the input from the default microphone of the laptop. This has to be improved in the future and find a way configure easily the defaults.

ewo.audio.callback(in_data, frame_count, time_info, status)[source]

Audio callback of the hardware

This function is the callback (non-blocking) of the audio function and its purpose is to connect the input to the output.

Returns:input data a bit at 0 in order to continue to deliver the buffers.
ewo.audio.start_recording(width=2, channel_number=1, sample_rate=44100)[source]

Start the stream.

This function starts the audio stream according to few parameters. It stays active thanks to the infinite loop.

Command Line Interface (CLI)

Command line module

Give the possibility to use the program through a simple command line system.

Note

It could be interesting to have a kind of group command to select the type of AudioSource and have the right range of parameters that goes with it.

$ ewo microphone -s 44100
$ ewo microphone -o outputfile.wav
ewo.cli.main()

Utilities

ewo.utils.ms2smp(ms, sample_rate)[source]

Milliseconds to samples converter.

Simple converter in order to compute the number of samples for a given time frame in milliseconds and the sampling rate.

Parameters:
  • ms (int) – Number of milliseconds.
  • sample_rate (int) – Sampling rate in Hertz.
Returns:

Return the number of sample (forced as an int).