koala/README.md at main · Picovoice/koala · GitHub | 您所在的位置:网站首页 › pvkoala › koala/README.md at main · Picovoice/koala · GitHub |
Koala
Made in Vancouver, Canada by Picovoice
Koala is an on-device noise suppression engine. Koala is: Private; All voice processing runs locally. Cross-Platform: Linux (x86_64), macOS (x86_64, arm64), Windows (x86_64) Android and iOS Chrome, Safari, Firefox, and Edge Raspberry Pi (4, 3) and NVIDIA Jetson Nano Table of Contents Koala Table of Contents AccessKey Demos Python Android iOS C Web SDKs Python Android iOS C Web Releases AccessKeyAccessKey is your authentication and authorization token for deploying Picovoice SDKs, including Koala. Anyone who is using Picovoice needs to have a valid AccessKey. You must keep your AccessKey secret. You would need internet connectivity to validate your AccessKey with Picovoice license servers even though the noise suppression is running 100% offline. AccessKey also verifies that your usage is within the limits of your account. Everyone who signs up for Picovoice Console receives the Free Tier usage rights described here. If you wish to increase your limits, you can purchase a subscription plan. Demos Python DemosInstall the demo package: pip3 install pvkoalademo koala_demo_mic --access_key ${ACCESS_KEY} --output_path ${WAV_OUTPUT_PATH} koala_demo_file \ --access_key ${ACCESS_KEY} \ --input_path ${WAV_INPUT_PATH} \ --output_path ${WAV_OUTPUT_PATH}Replace ${ACCESS_KEY} with yours obtained from Picovoice Console. Android DemoUsing Android Studio, open demo/android/Activity as an Android project and then run the application. Replace "${YOUR_ACCESS_KEY_HERE}" in the file MainActivity.java with your AccessKey. iOS DemoCopy your AccessKey into the ACCESS_KEY variable inside ViewModel.swift. Before building the demo app, run the following from KoalaDemo directory to install the Koala-iOS CocoaPod: pod installOpen KoalaDemo.xcworkspace and run the demo. C DemosBuild the demo: cmake -S demo/c/ -B demo/c/build && cmake --build demo/c/build --target koala_demo_micTo list the available audio input devices: ./demo/c/build/koala_demo_mic -sTo run the demo: ./demo/c/build/koala_demo_mic -l ${LIBRARY_PATH} -m ${MODLE_PATH} -a ${ACCESS_KEY} -o ${WAV_OUTPUT_PATH}Replace ${LIBRARY_PATH} with path to appropriate library available under lib, ${MODEL_PATH} with path to the model file available under lib/common, ${ACCESS_KEY} with AccessKey obtained from Picovoice Console, and ${WAV_OUTPUT_PATH} with a path to a .wav file where the enhanced audio will be stored. Terminate the demo with Ctrl+C. For more information about C demos go to demo/c. Web DemoFrom demo/web run the following in the terminal: yarn yarn start(or) npm install npm run startOpen http://localhost:5000 in your browser to try the demo. SDKs PythonInstall the Python SDK: pip3 install pvkoalaCreate an instance of the engine and enhance audio in real-time: import pvkoala koala = pvkoala.create(access_key='${ACCESS_KEY}')Replace ${ACCESS_KEY} with yours obtained from Picovoice Console. def get_next_audio_frame(): pass while True: enhanced_audio = koala.process(get_next_audio_frame())Finally, when done be sure to explicitly release the resources using koala.delete(). AndroidTo include the package in your Android project, ensure you have included mavenCentral() in your top-level build.gradle file and then add the following to your app's build.gradle: dependencies { implementation 'ai.picovoice:koala-android:${LATEST_VERSION}' }Create an instance of the engine and enhance audio in real-time: import ai.picovoice.koala.*; final String accessKey = "${ACCESS_KEY}"; // AccessKey obtained from Picovoice Console (https://console.picovoice.ai/) short[] getNextAudioFrame() { // .. get audioFrame return audioFrame; } try { Koala koala = new Koala.Builder() .setAccessKey(accessKey) .build(appContext); while true { short[] enhancedFrame = koala.process(getNextAudioFrame()); }; } catch (KoalaException ex) { }Replace ${ACCESS_KEY} with yours obtained from Picovoice Console. iOSCreate an instance of the engine and enhance audio: import Koala do { let koala = try Koala(accessKey: "${ACCESS_KEY}") } catch {} func getNextAudioFrame() -> [Int16] { // .. get a frame of audio return audioFrame; } while true { do { let enhancedAudio = try koala.process(getNextAudioFrame()) // .. use enhanced audio } catch {} }Replace ${ACCESS_KEY} with yours obtained from Picovoice Console. In case the next audio frame does not directly follow the previous one, call koala.reset(). When done be sure to explicitly release the resources using koala.delete(). Cinclude/pv_koala.h header file contains relevant information. Build an instance of the object: pv_koala_t *handle = NULL; const char *model_path = "${MODEL_PATH}"; pv_status_t status = pv_koala_init(${ACCESS_KEY}, model_path, &handle); if (status != PV_STATUS_SUCCESS) { // error handling logic }Replace ${ACCESS_KEY} with the AccessKey obtained from Picovoice Console, and ${MODEL_PATH} with the path to the model file available under lib/common. Now the handle can be used to enhance audio in real-time: extern const int16_t *get_next_audio_frame(void); const int32_t frame_length = pv_koala_frame_length(); int16_t *enhanced_pcm = (int16_t *) malloc(frame_length * sizeof(int16_t)); while (true) { const int16_t *pcm = get_next_audio_frame(); const pv_status_t status = pv_koala_process(handle, pcm, enhanced_pcm); if (status != PV_STATUS_SUCCESS) { // error handling logic } }Finally, when done be sure to release the acquired resources: pv_koala_delete(handle); WebInstall the web SDK using yarn: yarn add @picovoice/koala-webor using npm: npm install --save @picovoice/koala-webCreate an instance of the engine using KoalaWorker and enhance audio in real-time: import { Koala } from "@picovoice/koala-web"; import koalaParams from "${PATH_TO_BASE64_KOALA_PARAMS}"; function processCallback(enhancedPcm) { // do something with enhancedPcm } function getAudioData(): Int16Array { ... // function to get audio data return new Int16Array(); } const koala = await KoalaWorker.create( "${ACCESS_KEY}", processCallback, { base64: koalaParams }, ); await koala.reset(); for (;;) { await koala.process(getAudioData()); }Replace ${ACCESS_KEY} with yours obtained from Picovoice Console. Finally, when done release the resources using koala.release(). Releases v1.0.0 February 7th, 2023 Initial release. |
CopyRight 2018-2019 实验室设备网 版权所有 |