From 9d08b95b32eb044a7a9a31c84f4e033fd203a30d Mon Sep 17 00:00:00 2001 From: dscripka Date: Sat, 28 Jan 2023 11:17:37 -0500 Subject: [PATCH] Updated readme's for installation instructions --- README.md | 10 ++++++++-- examples/README.md | 18 ++++++++++++++++++ examples/capture_activations.py | 2 ++ 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 118572b..c65c557 100644 --- a/README.md +++ b/README.md @@ -18,8 +18,14 @@ Installing openWakeWord is simple and has minimal dependencies: pip install openwakeword ``` -To (optionally) use [Speex](https://www.speex.org/) noise suppresion on Linux systems to improve performance in noisy environments, install the Speex dependencies: `sudo apt-get install libspeexdsp-dev -` Many thanks to [TeaPoly](https://github.com/TeaPoly/speexdsp-ns-python) for their Python wrapper of the Speex noise supression libraries. +To (optionally) use [Speex](https://www.speex.org/) noise suppresion on Linux systems to improve performance in noisy environments, install the Speex dependencies and then the pre-built Python package (see the assets [here](https://github.com/dscripka/openWakeWord/releases/tag/v0.1.1) for all .whl versions), adjusting for your python version and system architecture as needed. + +``` +sudo apt-get install libspeexdsp-dev +pip install https://github.com/dscripka/openWakeWord/releases/download/v0.1.1/speexdsp_ns-0.1.2-cp38-cp38-linux_x86_64.whl +``` + +Many thanks to [TeaPoly](https://github.com/TeaPoly/speexdsp-ns-python) for their Python wrapper of the Speex noise supression libraries. For quick local testing, use the included [example script](examples/detect_from_microphone.py) to try streaming detection from a local microphone. diff --git a/examples/README.md b/examples/README.md index 34c80ef..0d6e168 100644 --- a/examples/README.md +++ b/examples/README.md @@ -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 ` + +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. diff --git a/examples/capture_activations.py b/examples/capture_activations.py index 20368f1..f44855c 100644 --- a/examples/capture_activations.py +++ b/examples/capture_activations.py @@ -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) \ No newline at end of file