{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "from vad_recorder import VADRecorder\n", "import time\n", "\n", "# Instantiate WhisperWrap with the target device name and other parameters\n", "vad_rec = VADRecorder()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "print(\"Starting VAD recording thread\")\n", "\n", "try:\n", " vad_rec.start_vad_recorder(target_device_name=\"Virtual\")\n", "\n", "\n", " recordings_count = 0\n", " now_speech = False\n", "\n", " print(\"Done!\")\n", " while True:\n", " if vad_rec.speech != now_speech:\n", " now_speech = vad_rec.speech\n", " print(f\"Speech: {now_speech}\")\n", " if len(vad_rec.audios_for_whisper) != recordings_count:\n", " recordings_count = len(vad_rec.audios_for_whisper)\n", " print(f\"Recordings count: {recordings_count}\")\n", "\n", " time.sleep(0.01)\n", "\n", "except (KeyboardInterrupt, SystemExit):\n", " print(\"Cleaning up...\")\n", " vad_rec.stop_vad_recorder()\n" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.11.6" } }, "nbformat": 4, "nbformat_minor": 2 }