Updated readme's for installation instructions

This commit is contained in:
dscripka 2023-01-28 11:17:37 -05:00
parent 4e77db111c
commit 9d08b95b32
3 changed files with 28 additions and 2 deletions

View file

@ -12,6 +12,24 @@ This is a simple example which allows you to test openWakeWord by using a locall
Note that if you have more than one microphone connected to your system, you may need to adjust the PyAudio configuration in the script to select the appropriate input device.
## Capture Activations
This script is designed to run silently in the background and capture activations for the inlcluded pre-trained models. You can specify the initialization arguments, activation threshold, and output directory for the saved audio files for each activation. To run the script, follow these steps:
1) Install the example-specific requirements:
```
# On Linux
pip install pyaudio scipy
# On Windows
pip install PyAudioWPatch scipy
```
2) Run the script: `python capture_activations.py --threshold 0.5 --output_dir <my_dir>`
Note that if you have more than one microphone connected to your system, you may need to adjust the PyAudio configuration in the script to select the appropriate input device.
## Benchmark Efficiency
This is a script that estimates how many openWakeWord models could be run on on the specified number of cores for the current system. Can be useful to determine if a given system has the resources required for a particular use-case.

View file

@ -114,6 +114,8 @@ if __name__ == "__main__":
detect_time = datetime.datetime.now().strftime("%Y_%m_%d_%H_%M_%S")
print(f'Detected activation from \"{mdl}\" model at time {detect_time}!')
# Capture total of 5 seconds, with the audio associated with the
# activation around the ~4 second point
audio_context = np.array(list(owwModel.preprocessor.raw_data_buffer)[-16000*5:]).astype(np.int16)
fname = detect_time + f"_{mdl}.wav"
scipy.io.wavfile.write(os.path.join(os.path.abspath(args.output_dir), fname), 16000, audio_context)