### Install and Run Web Demo (NPM) Source: https://github.com/picovoice/porcupine/blob/master/README.md Use this command to install dependencies and start the web demo with NPM. Replace ${LANGUAGE} with the desired language code. ```bash npm install npm run start ${LANGUAGE} ``` -------------------------------- ### Install and Run Web Demo (Yarn) Source: https://github.com/picovoice/porcupine/blob/master/README.md Use this command to install dependencies and start the web demo with Yarn. Replace ${LANGUAGE} with the desired language code. ```bash yarn yarn start ${LANGUAGE} ``` -------------------------------- ### Install and Run Porcupine Demo Source: https://github.com/picovoice/porcupine/blob/master/demo/react/README.md Use yarn or npm to install dependencies and start the local web server for the demo. Replace `${LANGUAGE}` with a desired language code (e.g., 'de' for German) or omit it to see a list of available languages. ```bash yarn yarn start ${LANGUAGE} ``` ```bash npm install npm run start ${LANGUAGE} ``` -------------------------------- ### Install Porcupine Node.js Demo Source: https://github.com/picovoice/porcupine/blob/master/demo/nodejs/README.md Install the Porcupine Node.js demo package globally using yarn or npm. ```bash yarn global add @picovoice/porcupine-node-demo ``` ```bash npm install -g @picovoice/porcupine-node-demo ``` -------------------------------- ### Install and Run on Android Source: https://github.com/picovoice/porcupine/blob/master/demo/react-native/README.md Use these commands to set up the environment and then build and deploy the demo app to an Android device. Replace ${LANGUAGE} with the desired language code. ```console yarn android-install # sets up environment ``` ```console yarn android-run ${LANGUAGE} # builds and deploys to Android ``` -------------------------------- ### Install and Run on iOS Source: https://github.com/picovoice/porcupine/blob/master/demo/react-native/README.md Use these commands to set up the environment and then build and deploy the demo app to an iOS device. Replace ${LANGUAGE} with the desired language code. ```console yarn ios-install # sets up environment ``` ```console yarn ios-run ${LANGUAGE} # builds and deploys to iOS ``` -------------------------------- ### Run Microphone Demo with Console Output Source: https://github.com/picovoice/porcupine/blob/master/demo/nodejs/README.md Example of running the microphone demo, showing the console output when a keyword is detected. ```bash ppn-mic-demo --access_key ${ACCESS_KEY} --keywords grapefruit ``` -------------------------------- ### Install NodeJS Porcupine Demo Package Source: https://github.com/picovoice/porcupine/blob/master/README.md Installs the NodeJS demo package globally. Ensure you have a working microphone connected. ```bash yarn global add @picovoice/porcupine-node-demo ``` -------------------------------- ### Install Porcupine NodeJS SDK Source: https://github.com/picovoice/porcupine/blob/master/README.md Install the Porcupine NodeJS SDK using yarn. ```bash yarn add @picovoice/porcupine-node ``` -------------------------------- ### Run File Demo with Single Keyword Source: https://github.com/picovoice/porcupine/blob/master/demo/nodejs/README.md Example of running the file demo to detect a single keyword and display its timestamp. ```bash ppn-file-demo \ --access_key ${ACCESS_KEY} \ --input_audio_file_path ../../resources/audio_samples/multiple_keywords.wav \ --keywords grasshopper ``` -------------------------------- ### Install Porcupine React Binding Source: https://github.com/picovoice/porcupine/blob/master/binding/react/README.md Install the Porcupine React binding and the Web Voice Processor using Yarn or npm. ```bash yarn add @picovoice/porcupine-react @picovoice/web-voice-processor ``` ```bash npm install --save @picovoice/porcupine-react @picovoice/web-voice-processor ``` -------------------------------- ### Install Porcupine Nuget Package Source: https://github.com/picovoice/porcupine/blob/master/binding/dotnet/README.md Install the Porcupine Nuget package using the .NET CLI. ```console dotnet add package Porcupine ``` -------------------------------- ### Install Node.js Dependencies with npm Source: https://github.com/picovoice/porcupine/blob/master/demo/nodejs/README.md Install project dependencies from the demo/nodejs folder using npm. ```console cd demo/nodejs npm install ``` -------------------------------- ### Install Porcupine Demo Package Source: https://github.com/picovoice/porcupine/blob/master/demo/python/README.md Installs the Porcupine demo package using pip. Ensure you have Python 3.9+. ```bash sudo pip3 install pvporcupinedemo ``` -------------------------------- ### Install Porcupine Web SDK Source: https://github.com/picovoice/porcupine/blob/master/README.md Install the necessary packages for the Porcupine web SDK using either yarn or npm. ```bash yarn add @picovoice/porcupine-web @picovoice/web-voice-processor ``` ```bash npm install --save @picovoice/porcupine-web @picovoice/web-voice-processor ``` -------------------------------- ### Get pvbase64 Help Source: https://github.com/picovoice/porcupine/blob/master/binding/react/README.md Display the help information for the pvbase64 script to understand its options and usage. ```bash npx pvbase64 -h ``` -------------------------------- ### Install Porcupine React SDK Source: https://github.com/picovoice/porcupine/blob/master/README.md Install the necessary packages for the Porcupine React SDK using either yarn or npm. ```bash yarn add @picovoice/porcupine-react @picovoice/web-voice-processor ``` ```bash npm install @picovoice/porcupine-react @picovoice/web-voice-processor ``` -------------------------------- ### Install Node.js Dependencies with Yarn Source: https://github.com/picovoice/porcupine/blob/master/demo/nodejs/README.md Install project dependencies from the demo/nodejs folder using Yarn. ```console cd demo/nodejs yarn ``` -------------------------------- ### Install React Native Porcupine Demo Environment (iOS) Source: https://github.com/picovoice/porcupine/blob/master/README.md Run this command to set up the necessary environment for the React Native Porcupine demo on iOS. ```console yarn ios-install ``` -------------------------------- ### Install React Native Porcupine Demo Environment (Android) Source: https://github.com/picovoice/porcupine/blob/master/README.md Run this command to set up the necessary environment for the React Native Porcupine demo on Android. ```console yarn android-install ``` -------------------------------- ### Install Porcupine Web SDK with npm Source: https://github.com/picovoice/porcupine/blob/master/binding/web/README.md Use this command to add the Porcupine Web SDK to your project when using npm. ```bash npm install --save @picovoice/porcupine-web ``` -------------------------------- ### Install Porcupine Web SDK with Yarn Source: https://github.com/picovoice/porcupine/blob/master/binding/web/README.md Use this command to add the Porcupine Web SDK to your project when using Yarn. ```bash yarn add @picovoice/porcupine-web ``` -------------------------------- ### Get Porcupine File Demo Help Source: https://github.com/picovoice/porcupine/blob/master/demo/dotnet/README.md Display the help message for the Porcupine file demo to see available arguments and options, including default keyword files. ```console dotnet run -c FileDemo.Release -- --help ``` -------------------------------- ### PorcupineManager Initialization with Built-in Keywords Source: https://github.com/picovoice/porcupine/blob/master/binding/flutter/README.md Initializes the PorcupineManager using a set of predefined built-in keywords. This is the quickest way to get started with wake word detection. ```APIDOC ## PorcupineManager Initialization with Built-in Keywords ### Description Initializes the PorcupineManager using a set of predefined built-in keywords. This is the quickest way to get started with wake word detection. ### Method `PorcupineManager.fromBuiltInKeywords` ### Endpoint N/A (Constructor) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```dart import 'package:porcupine_flutter/porcupine_manager.dart'; import 'package:porcupine_flutter/porcupine_error.dart'; final String accessKey = "{ACCESS_KEY}"; // AccessKey obtained from Picovoice Console (https://console.picovoice.ai/) void createPorcupineManager() async { try{ _porcupineManager = await PorcupineManager.fromBuiltInKeywords( accessKey, [BuiltInKeyword.PICOVOICE, BuiltInKeyword.PORCUPINE], _wakeWordCallback); } on PorcupineException catch (err) { // handle porcupine init error } } void _wakeWordCallback(int keywordIndex) { if (keywordIndex == 0) { // picovoice detected } else if (keywordIndex == 1) { // porcupine detected } } ``` ### Response #### Success Response (Instance of PorcupineManager) - **_porcupineManager** (PorcupineManager) - An initialized instance of the PorcupineManager. #### Response Example N/A (Initialization returns an instance, not a JSON response) ### Error Handling - **PorcupineException**: Thrown if there is an error during initialization. ``` -------------------------------- ### Show Help for File Demo Source: https://github.com/picovoice/porcupine/blob/master/demo/nodejs/README.md Use this command to display all available options for the file demo. ```console ppn-file-demo --help ``` -------------------------------- ### Display Microphone Demo Help Source: https://github.com/picovoice/porcupine/blob/master/demo/java/README.md Shows the usage string for the microphone demo, listing all available command-line options and built-in keyword files. ```bash java -jar porcupine-mic-demo.jar -h ``` -------------------------------- ### Run File Demo Source: https://github.com/picovoice/porcupine/blob/master/demo/nodejs/README.md Scan a WAV file for keywords using the file demo. Ensure the WAV file is 16KHz, 16-bit linear PCM, and mono. Specify AccessKey, input file path, and keywords. ```bash ppn-file-demo \ --access_key ${ACCESS_KEY} \ --input_audio_file_path ../../resources/audio_samples/multiple_keywords.wav \ --keywords grasshopper,bumblebee ``` -------------------------------- ### Show Help for Microphone Demo Source: https://github.com/picovoice/porcupine/blob/master/demo/nodejs/README.md Use this command to display all available options for the microphone demo. ```console ppn-mic-demo --help ``` -------------------------------- ### Run File Demo Usage (Windows) Source: https://github.com/picovoice/porcupine/blob/master/demo/c/README.md Execute the file demo without arguments to display its usage instructions on Windows. ```console .\demo\c\build\porcupine_demo_file.exe Usage : .\demo\c\build\porcupine_demo_file.exe -l LIBRARY_PATH -m MODEL_PATH -k KEYWORD_PATH -t SENSITIVITY -a ACCESS_KEY -w WAV_PATH ``` -------------------------------- ### Start Wake Word Detection Source: https://github.com/picovoice/porcupine/blob/master/binding/android/README.md Starts the audio capture and wake word detection process after PorcupineManager has been initialized. ```APIDOC ## Start Wake Word Detection ### Description Initiates the audio recording and wake word detection using the configured PorcupineManager instance. ### Method Signature `porcupineManager.start()` ### Usage Call this method after successfully initializing `PorcupineManager` to begin listening for wake words. ### Request Example ```java porcupineManager.start(); ``` ``` -------------------------------- ### Start PorcupineManager Source: https://github.com/picovoice/porcupine/blob/master/binding/ios/README.md Call the start() method on your PorcupineManager instance to begin audio capture and wake word detection. ```swift do { porcupineManager.start() } catch { } ``` -------------------------------- ### Run File Demo Usage (Linux/macOS/Raspberry Pi) Source: https://github.com/picovoice/porcupine/blob/master/demo/c/README.md Execute the file demo without arguments to display its usage instructions on Linux, macOS, or Raspberry Pi. ```console ./demo/c/build/porcupine_demo_file Usage : ./demo/c/build/porcupine_demo_file -l LIBRARY_PATH -m MODEL_PATH -k KEYWORD_PATH -t SENSITIVITY -a ACCESS_KEY -w WAV_PATH ``` -------------------------------- ### File Demo Command Line Options Source: https://github.com/picovoice/porcupine/blob/master/demo/nodejs/README.md This displays the available command-line options for the ppn-file-demo, including input file, access key, keyword files, built-in keywords, library path, model path, sensitivity, and help. ```console Usage: ppn-file-demo [options] Options: -i, --input_audio_file_path input audio wave file in 16-bit 16KHz linear PCM format (mono) -a, --access_key AccessKey obtain from the Picovoice Console (https://console.picovoice.ai/) -k, --keyword_file_paths absolute path(s) to porcupine keyword files (.ppn) -b, --keywords built in keyword(s) (americano,blueberry,bumblebee,grapefruit,grasshopper,picovoice,porcupine,terminator) -l, --library_file_path absolute path to porcupine dynamic library -m, --model_file_path absolute path to porcupine model -s, --sensitivity sensitivity value between 0 and 1 (default: 0.5) -h, --help display help for command ``` -------------------------------- ### Build Porcupine Java Demos with Gradle Source: https://github.com/picovoice/porcupine/blob/master/demo/java/README.md Build the demo JAR files for Porcupine using Gradle. Navigate to the demo directory and run the build command. ```bash cd porcupine/demo/java ./gradlew build ``` -------------------------------- ### Run Microphone Demo Source: https://github.com/picovoice/porcupine/blob/master/demo/nodejs/README.md Run the microphone demo to listen for keywords live. Specify your AccessKey, keywords, and the audio device index. ```bash ppn-mic-demo \ --access_key ${ACCESS_KEY} \ --keywords grapefruit \ --audio_device_index 0 ``` -------------------------------- ### Start Wake Word Detection Source: https://github.com/picovoice/porcupine/blob/master/binding/react-native/README.md Starts the audio capture and wake word detection process. Returns a boolean indicating success. ```javascript let didStart = await this._porcupineManager.start(); ``` -------------------------------- ### Install Porcupine Python Binding Source: https://github.com/picovoice/porcupine/blob/master/binding/python/README.md Install the Porcupine Python binding using pip. Ensure you are using pip3 for Python 3.9+ compatibility. ```console pip3 install pvporcupine ``` -------------------------------- ### Display Porcupine Demo Help Information Source: https://github.com/picovoice/porcupine/blob/master/demo/python/README.md Shows all available command-line arguments and options for the microphone demo. ```bash porcupine_demo_mic --help ``` -------------------------------- ### Start and Stop PorcupineManager (React Native) Source: https://github.com/picovoice/porcupine/blob/master/README.md Control audio capture and wake word detection by calling the `start` and `stop` methods on the `PorcupineManager` instance. ```javascript let didStart = this._porcupineManager.start(); // .. use Porcupine let didStop = this._porcupineManager.stop(); ``` -------------------------------- ### Run Microphone Demo with Default Keywords Source: https://github.com/picovoice/porcupine/blob/master/demo/dotnet/README.md Executes the microphone demo using the default 'Picovoice' keyword. Requires an ACCESS_KEY. ```console dotnet run -c MicDemo.Release -- \ --access_key ${ACCESS_KEY} \ --keywords picovoice ``` -------------------------------- ### Start and Stop Wake Word Detection Source: https://github.com/picovoice/porcupine/blob/master/binding/flutter/README.md Controls the audio capture and wake word detection process. Use `start()` to begin and `stop()` to pause. ```APIDOC ## Start and Stop Wake Word Detection ### Description Controls the audio capture and wake word detection process. Use `start()` to begin and `stop()` to pause. ### Method `_porcupineManager.start()` `_porcupineManager.stop()` ### Endpoint N/A (Methods on PorcupineManager instance) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```dart // Start detection try{ await _porcupineManager.start(); } on PorcupineException catch (ex) { // deal with either audio exception } // Stop detection await _porcupineManager.stop(); ``` ### Response #### Success Response (void) - No return value on success. #### Response Example N/A ### Error Handling - **PorcupineException**: Thrown if there is an issue starting or stopping the audio capture. ``` -------------------------------- ### Start and Stop Wake Word Detection (Flutter) Source: https://github.com/picovoice/porcupine/blob/master/README.md Starts and stops the audio capture and wake word detection managed by PorcupineManager. Ensure proper error handling. ```dart try { await _porcupineManager.start(); } on PorcupineException catch (ex) { // deal with either audio exception } // .. use porcupine await _porcupineManager.stop(); ``` -------------------------------- ### Run C Microphone Demo (Linux/macOS/RPi) Source: https://github.com/picovoice/porcupine/blob/master/README.md Runs the C microphone demo. Replace placeholders with your specific paths, platform, audio device index, and AccessKey. ```bash ./demo/c/build/porcupine_demo_mic -l ${LIBRARY_PATH} -m lib/common/porcupine_params.pv \ -k resources/keyword_files/${PLATFORM}/porcupine_${PLATFORM}.ppn -t 0.5 \ -d ${AUDIO_DEVICE_INDEX} -a ${ACCESS_KEY} ``` -------------------------------- ### Start Porcupine Wake Word Detection Source: https://github.com/picovoice/porcupine/blob/master/binding/react/README.md Begin detecting wake words using the Porcupine engine by calling the start function. The isListening state will be updated to true upon successful initiation. ```typescript await start(); ``` -------------------------------- ### Run Microphone Demo and Output Audio to File Source: https://github.com/picovoice/porcupine/blob/master/demo/dotnet/README.md Executes the microphone demo, detects wake words, and saves the recorded audio to a specified WAV file. Requires an ACCESS_KEY. ```console dotnet run -c MicDemo.Release -- \ --access_key ${ACCESS_KEY} \ --keywords picovoice \ --audio_device_index 0 \ --output_path ./test.wav ``` -------------------------------- ### Run File Demo with npm Source: https://github.com/picovoice/porcupine/blob/master/demo/nodejs/README.md Execute the file demo using npm, including the '--' separator for demo arguments. ```console npm run file -- --access_key ${ACCESS_KEY} \ --input_audio_file_path ../../resources/audio_samples/multiple_keywords.wav \ --keywords grasshopper ``` -------------------------------- ### Show Available Audio Devices Source: https://github.com/picovoice/porcupine/blob/master/demo/nodejs/README.md Use the `ppn-mic-demo` command with the `--show_audio_devices` flag to list available audio input devices. ```bash ppn-mic-demo --show_audio_devices ``` -------------------------------- ### Run Microphone Demo with Custom Keyword Paths Source: https://github.com/picovoice/porcupine/blob/master/demo/java/README.md Enables the microphone demo to detect custom wake words by specifying the paths to their model files using the -kp argument. ```bash java -jar porcupine-mic-demo.jar -a ${ACCESS_KEY} -kp ${KEYWORD_PATH_ONE} ${KEYWORD_PATH_TWO} ``` -------------------------------- ### Run Microphone Demo with Custom Keyword Paths Source: https://github.com/picovoice/porcupine/blob/master/demo/dotnet/README.md Executes the microphone demo using custom keyword model files specified by their paths. Requires an ACCESS_KEY. ```console dotnet run -c MicDemo.Release -- \ --access_key ${ACCESS_KEY} \ --keyword_paths ${KEYWORD_PATH_ONE} ${KEYWORD_PATH_TWO} ``` -------------------------------- ### Link iOS Package Source: https://github.com/picovoice/porcupine/blob/master/binding/react-native/README.md After adding the native modules, link the iOS package by running pod install in the ios directory. ```bash cd ios && pod install && cd .. ``` -------------------------------- ### Start PorcupineManager Audio Capture Source: https://github.com/picovoice/porcupine/blob/master/binding/android/README.md Call this method after initializing PorcupineManager to begin audio recording and wake word detection. ```java porcupineManager.start(); ``` -------------------------------- ### Run Microphone Demo with Default Keyword Source: https://github.com/picovoice/porcupine/blob/master/demo/python/README.md Opens the default microphone and detects occurrences of the 'Picovoice' wake word. Replace ${ACCESS_KEY} with your Picovoice AccessKey. ```bash porcupine_demo_mic --access_key ${ACCESS_KEY} --keywords picovoice ``` -------------------------------- ### Run C Microphone Demo (Windows) Source: https://github.com/picovoice/porcupine/blob/master/README.md Runs the C microphone demo on Windows. Replace placeholders with your specific DLL path, audio device index, and AccessKey. ```bash .\demo\c\build\porcupine_demo_mic.exe ^ -l lib/windows/amd64/libpv_porcupine.dll ^ -m lib/common/porcupine_params.pv ^ -k resources/keyword_files/windows/porcupine_windows.ppn ^ -t 0.5 ^ -d ${AUDIO_DEVICE_INDEX} ^ -a ${ACCESS_KEY} ``` -------------------------------- ### Build and Run Java Porcupine Microphone Demo Source: https://github.com/picovoice/porcupine/blob/master/README.md Navigate to the Java demo directory, build the application using Gradle, and then run the generated JAR file with your access key and keywords. ```console cd demo/java ./gradlew build cd build/libs java -jar porcupine-mic-demo.jar -a ${ACCESS_KEY} -k porcupine ``` -------------------------------- ### Run Porcupine File Demo with Single Keyword Source: https://github.com/picovoice/porcupine/blob/master/demo/java/README.md Execute the file demo to scan a WAV file for a specific keyword like 'Picovoice'. Requires an AccessKey and the audio file path. ```bash java -jar porcupine-file-demo.jar -a ${ACCESS_KEY} -i ${AUDIO_PATH} -k picovoice ``` -------------------------------- ### Initialize Porcupine with Custom Keyword Paths (.NET) Source: https://github.com/picovoice/porcupine/blob/master/README.md Initialize the Porcupine engine in C# using custom keyword files. Provide a list of paths to your .ppn files to the `FromKeywordPaths` factory method. ```csharp const string accessKey = "${ACCESS_KEY}"; var keywordPaths = new List { "/absolute/path/to/keyword/one", "/absolute/path/to/keyword/two", ... } Porcupine handle = Porcupine.FromKeywordPaths(accessKey, keywordPaths); ``` -------------------------------- ### Get Custom Wake Word Path in iOS Source: https://github.com/picovoice/porcupine/blob/master/binding/ios/README.md Obtain the file path for a custom wake word resource bundled within your iOS application. ```swift let keywordPath = Bundle.main.path(forResource: "keyword_ios", ofType: "ppn") ``` -------------------------------- ### Run Microphone Demo Usage (Linux/macOS/Raspberry Pi) Source: https://github.com/picovoice/porcupine/blob/master/demo/c/README.md Execute the microphone demo without arguments to display its usage instructions on Linux, macOS, or Raspberry Pi. ```console ./demo/c/build/porcupine_demo_mic Usage : ./demo/c/build/porcupine_demo_mic -l LIBRARY_PATH -m MODEL_PATH -k KEYWORD_PATH -t SENSITIVITY -a ACCESS_KEY -d AUDIO_DEVICE_INDEX ./demo/c/build/porcupine_demo_mic [-s, --show_audio_devices] ``` -------------------------------- ### Build C Microphone Demo with CMake Source: https://github.com/picovoice/porcupine/blob/master/README.md Builds the C microphone demo using CMake. This command should be run from the root of the repository. ```bash cmake -S demo/c/. -B demo/c/build && cmake --build demo/c/build --target porcupine_demo_mic ``` -------------------------------- ### Build Porcupine Demos with .NET CLI Source: https://github.com/picovoice/porcupine/blob/master/demo/dotnet/README.md Build the Porcupine .NET Core command-line applications using the dotnet CLI. Ensure you have .NET 8.0 installed. ```console dotnet build -c MicDemo.Release dotnet build -c FileDemo.Release ``` -------------------------------- ### Build C File Demo with CMake Source: https://github.com/picovoice/porcupine/blob/master/README.md Builds the C file demo using CMake. This command should be run from the root of the repository. ```bash cmake -S demo/c/. -B demo/c/build && cmake --build demo/c/build --target porcupine_demo_file ``` -------------------------------- ### Get Porcupine File Demo Usage Information Source: https://github.com/picovoice/porcupine/blob/master/demo/java/README.md Display the help message for the Porcupine file demo to see all available command-line options and built-in keywords. ```bash java -jar porcupine-file-demo.jar -h ``` -------------------------------- ### Run Microphone Demo with npm Source: https://github.com/picovoice/porcupine/blob/master/demo/nodejs/README.md Execute the microphone demo using npm, noting the extra '--' required before demo arguments. ```console npm run mic -- --access_key ${ACCESS_KEY} --keywords grapefruit ``` -------------------------------- ### Install Porcupine React Native Packages Source: https://github.com/picovoice/porcupine/blob/master/binding/react-native/README.md Add the necessary Porcupine and Voice Processor native modules to your React Native project using either yarn or npm. ```bash yarn add @picovoice/react-native-voice-processor yarn add @picovoice/porcupine-react-native ``` ```bash npm i @picovoice/react-native-voice-processor --save npm i @picovoice/porcupine-react-native --save ``` -------------------------------- ### Run Microphone Demo Usage (Windows) Source: https://github.com/picovoice/porcupine/blob/master/demo/c/README.md Execute the microphone demo without arguments to display its usage instructions on Windows. ```console .\demo\c\build\porcupine_demo_mic.exe Usage : .\demo\c\build\porcupine_demo_mic.exe -l LIBRARY_PATH -m MODEL_PATH -k KEYWORD_PATH -t SENSITIVITY -a ACCESS_KEY -d AUDIO_DEVICE_INDEX .\demo\c\build\porcupine_demo_mic.exe [-s, --show_audio_devices] ``` -------------------------------- ### Start Wake Word Detection Source: https://github.com/picovoice/porcupine/blob/master/binding/flutter/README.md Begin audio capture and wake word detection. This is an asynchronous operation and should be handled with a try-catch block to manage potential audio exceptions. ```dart try{ await _porcupineManager.start(); } on PorcupineException catch (ex) { // deal with either audio exception } ``` -------------------------------- ### Build .NET Porcupine Demo Source: https://github.com/picovoice/porcupine/blob/master/README.md Build the .NET demo application for microphone input. This command should be run from the specified demo directory. ```console dotnet build -c MicDemo.Release ``` -------------------------------- ### Run Porcupine File Demo for 'Picovoice' Source: https://github.com/picovoice/porcupine/blob/master/demo/python/README.md Use this command to run the file demo and detect the 'Picovoice' keyword. Ensure you have set the ACCESS_KEY and AUDIO_PATH environment variables. ```console porcupine_demo_file --access_key ${ACCESS_KEY} --wav_path ${AUDIO_PATH} --keywords picovoice ``` -------------------------------- ### Run Microphone Demo with Default Wake Word Source: https://github.com/picovoice/porcupine/blob/master/demo/java/README.md Launches the microphone demo to detect the default 'Picovoice' wake word using the default microphone. Requires an access key. ```bash java -jar porcupine-mic-demo.jar -a ${ACCESS_KEY} -k picovoice ``` -------------------------------- ### Prepare Porcupine Flutter Demo Source: https://github.com/picovoice/porcupine/blob/master/demo/flutter/README.md Run this script to set up the demo for a specific language. Replace ${LANGUAGE} with a language code (e.g., 'de', 'ko'). Run without a language code to see available options. ```console dart scripts/prepare_demo.dart ${LANGUAGE} ``` -------------------------------- ### Show Audio Devices (Windows) Source: https://github.com/picovoice/porcupine/blob/master/demo/c/README.md Run the microphone demo with the --show_audio_devices flag to list available audio input devices on Windows. ```console .\demo\c\build\porcupine_demo_mic.exe --show_audio_devices ``` -------------------------------- ### Show Audio Devices (Linux/macOS/Raspberry Pi) Source: https://github.com/picovoice/porcupine/blob/master/demo/c/README.md Run the microphone demo with the --show_audio_devices flag to list available audio input devices on Linux, macOS, or Raspberry Pi. ```console ./demo/c/build/porcupine_demo_mic --show_audio_devices ``` -------------------------------- ### Run Microphone Demo with Yarn Source: https://github.com/picovoice/porcupine/blob/master/demo/nodejs/README.md Execute the microphone demo using Yarn, passing necessary command-line arguments. ```console yarn mic --access_key ${ACCESS_KEY} --keywords grapefruit ``` -------------------------------- ### Build Windows C Demo Source: https://github.com/picovoice/porcupine/blob/master/demo/c/README.md Use CMake with the MinGW Makefiles generator to build the Porcupine microphone demo for Windows. ```console cmake -S demo/c/. -B demo/c/build -DPV_RECORDER_PLATFORM={PV_RECORDER_PLATFORM} -G "MinGW Makefiles" cmake --build demo/c/build --target porcupine_demo_mic ``` -------------------------------- ### Display Porcupine File Demo Help Source: https://github.com/picovoice/porcupine/blob/master/demo/python/README.md View all available options and arguments for the porcupine_demo_file command by running this command. ```console porcupine_demo_file --help ``` -------------------------------- ### Create PorcupineManager with Custom Keyword Paths Source: https://github.com/picovoice/porcupine/blob/master/binding/react-native/README.md Initializes PorcupineManager using custom keyword files (.ppn). Requires an access key and the paths to the keyword files. This method is asynchronous. ```javascript const accessKey = "${ACCESS_KEY}" this._porcupineManager = await PorcupineManager.fromKeywordPaths( accessKey, ["/path/to/keyword.ppn"], detectionCallback); ``` -------------------------------- ### Run File Demo with Yarn Source: https://github.com/picovoice/porcupine/blob/master/demo/nodejs/README.md Execute the file demo using Yarn, specifying required arguments. ```console yarn file --access_key ${ACCESS_KEY} \ --input_audio_file_path ../../resources/audio_samples/multiple_keywords.wav \ --keywords grasshopper ``` -------------------------------- ### Run Microphone Demo with Multiple Keywords Source: https://github.com/picovoice/porcupine/blob/master/demo/dotnet/README.md Executes the microphone demo to detect multiple wake words, including multi-word phrases. Requires an ACCESS_KEY. ```console dotnet run -c MicDemo.Release -- \ --access_key ${ACCESS_KEY} \ --keywords picovoice "hey siri" ``` -------------------------------- ### Initialize Porcupine with Custom Keywords (NodeJS) Source: https://github.com/picovoice/porcupine/blob/master/README.md Create a Porcupine instance in NodeJS using custom keyword files. Ensure the path to the keyword file is correctly specified. ```javascript const Porcupine = require("@picovoice/porcupine-node"); // Obtained from the Picovoice Console (https://console.picovoice.ai/) const accessKey = "${ACCESS_KEY}"; let handle = new Porcupine( accessKey, ["/path/to/custom/keyword/file"], [0.5]); ``` -------------------------------- ### Initialize Porcupine with Built-in Keywords Source: https://github.com/picovoice/porcupine/blob/master/binding/react-native/README.md Use `Porcupine.fromBuiltInKeywords` to initialize the wake word engine with a specific built-in keyword. Ensure you have your AccessKey from the Picovoice Console. ```javascript const accessKey = "${ACCESS_KEY}" // AccessKey obtained from Picovoice Console (https://console.picovoice.ai/) async createPorcupine(){ try{ this._porcupine = await Porcupine.fromBuiltInKeywords(accessKey, [BuiltInKeywords.PICOVOICE]); } catch (err) { // handle error } } ``` -------------------------------- ### Initialize Porcupine with Custom Keyword Paths (Python) Source: https://github.com/picovoice/porcupine/blob/master/README.md Initialize the Porcupine engine in Python using custom keyword files. Provide the absolute or relative paths to your .ppn files via the 'keyword_paths' argument. ```python import pvporcupine # AccessKey obtained from Picovoice Console (https://console.picovoice.ai/) access_key = "${ACCESS_KEY}" handle = pvporcupine.create( access_key=access_key, keyword_paths=['path/to/non/default/keyword/file']) ``` -------------------------------- ### Build File Demo C Source: https://github.com/picovoice/porcupine/blob/master/demo/c/README.md Use CMake to build the Porcupine file demo for C. Specify the recorder platform if needed. ```console cmake -S demo/c/. -B demo/c/build -DPV_RECORDER_PLATFORM={PV_RECORDER_PLATFORM} cmake --build demo/c/build --target porcupine_demo_file ``` -------------------------------- ### Run NodeJS Microphone Demo Source: https://github.com/picovoice/porcupine/blob/master/README.md Executes the NodeJS microphone demo. Replace ${ACCESS_KEY} with your AccessKey and 'porcupine' with the desired keywords. ```bash ppn-mic-demo --access_key ${ACCESS_KEY} --keywords porcupine ``` -------------------------------- ### Run Microphone Demo with Specific Audio Device Source: https://github.com/picovoice/porcupine/blob/master/demo/python/README.md Uses a specific audio input device for the demo, identified by its index. Replace ${ACCESS_KEY} with your Picovoice AccessKey and use the correct device index. ```bash porcupine_demo_mic --access_key ${ACCESS_KEY} --keywords picovoice --audio_device_index 0 ``` -------------------------------- ### Run Microphone Demo and Save Audio Output Source: https://github.com/picovoice/porcupine/blob/master/demo/java/README.md Executes the microphone demo with a specified audio device and saves the recorded audio stream to a WAV file for later inspection. ```bash java -jar porcupine-mic-demo.jar -a ${ACCESS_KEY} -k picovoice -di 5 -o ./test.wav ``` -------------------------------- ### Run Microphone Demo with Custom Keyword Paths Source: https://github.com/picovoice/porcupine/blob/master/demo/python/README.md Detects non-default keywords using their specific file paths. Replace ${ACCESS_KEY}, ${KEYWORD_PATH_ONE}, and ${KEYWORD_PATH_TWO} with your actual values. ```bash porcupine_demo_mic --access_key ${ACCESS_KEY} --keyword_paths ${KEYWORD_PATH_ONE} ${KEYWORD_PATH_TWO} ``` -------------------------------- ### Run Microphone Demo with Specific Audio Device Source: https://github.com/picovoice/porcupine/blob/master/demo/java/README.md Launches the microphone demo using a specific audio input device, identified by its index. The index can be found using the -sd command. ```bash java -jar porcupine-mic-demo.jar -a ${ACCESS_KEY} -k picovoice -di 5 ``` -------------------------------- ### Run Microphone Demo with Multiple Keywords Source: https://github.com/picovoice/porcupine/blob/master/demo/python/README.md Detects multiple wake words concurrently by providing them as separate arguments. Replace ${ACCESS_KEY} with your Picovoice AccessKey. ```bash porcupine_demo_mic --access_key ${ACCESS_KEY} --keywords picovoice porcupine ``` -------------------------------- ### Initialize Porcupine with Default Keyword Source: https://github.com/picovoice/porcupine/blob/master/binding/python/README.md Create an instance of the Porcupine engine with a single default keyword. Requires a valid Picovoice AccessKey. ```python import pvporcupine access_key = "${ACCESS_KEY}" # AccessKey obtained from Picovoice Console (https://console.picovoice.ai/) handle = pvporcupine.create(access_key=access_key, keywords=['picovoice']) ``` -------------------------------- ### Initialize Porcupine (iOS Low-Level API) Source: https://github.com/picovoice/porcupine/blob/master/README.md Initialize the low-level Porcupine engine for custom audio processing pipelines. Requires an access key and a keyword. ```swift import Porcupine let accessKey = "${ACCESS_KEY}" // Obtained from Picovoice Console (https://console.picovoice.ai) do { Porcupine porcupine = try Porcupine( accessKey: accessKey, keyword: Porcupine.BuiltInKeyword.picovoice) } catch { } ``` -------------------------------- ### Initialize Porcupine with Custom Keyword Paths Source: https://github.com/picovoice/porcupine/blob/master/binding/flutter/README.md Load a custom wake word by providing the asset path to the `fromKeywordPaths` constructor. Ensure the keyword file is added to your `pubspec.yaml` assets. ```dart final String accessKey = "{ACCESS_KEY}"; // AccessKey obtained from Picovoice Console (https://console.picovoice.ai/) String keywordAsset = "assets/keyword.ppn"; try{ _porcupine = await Porcupine.fromKeywordPaths( accessKey, [keywordAsset]); } on PorcupineException catch (err) { // handle porcupine init error } ``` -------------------------------- ### Initialize Porcupine Engine in C Source: https://github.com/picovoice/porcupine/blob/master/README.md Constructs an instance of the Porcupine engine. Ensure the AccessKey is obtained from the Picovoice Console and the model path is correctly specified. Sensitivity can be adjusted to balance miss rate and false alarm rate. ```c // AccessKey obtained from Picovoice Console (https://console.picovoice.ai/) const char *access_key = ... // Available at lib/common/porcupine_params.pv const char *model_path = ... const char *device = "best"; const char *keyword_path = ... const float sensitivity = 0.5f; pv_porcupine_t *handle = NULL; const pv_status_t status = pv_porcupine_init( access_key, model_path, device, 1, &keyword_path, &sensitivity, &handle); if (status != PV_STATUS_SUCCESS) { // Insert error handling logic } ``` -------------------------------- ### Build Porcupine Microphone Demo Executable Source: https://github.com/picovoice/porcupine/blob/master/demo/c/CMakeLists.txt Defines the 'porcupine_demo_mic' executable using C source and pv_recorder objects. Sets private include directories. ```cmake add_executable( porcupine_demo_mic porcupine_demo_mic.c $<$) target_include_directories(porcupine_demo_mic PRIVATE pvrecorder/project/include) ``` -------------------------------- ### Initialize Porcupine with Built-in Keyword Source: https://github.com/picovoice/porcupine/blob/master/binding/dotnet/README.md Create an instance of the Porcupine engine to detect a single built-in wake word. Ensure your AccessKey is kept secret. ```csharp using Pv; const string accessKey = "${ACCESS_KEY}"; var keyword = new List { BuiltInKeyword.PICOVOICE }; Porcupine handle = Porcupine.FromBuiltInKeywords(accessKey, keyword); ```