### Install PvRecorder Node.js Demo Source: https://github.com/picovoice/pvrecorder/blob/main/demo/nodejs/README.md Install the PvRecorder Node.js demo globally using yarn or npm. ```bash yarn global add @picovoice/pvrecorder-node-demo ``` ```bash npm install -g @picovoice/pvrecorder-node-demo ``` -------------------------------- ### Install PvRecorder Node.js Binding Source: https://github.com/picovoice/pvrecorder/blob/main/binding/nodejs/README.md Install the PvRecorder Node.js binding using Yarn. ```bash yarn add @picovoice/pvrecorder-node ``` -------------------------------- ### Install PvRecorder Demo Source: https://github.com/picovoice/pvrecorder/blob/main/demo/python/README.md Install the PvRecorder demo package using pip. ```console pip3 install pvrecorderdemo ``` -------------------------------- ### Initialize and Start Recording in Python Source: https://github.com/picovoice/pvrecorder/blob/main/README.md Initialize PvRecorder with a specified frame length and start the recording process. ```python from pvrecorder import PvRecorder recorder = PvRecorder(frame_length=512) recorder.start() ``` -------------------------------- ### Initialize and Start Recording in Node.js Source: https://github.com/picovoice/pvrecorder/blob/main/README.md Instantiate PvRecorder with a frame length and initiate the recording process. ```javascript const frameLength = 512; const recorder = new PvRecorder(frameLength); recorder.start() ``` -------------------------------- ### Install PvRecorder NuGet Package Source: https://github.com/picovoice/pvrecorder/blob/main/binding/dotnet/README.md Install the latest PvRecorder package using the .NET CLI. ```console dotnet add package PvRecorder ``` -------------------------------- ### Install Node.js PvRecorder Demo Source: https://github.com/picovoice/pvrecorder/blob/main/README.md Install the Node.js demo package globally using yarn. This makes the demo command available in your terminal. ```bash yarn global add @picovoice/pvrecorder-node-demo ``` -------------------------------- ### Initialize and Start Recording Source: https://github.com/picovoice/pvrecorder/blob/main/binding/dotnet/README.md Create an instance of PvRecorder with a specified frame length and begin capturing audio. ```csharp using Pv; PvRecorder recorder = PvRecorder.Create(frameLength: 512); recorder.Start(); ``` -------------------------------- ### Run PvRecorder Demo Source: https://github.com/picovoice/pvrecorder/blob/main/demo/python/README.md Execute the PvRecorder demo to start recording audio. Specify the audio device index and the output WAV file path. If the output path is empty, audio data will not be saved. ```console pv_recorder_demo --audio_device_index {AUDIO_DEVICE_INDEX} --output_wav_path {OUTPUT_WAV_PATH} ``` -------------------------------- ### Start PvRecorder Audio Recording Source: https://github.com/picovoice/pvrecorder/blob/main/project/README.md Starts the audio recording process using an initialized PvRecorder object. Checks for errors during startup. ```c pv_recorder_status_t status = pv_recorder_start(recorder); if (status != PV_RECORDER_STATUS_SUCCESS) { // handle PvRecorder start error } ``` -------------------------------- ### Initialize PvRecorder with Default Device Source: https://github.com/picovoice/pvrecorder/blob/main/binding/nodejs/README.md Initialize PvRecorder with a specified frame length and start recording using the default audio input device. ```javascript const { PvRecorder } = require("@picovoice/pvrecorder-node"); const recorder = new PvRecorder(/*frameLength*/ 512); recorder.start() ``` -------------------------------- ### Initialize PvRecorder with Specific Device Source: https://github.com/picovoice/pvrecorder/blob/main/binding/python/README.md Get a list of available audio devices and initialize PvRecorder using a specific device index. Ensure PvRecorder is imported. ```python from pvrecorder import PvRecorder devices = PvRecorder.get_available_devices() recorder = PvRecorder(frame_length=512, device_index=0) ``` -------------------------------- ### Initialize PvRecorder with Specific Device Source: https://github.com/picovoice/pvrecorder/blob/main/binding/nodejs/README.md Get a list of available audio input devices and initialize PvRecorder with a specific device index and frame length. ```javascript const { PvRecorder } = require("@picovoice/pvrecorder-node"); const devices = PvRecorder.getAvailableDevices() const recorder = new PvRecorder(512, /*device index*/0); recorder.start() ``` -------------------------------- ### Start Recording and Read Frames Source: https://github.com/picovoice/pvrecorder/blob/main/binding/python/README.md Start the audio recording process and continuously read audio frames. The loop continues as long as the recorder is active. Process each frame as needed. ```python recorder.start() while recorder.is_recording: frame = recorder.read() # process audio frame ``` -------------------------------- ### Record Audio to WAV File Source: https://github.com/picovoice/pvrecorder/blob/main/demo/nodejs/README.md Use this command to start recording audio. Specify the audio device index and the output WAV file path. If the output path is empty, audio will not be saved. ```bash pvrecorder-node-demo --audio_device_index {AUDIO_DEVICE_INDEX} --output_wav_path {OUTPUT_WAV_PATH} ``` -------------------------------- ### List Available Audio Recording Devices Source: https://github.com/picovoice/pvrecorder/blob/main/demo/c/README.md Use the --show_audio_devices flag to get a list of all available audio input devices recognized by the system. ```bash ./pv_recorder_demo --show_audio_devices ``` -------------------------------- ### Get Available Audio Devices Source: https://github.com/picovoice/pvrecorder/blob/main/binding/dotnet/README.md Retrieve a list of all available audio input devices on the system. ```csharp string[] devices = PvRecorder.GetAudioDevices(); ``` -------------------------------- ### Get Available Audio Devices Source: https://github.com/picovoice/pvrecorder/blob/main/project/README.md Retrieves a list of available audio input devices and their indices. It's crucial to free the returned list using `pv_recorder_free_available_devices` after use. ```c char **device_list = NULL; int32_t device_list_length = 0; pv_recorder_status_t status = pv_recorder_get_available_devices(&device_list_length, &device_list); if (status != PV_RECORDER_STATUS_SUCCESS) { // handle PvRecorder get audio devices error } fprintf(stdout, "Printing devices...\n"); for (int32_t i = 0; i < device_list_length; i++) { fprintf(stdout, "index: %d, name: %s\n", i, device_list[i]); } pv_recorder_free_available_devices(device_list_length, device_list); ``` -------------------------------- ### Configure and Build C PvRecorder Demo Source: https://github.com/picovoice/pvrecorder/blob/main/README.md Build the C demo application for PvRecorder. This involves configuring with CMake, specifying the platform, and then building. ```bash cd demo/c cmake -S . -B build -DPV_RECORDER_PLATFORM={PV_RECORDER_PLATFORM} cmake --build build ``` -------------------------------- ### Run .NET PvRecorder Demo Source: https://github.com/picovoice/pvrecorder/blob/main/README.md Run the .NET PvRecorder demo to record audio and save it to a WAV file. Replace ${OUTPUT_WAV_PATH} with the desired file path. ```bash dotnet run -- --output_wav_path ${OUTPUT_WAV_PATH} ``` -------------------------------- ### Run Node.js PvRecorder Demo Source: https://github.com/picovoice/pvrecorder/blob/main/README.md Execute the Node.js PvRecorder demo to record audio and save it to a WAV file. Replace ${OUTPUT_WAV_PATH} with the desired file path. ```bash pvrecorder-node-demo --output_wav_path ${OUTPUT_WAV_PATH} ``` -------------------------------- ### Build PvRecorder Demo with .NET CLI Source: https://github.com/picovoice/pvrecorder/blob/main/demo/dotnet/README.md Builds the PvRecorder demo application using the .NET command-line interface. Ensure you are in the demo directory. ```console dotnet build ``` -------------------------------- ### Run Python PvRecorder Demo Source: https://github.com/picovoice/pvrecorder/blob/main/README.md Execute the Python PvRecorder demo to record audio and save it to a WAV file. Replace {OUTPUT_WAV_PATH} with the desired file path. ```bash pv_recorder_demo --output_wav_path {OUTPUT_WAV_PATH} ``` -------------------------------- ### Show Demo Usage Options Source: https://github.com/picovoice/pvrecorder/blob/main/demo/c/README.md Execute the demo application without any arguments to view its available command-line options and usage instructions. ```bash ./pv_recorder_demo ``` -------------------------------- ### Compile PvRecorder Demo App Source: https://github.com/picovoice/pvrecorder/blob/main/demo/c/README.md Run these commands to build the demo application. Ensure you update the '--init --recursive' for git submodules. The PV_RECORDER_PLATFORM variable can be set for specific platform compilation flags. ```bash git submodule update --init --recursive cmake -S . -B build -DPV_RECORDER_PLATFORM={PV_RECORDER_PLATFORM} cmake --build build ``` -------------------------------- ### Show Available Audio Devices Source: https://github.com/picovoice/pvrecorder/blob/main/demo/nodejs/README.md Run this command to list all available audio input devices on your system. ```bash pvrecorder-node-demo --show_audio_devices ``` -------------------------------- ### Navigate to PvRecorderDemo Directory Source: https://github.com/picovoice/pvrecorder/blob/main/demo/dotnet/README.md Changes the current directory to the PvRecorderDemo project folder before building. ```console cd demo/dotnet/PvRecorderDemo dotnet build ``` -------------------------------- ### Initialize PvRecorder Source: https://github.com/picovoice/pvrecorder/blob/main/binding/python/README.md Initialize PvRecorder with a specified frame length. Ensure PvRecorder is imported before use. ```python from pvrecorder import PvRecorder recorder = PvRecorder(frame_length=512) ``` -------------------------------- ### Show Available Audio Devices Source: https://github.com/picovoice/pvrecorder/blob/main/demo/dotnet/README.md Runs the PvRecorder demo to display a list of all available audio input devices on the system. Use this to identify the index of the desired recording device. ```console dotnet run -- --show_audio_devices ``` -------------------------------- ### Show Available Audio Devices Source: https://github.com/picovoice/pvrecorder/blob/main/demo/python/README.md Run this command to list all available audio input devices on your system. ```console pv_recorder_demo --show_audio_devices ``` -------------------------------- ### CMakeLists.txt for pv_recorder_demo Source: https://github.com/picovoice/pvrecorder/blob/main/demo/c/CMakeLists.txt This CMake script configures the build for the pv_recorder_demo. It checks for the PV_RECORDER_PLATFORM variable and sets the library directory accordingly. It then includes project headers, links the library, and defines a post-build command to copy libraries. ```cmake cmake_minimum_required(VERSION 3.10) project(pv_recorder_demo VERSION 1.2.0 DESCRIPTION "Picovoice audio recorder library demo.") if(NOT PV_RECORDER_PLATFORM) message(FATAL_ERROR "No `PV_RECORDER_PLATFORM` value was given. Valid platforms are: " "linux, mac-arm64, mac-x86_64, windows-amd64, windows-arm64, " "raspberry-pi, raspberry-pi3-32, raspberry-pi3-64, " "raspberry-pi4-32, raspberry-pi4-64, raspberry-pi5-32, raspberry-pi5-64") endif() if (${PV_RECORDER_PLATFORM} STREQUAL "mac-arm64") set(PV_RECORDER_LIB_DIR ${CMAKE_SOURCE_DIR}/../../lib/mac/arm64) elseif (${PV_RECORDER_PLATFORM} STREQUAL "mac-x86_64") set(PV_RECORDER_LIB_DIR ${CMAKE_SOURCE_DIR}/../../lib/mac/x86_64) elseif (${PV_RECORDER_PLATFORM} STREQUAL "linux") set(PV_RECORDER_LIB_DIR ${CMAKE_SOURCE_DIR}/../../lib/linux/x86_64) elseif (${PV_RECORDER_PLATFORM} STREQUAL "raspberry-pi") set(PV_RECORDER_LIB_DIR ${CMAKE_SOURCE_DIR}/../../lib/raspberry-pi/arm11) elseif (${PV_RECORDER_PLATFORM} STREQUAL "raspberry-pi3") set(PV_RECORDER_LIB_DIR ${CMAKE_SOURCE_DIR}/../../lib/raspberry-pi/cortex-a53) elseif (${PV_RECORDER_PLATFORM} STREQUAL "raspberry-pi3-64") set(PV_RECORDER_LIB_DIR ${CMAKE_SOURCE_DIR}/../../lib/raspberry-pi/cortex-a53-aarch64) elseif (${PV_RECORDER_PLATFORM} STREQUAL "raspberry-pi4") set(PV_RECORDER_LIB_DIR ${CMAKE_SOURCE_DIR}/../../lib/raspberry-pi/cortex-a72) elseif (${PV_RECORDER_PLATFORM} STREQUAL "raspberry-pi4-64") set(PV_RECORDER_LIB_DIR ${CMAKE_SOURCE_DIR}/../../lib/raspberry-pi/cortex-a72-aarch64) elseif (${PV_RECORDER_PLATFORM} STREQUAL "raspberry-pi5") set(PV_RECORDER_LIB_DIR ${CMAKE_SOURCE_DIR}/../../lib/raspberry-pi/cortex-a76) elseif (${PV_RECORDER_PLATFORM} STREQUAL "raspberry-pi5-64") set(PV_RECORDER_LIB_DIR ${CMAKE_SOURCE_DIR}/../../lib/raspberry-pi/cortex-a76-aarch64) elseif (${PV_RECORDER_PLATFORM} STREQUAL "windows-amd64") set(PV_RECORDER_LIB_DIR ${CMAKE_SOURCE_DIR}/../../lib/windows/amd64) elseif (${PV_RECORDER_PLATFORM} STREQUAL "windows-arm64") set(PV_RECORDER_LIB_DIR ${CMAKE_SOURCE_DIR}/../../lib/windows/arm64) else () message(FATAL_ERROR "Unknown platform `${PV_RECORDER_PLATFORM}`.") endif () include_directories(../../project/include) link_directories(${PV_RECORDER_LIB_DIR}) add_executable(pv_recorder_demo pv_recorder_demo.c) target_link_libraries(pv_recorder_demo pv_recorder) add_custom_command(TARGET pv_recorder_demo POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_directory ${PV_RECORDER_LIB_DIR} ${CMAKE_BINARY_DIR} ) ``` -------------------------------- ### Record Audio to WAV with Specific Device Source: https://github.com/picovoice/pvrecorder/blob/main/demo/dotnet/README.md Runs the PvRecorder demo to record audio to a WAV file using a specific audio device. Use the --show_audio_devices command to find the correct index for ${DEVICE_INDEX}. ```console dotnet run -- --output_wav_path ${OUTPUT_WAV_FILE} --audio_device_index ${DEVICE_INDEX} ``` -------------------------------- ### Compile PvRecorder Source: https://github.com/picovoice/pvrecorder/blob/main/project/README.md Commands to compile and build the PvRecorder library. Ensure Git submodules are updated and specify output directory and platform. ```console git submodule update --init --recursive cmake -S . -B build -DOUTPUT_DIR={OUTPUT_DIR} -DPV_RECORDER_PLATFORM={PV_RECORDER_PLATFORM} cmake --build build ``` -------------------------------- ### Initialize PvRecorder Object Source: https://github.com/picovoice/pvrecorder/blob/main/project/README.md Initializes a PvRecorder object with specified frame length, device index, and buffer count. Handles potential initialization errors. ```c #include "pv_recorder.h" const int32_t frame_length = 512; const int32_t device_index = -1; // -1 == default device const int32_t buffered_frame_count = 10; pv_recorder_t *recorder = NULL; pv_recorder_status_t status = pv_recorder_init( frame_length, device_index, buffered_frame_count, &recorder); if (status != PV_RECORDER_STATUS_SUCCESS) { // handle PvRecorder init error } ``` -------------------------------- ### Record Audio to WAV File Source: https://github.com/picovoice/pvrecorder/blob/main/demo/dotnet/README.md Executes the PvRecorder demo to record audio and save it to a specified WAV file. Replace ${OUTPUT_WAV_FILE} with the desired output path. ```console dotnet run -- --output_wav_path ${OUTPUT_WAV_FILE} ``` -------------------------------- ### Clone PvRecorder Repository (HTTPS) Source: https://github.com/picovoice/pvrecorder/blob/main/README.md Use this command to clone the PvRecorder repository using HTTPS. This is a common method for cloning public repositories. ```bash git clone --recurse-submodules https://github.com/Picovoice/pvrecorder.git ``` -------------------------------- ### Select Specific Audio Device for Recording Source: https://github.com/picovoice/pvrecorder/blob/main/binding/dotnet/README.md Create a PvRecorder instance configured to use a specific audio device, identified by its index in the list of available devices. ```csharp PvRecorder recorder = PvRecorder.Create( frameLength: 512, deviceIndex: 2); ``` -------------------------------- ### Configure Node.js Native Addon Build Source: https://github.com/picovoice/pvrecorder/blob/main/project/node/CMakeLists.txt Sets up the project, handles platform-specific Node.js header downloads, and defines the shared library target for the N-API module. ```cmake cmake_minimum_required(VERSION 3.10) project(pv_recorder_napi) include(ExternalProject) if (${PV_RECORDER_PLATFORM} STREQUAL "windows-amd64" OR ${PV_RECORDER_PLATFORM} STREQUAL "windows-arm64") if (NOT PV_WINDOWS_NODE_ARCH) message(FATAL_ERROR "`PV_WINDOWS_NODE_ARCH` is a required value") endif () endif () set(NODE_VERSION 18.16.1) if (PV_WINDOWS_NODE_ARCH STREQUAL "win-arm64") set(NODE_VERSION 22.11.0) endif () ExternalProject_Add( node_headers DOWNLOAD_EXTRACT_TIMESTAMP ON URL https://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}-headers.tar.xz CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND "" ) ExternalProject_Get_Property(node_headers SOURCE_DIR) set(NODE_INCLUDE_DIR ${SOURCE_DIR}/include/node/) if (${PV_RECORDER_PLATFORM} STREQUAL "windows-amd64" OR ${PV_RECORDER_PLATFORM} STREQUAL "windows-arm64") set(NODE_WIN_LIB_DIR ${CMAKE_CURRENT_BINARY_DIR}/node_win_lib) set(dlltool_param "-y") if (CMAKE_C_COMPILER_ID STREQUAL "Clang") set(dlltool_param "-l") endif () ExternalProject_Add( node_win_lib URL https://nodejs.org/dist/v${NODE_VERSION}/${PV_WINDOWS_NODE_ARCH}/node.exe DOWNLOAD_NO_EXTRACT on DOWNLOAD_DIR ${NODE_WIN_LIB_DIR} CONFIGURE_COMMAND "" BUILD_COMMAND gendef.exe ${NODE_WIN_LIB_DIR}/node.exe COMMAND dlltool.exe -d node.def ${dlltool_param} ${NODE_WIN_LIB_DIR}/node.a INSTALL_COMMAND "" ) set(NODE_LIB ${NODE_WIN_LIB_DIR}/node.a) endif() add_library(pv_recorder_napi SHARED pv_recorder_napi.c $) set_target_properties(pv_recorder_napi PROPERTIES PREFIX "" OUTPUT_NAME "pv_recorder" SUFFIX ".node" ) add_dependencies(pv_recorder_napi node_headers) if (${PV_RECORDER_PLATFORM} STREQUAL "windows-amd64" OR ${PV_RECORDER_PLATFORM} STREQUAL "windows-arm64") add_dependencies(pv_recorder_napi node_win_lib) target_sources(pv_recorder_napi PRIVATE delayhook.c) if (CMAKE_C_COMPILER_ID STREQUAL "Clang") target_link_options(pv_recorder_napi PRIVATE "-Wl,--delayload=node.exe") endif() endif() target_include_directories(pv_recorder_napi PUBLIC ${PROJECT_SOURCE_DIR}/../include) target_include_directories(pv_recorder_napi PRIVATE ${NODE_INCLUDE_DIR}) target_link_libraries(pv_recorder_napi ${NODE_LIB}) if (${PV_RECORDER_PLATFORM} STREQUAL "mac-x86_64" OR ${PV_RECORDER_PLATFORM} STREQUAL "mac-arm64") target_link_options(pv_recorder_napi PRIVATE "-undefined" "dynamic_lookup") endif() if(DEFINED OUTPUT_DIR) add_custom_command(TARGET pv_recorder_napi POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $ "${CMAKE_SOURCE_DIR}/../lib/node/${OUTPUT_DIR}/$" COMMENT "Copying node lib to output directory.") endif() ``` -------------------------------- ### Configure Post-Build Binary Copying Source: https://github.com/picovoice/pvrecorder/blob/main/project/CMakeLists.txt Copies the built target to a specified output directory if the OUTPUT_DIR variable is defined. ```cmake if(DEFINED OUTPUT_DIR) add_custom_command(TARGET pv_recorder POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $ "${CMAKE_SOURCE_DIR}/../lib/${OUTPUT_DIR}/$" COMMENT "Copying to output directory.") endif() ``` -------------------------------- ### Manage PvRecorder with Using Statement Source: https://github.com/picovoice/pvrecorder/blob/main/binding/dotnet/README.md Ensure PvRecorder resources are freed immediately after use by wrapping its instantiation in a 'using' statement. ```csharp using (PvRecorder recorder = PvRecorder.Create(frameLength: 512)) { // PvRecorder usage } ``` -------------------------------- ### Record Audio to WAV File Source: https://github.com/picovoice/pvrecorder/blob/main/demo/c/README.md Record audio to a WAV file using a specific audio device index. If no device index is provided, the system's default recording device will be used. Press Ctrl+C to stop recording. ```bash ./pv_recorder_demo -o test.wav -d 2 ``` -------------------------------- ### Clone PvRecorder Repository (SSH) Source: https://github.com/picovoice/pvrecorder/blob/main/README.md Use this command to clone the PvRecorder repository using SSH. Ensure you have SSH keys configured with your GitHub account. ```bash git clone --recurse-submodules git@github.com:Picovoice/pvrecorder.git ``` -------------------------------- ### Include Node.js Subdirectory Source: https://github.com/picovoice/pvrecorder/blob/main/project/CMakeLists.txt Adds the node subdirectory to the build process if PV_BUILD_NODE is enabled. ```cmake if (PV_BUILD_NODE) add_subdirectory(node) endif() ``` -------------------------------- ### Dispose PvRecorder Resources Source: https://github.com/picovoice/pvrecorder/blob/main/binding/dotnet/README.md Free resources acquired by PvRecorder. This can be called explicitly or managed using a 'using' statement. ```csharp recorder.Dispose(); ``` -------------------------------- ### Release PvRecorder Resources Source: https://github.com/picovoice/pvrecorder/blob/main/binding/nodejs/README.md Free the resources acquired by PvRecorder. This can be called without first calling `stop()`. ```javascript recorder.release(); ``` -------------------------------- ### Read Audio Frames from PvRecorder Source: https://github.com/picovoice/pvrecorder/blob/main/project/README.md Reads audio data frames from the PvRecorder. Ensure the frame buffer length matches the one provided during initialization. Handles read errors. ```c // must have length equal to `frame_length` that was given to `pv_recorder_init()` int16_t *frame = malloc(frame_length * sizeof(int16_t)); while (true) { pv_recorder_status_t status = pv_recorder_read(recorder, frame); if (status != PV_RECORDER_STATUS_SUCCESS) { // handle PvRecorder read error } // use frame of audio data // ... } ``` -------------------------------- ### Stop PvRecorder Source: https://github.com/picovoice/pvrecorder/blob/main/binding/nodejs/README.md Stop the audio recording process by calling the `stop()` method on the PvRecorder instance. ```javascript recorder.stop(); ``` -------------------------------- ### Read Audio Frames in Node.js Source: https://github.com/picovoice/pvrecorder/blob/main/README.md Asynchronously read audio frames while recording is active. Handle the audio data appropriately. ```javascript while (recorder.isRecording) { const frame = await recorder.read(); // process audio frame } ``` -------------------------------- ### Read Audio Frames in Python Source: https://github.com/picovoice/pvrecorder/blob/main/README.md Continuously read audio frames from the recorder while it is active. Process each frame as needed. ```python while recorder.is_recording: frame = recorder.read() # process audio frame ``` -------------------------------- ### Enable and Define Test Targets Source: https://github.com/picovoice/pvrecorder/blob/main/project/CMakeLists.txt Conditionally enables testing and defines executables for circular buffer and recorder tests when PV_BUILD_TESTS is set. ```cmake if (PV_BUILD_TESTS) enable_testing() add_executable(test_circular_buffer test/test_pv_circular_buffer.c src/pv_circular_buffer.c) target_include_directories(test_circular_buffer PUBLIC include) add_test( NAME test_circular_buffer COMMAND test_circular_buffer ) add_executable(test_recorder test/test_pv_recorder.c) target_link_libraries(test_recorder pv_recorder) add_test( NAME test_recorder COMMAND test_recorder ) endif() ``` -------------------------------- ### Delete PvRecorder Instance Source: https://github.com/picovoice/pvrecorder/blob/main/binding/python/README.md Free resources acquired by the PvRecorder instance. This method can be called at any time, even before stop(). ```python recorder.delete() ``` -------------------------------- ### Stop Recording Source: https://github.com/picovoice/pvrecorder/blob/main/binding/python/README.md Call the stop() method on the PvRecorder instance to halt the audio recording. This should be called when audio capture is no longer needed. ```python recorder.stop() ``` -------------------------------- ### Read Audio Frames Source: https://github.com/picovoice/pvrecorder/blob/main/binding/dotnet/README.md Continuously read audio frames from the recorder while it is active. Process each frame as needed. ```csharp while (recorder.IsRecording) { short[] frame = recorder.Read(); // process audio frame } ``` -------------------------------- ### Release PvRecorder Resources Source: https://github.com/picovoice/pvrecorder/blob/main/project/README.md Frees the memory allocated for the PvRecorder object and the audio frame buffer. This should be called after stopping the recorder. ```c pv_recorder_delete(recorder); free(frame); ``` -------------------------------- ### Read Audio Frames Source: https://github.com/picovoice/pvrecorder/blob/main/binding/nodejs/README.md Continuously read audio frames from the recorder while it is active. Use `readSync()` for synchronous calls. ```javascript while (recorder.isRecording) { // const frame = recorder.readSync(), for synchronous calls const frame = await recorder.read(); // process audio frame } ``` -------------------------------- ### Stop Recording Source: https://github.com/picovoice/pvrecorder/blob/main/binding/dotnet/README.md Stop the audio capture process when recording is no longer needed. ```csharp recorder.Stop(); ``` -------------------------------- ### Stop PvRecorder Audio Recording Source: https://github.com/picovoice/pvrecorder/blob/main/project/README.md Stops the ongoing audio recording process. Verifies that the stop operation was successful. ```c pv_recorder_status_t status = pv_recorder_stop(recorder); if (status != PV_RECORDER_STATUS_SUCCESS) { // handle PvRecorder stop error } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.