SnowboyFramework
Snowboy hotword detection engine packaged as an iOS framework
Install / Use
/learn @sveinbjornt/SnowboyFrameworkREADME
Snowboy iOS Framework
This repository contains the Snowboy hotword detection engine precompiled and packaged as an iOS framework.
The framework includes a Mach-O universal binary with 5 architectures: i386, x86_64, arm_v7, arm_v7s and arm64.
Setup
- Add Snowboy.framework to your target under General in Xcode.
- Also add Accelerate.framework, which is required by Snowboy
- Add common.res and a Snowboy model (either .pmdl or .umdl) to your application bundle
Usage
Create Snowboy detector C++ object instance
Please note: Any Objective-C source files using Snowboy must have the suffix .mm
to make sure they are compiled as Objective-C++.
#import <Snowboy/Snowboy.h>
...
NSString *commonPath = [[NSBundle mainBundle] pathForResource:@"common" ofType:@"res"];
NSString *modelPath = [[NSBundle mainBundle] pathForResource:@"modelname" ofType:@"pmdl"];
_snowboyDetect = new snowboy::SnowboyDetect(std::string([commonPath UTF8String]),
std::string([modelPath UTF8String]));
_snowboyDetect->SetSensitivity(0.5);
_snowboyDetect->SetAudioGain(1.0);
_snowboyDetect->ApplyFrontend(FALSE);
Detect hotword in audio data
// Set up audio recording, one way or another, get audio data as NSData object.
...
// Run detector on 16-bit audio samples
const int16_t *bytes = (int16_t *)[data bytes];
const int len = (int)[data length]/2;
int result = _snowboyDetect->RunDetection((const int16_t *)bytes, len);
if (result > 0) {
NSLog(@"Snowboy: Hotword detected");
// Do something
}
License
Snowboy is Copyright (C) 2016-2020 KITT.AI
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Related Skills
node-connect
354.3kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
112.3kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
354.3kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
354.3kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
