Gehusileng 5 months ago
parent a3b08d98c6
commit 9be37a1750

@ -112,21 +112,22 @@ def visualize_results(img_path: str, detections: List[Dict[str, Any]]) -> None:
# 准备播报文本 # 准备播报文本
# 地面避障 # 地面避障
announcement_text1 = "前方有障碍,请注意。" # 基础播报文本 # 地面避障和高空避障的播报文本
announcement_text2 = "左侧有障碍,请注意。" announcement_texts = {
announcement_text3 = "右侧有障碍,请注意。" 'front': "前方有障碍,请注意。",
'left': "左侧有障碍,请注意。",
'right': "右侧有障碍,请注意。",
'above': "上方有障碍,请注意。"
}
# 高空避障
announcement_text4 = "上方有障碍,请注意。"
# 绘制边界框和标签
for detection in detections: for detection in detections:
label = detection['label'] label = detection['label'] # 获取障碍物的标签
bbox = detection['bbox']
announcer.announce(f"{announcement_text1}") # 根据障碍物的位置获取对应的播报文本
announcement_text = announcement_texts.get(label, "未知位置的障碍,请注意。")
# 停止语音播报 # 使用announcer进行播报
announcer.stop() announcer.announce(announcement_text)
# 注意这里假设bbox的格式是(x, y, w, h),你需要根据实际情况调整 # 注意这里假设bbox的格式是(x, y, w, h),你需要根据实际情况调整
x, y, w, h = map(int, bbox) x, y, w, h = map(int, bbox)

@ -1,285 +0,0 @@
# 假设这是yolo_detector.py文件的一部分
import torch
import cv2
import logging
import numpy as np
from utils.general import non_max_suppression, scale_coords
from utils.augmentations import letterbox
from utils.torch_utils import select_device
from models.experimental import attempt_load
from PIL import Image
from typing import Tuple, Union
# 配置日志
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
class YOLO_Detector:
def __init__(self, weights, img_size, conf_thres, iou_thres, classes=None, agnostic=False):
self.weights = weights
self.img_size = img_size
self.conf_thres = conf_thres
self.iou_thres = iou_thres
self.classes = classes
self.agnostic = agnostic
self.device = select_device('')
logging.info("YOLO_Detector initialized with configuration: weights=%s, img_size=%d, conf_thres=%.2f, iou_thres=%.2f", weights, img_size, conf_thres, iou_thres)
def select_device(device_id='0'):
"""
根据设备ID选择计算设备
参数:
- device_id: 设备ID默认为'0'可以是整数表示CUDA设备的索引也可以是字符串'gpu'表示优先选择CUDA设备
返回:
- torch.device对象指向选择的计算设备可以是CUDA设备或CPU设备
"""
try:
# 尝试将设备ID转换为整数以便选择具体的CUDA设备
device_id = int(device_id)
# 如果CUDA可用返回指定索引的CUDA设备否则返回CPU设备
return torch.device(f'cuda:{device_id}' if torch.cuda.is_available() else 'cpu')
except ValueError:
# 如果设备ID不是整数尝试将其解释为字符串指令
# 如果CUDA可用且设备ID为'gpu'返回CUDA设备否则返回CPU设备
return torch.device('cuda' if torch.cuda.is_available() and device_id.lower() == 'gpu' else 'cpu')
def attempt_load(weights, map_location=torch.device('cpu')):
"""
尝试加载预训练模型
参数:
weights (str or Tensor): 模型权重的文件路径或Tensor
map_location (torch.device): 指定加载模型时的目标设备
返回:
torch.nn.Module: 加载成功的模型如果加载失败则返回None
"""
# 设置日志记录级别为ERROR只记录错误信息
# 设置日志记录
logging.basicConfig(level=logging.ERROR)
try:
# 尝试加载模型
# 使用torch.nn.Module.load_state_dict显式加载状态来提高安全性
# 首先尝试直接加载模型
model = torch.load(weights, map_location=map_location)
except FileNotFoundError as e:
# 记录文件找不到的错误信息并返回None
logging.error(f"模型文件找不到: {e}")
return None
except torch.serialization.SerializationError as e:
# 记录模型版本不兼容的错误信息并返回None
logging.error(f"模型版本不兼容: {e}")
return None
except Exception as e:
# 记录其他未知错误信息并返回None
logging.error(f"加载模型时发生未知错误: {e}")
return None
# 检查加载的模型是否是字典类型,并且包含'model'键
# 检查是否模型是一个字典,如果是,尝试从字典中加载'model'键
if isinstance(model, dict) and 'model' in model:
try:
# 如果model不是nn.Module的实例抛出异常
# 确保model是torch.nn.Module的实例
if not isinstance(model, torch.nn.Module):
raise ValueError("模型字典中的'model'键值不是torch.nn.Module的实例")
# 创建一个新的nn.Module实例并加载字典中的模型权重
# 加载模型状态
actual_model = torch.nn.Module()
actual_model.load_state_dict(model['model'])
return actual_model
except Exception as e:
# 记录从字典加载模型失败的错误信息并返回None
logging.error(f"从字典加载模型时发生错误: {e}")
return None
else:
# 如果加载的模型不是字典类型,直接返回加载的模型
return model
def letterbox(img: Image.Image, new_shape: Union[int, Tuple[int, int]] = 640, color: Tuple[int, int, int] = (114, 114, 114), auto: bool = True, scaleFill: bool = False, scaleUp: bool = True) -> Image.Image:
"""
对图像进行letterbox调整大小
参数:
- img: PIL Image对象需要调整大小的图像
- new_shape: 目标图像的宽度和高度可以是整数表示正方形目标或元组表示宽高
- color: 填充边框的颜色使用RGB格式的三元组表示
- auto: 是否根据图像纵横比自动调整大小
- scaleFill: 是否按需扩展图像以填满整个目标区域当前未使用
- scaleUp: 如果设置为False则不会对小于目标尺寸的图像进行放大当前未使用
返回:
- Image.Image: 调整大小并填充后的图像
"""
# 验证输入
if not isinstance(img, Image.Image):
raise ValueError("img 参数必须是 PIL Image 对象。")
if isinstance(new_shape, int):
new_shape = (new_shape, new_shape)
if not isinstance(new_shape, tuple) or len(new_shape) != 2 or any(not isinstance(x, int) or x <= 0 for x in new_shape):
raise ValueError("new_shape 参数必须是正整数或包含两个正整数的元组。")
if not isinstance(color, tuple) or len(color) != 3 or any(not isinstance(x, int) or x < 0 or x > 255 for x in color):
raise ValueError("color 参数必须是 RGB 颜色的三元组,每个值介于 0 和 255 之间。")
# 获取图像当前尺寸并处理边界条件
h, w = img.size
if h == 0 or w == 0:
raise ValueError("图像的宽度或高度为0。")
# 计算新尺寸
new_h, new_w = new_shape
if auto:
aspect_ratio = min(new_h / h, new_w / w)
new_w, new_h = int(w * aspect_ratio), int(h * aspect_ratio)
else:
new_w, new_h = new_shape
# 调整图像大小并在新图像中填充
resized = img.resize((new_w, new_h), Image.BILINEAR)
new_img = Image.new('RGB', (new_shape[1], new_shape[0]), color=color)
offset = ((new_shape[1] - new_w) // 2, (new_shape[0] - new_h) // 2)
new_img.paste(resized, offset)
return new_img
def non_max_suppression(pred, conf_thres=0.25, iou_thres=0.45, classes=None, agnostic=False):
"""
对预测框进行非极大值抑制Non-Maximum Suppression, NMS操作
参数:
- pred: 包含检测结果的张量形状为 (num_boxes, num_classes + 5)其中每个元素包含 [x1, y1, x2, y2, confidence, class_id]
- conf_thres: 保留的置信度阈值
- iou_thres: IOU阈值用于去除重叠的框
- classes: 如果不为None则只对指定类别的预测框进行NMS
- agnostic: 是否忽略类别信息进行NMS默认False
返回:
- filtered_boxes: 保留下来的预测框形状为 (num_filtered_boxes, num_classes + 5)
"""
if pred.numel() == 0:
return pred.new_zeros((0, pred.size(-1)))
# 获取置信度大于conf_thres的预测框
indices = torch.where(pred[..., 4] > conf_thres)[0]
# 将pred张量切片为仅包含这些框的张量
pred = pred[indices]
# 如果指定了类别,只保留这些类别的框
if classes is not None:
class_mask = pred[..., 5].unsqueeze(-1) == classes[:, None]
pred = pred[class_mask.any(dim=1)]
# 对预测框进行排序,按置信度降序
sorted_scores, sorted_indices = pred[..., 4].sort(descending=True)
# 初始化保留的框索引列表
kept_indices = []
while sorted_indices.numel() > 0:
i = sorted_indices[0]
kept_indices.append(i.item())
# 计算与当前框IOU大于iou_thres的其他框
iou = box_iou(pred[i.unsqueeze(0)], pred[sorted_indices[1:]])
mask = iou < iou_thres
# 更新排序索引
sorted_indices = sorted_indices[mask]
sorted_scores = sorted_scores[mask]
# 根据保留的索引筛选预测框
kept_boxes = pred[torch.tensor(kept_indices, dtype=torch.long)]
# 如果agnostic为True忽略类别信息
if agnostic:
kept_boxes[..., 5] = 0
return kept_boxes
def scale_coords(img_shape, coords, new_shape):
# 确保输入参数符合预期的格式和类型
if not (isinstance(img_shape, list) and isinstance(new_shape, list) and len(img_shape) == 2 and len(new_shape) == 2):
raise ValueError("img_shape and new_shape must be lists of length 2.")
if not (isinstance(coords, np.ndarray) and coords.shape[1] == 4):
raise ValueError("coords must be a numpy array with 4 columns.")
# 验证形状为正
if any(i <= 0 for i in img_shape) or any(i <= 0 for i in new_shape):
raise ValueError("img_shape and new_shape must have positive elements.")
# 计算缩放比例
ratio_w = new_shape[0] / img_shape[1]
ratio_h = new_shape[1] / img_shape[0]
ratio = min(ratio_w, ratio_h) # 保证比例不会超过任一边界
if ratio < 1:
new_w = int(img_shape[1] * ratio)
new_h = int(img_shape[0] * ratio)
# 重新计算中心点
center_x = (coords[:, 0] + coords[:, 2]) / 2
center_y = (coords[:, 1] + coords[:, 3]) / 2
center_x = center_x * new_w / img_shape[1]
center_y = center_y * new_h / img_shape[0]
# 计算新的宽和高
w = (coords[:, 2] - coords[:, 0]) * ratio
h = (coords[:, 3] - coords[:, 1]) * ratio # 完善高度的更新计算
# 更新坐标
scaled_coords = np.array([center_x - w / 2, center_y - h / 2, center_x + w / 2, center_y + h / 2]).T
return scaled_coords
else:
# 如果ratio >= 1不需要缩放直接返回原coords
return coords
def detect_image(weights, img_path, img_size=640, conf_thres=0.25, iou_thres=0.45, classes=None, agnostic=False):
device = select_device('')
try:
device = select_device('')
logging.info("Selecting device: %s", device)
model = attempt_load(weights, map_location=device)
model.eval()
logging.info("Model loaded successfully")
except Exception as e:
logging.error(f"Error loading the model: {e}")
return []
try:
img = Image.open(img_path)
img = letterbox(img, new_shape=img_size)[0]
img = np.array(img)
logging.info("Image loaded and preprocessed")
except Exception as e:
logging.error(f"Error loading the image: {e}")
return []
img = img[:, :, ::-1].transpose(2, 0, 1)
img = np.ascontiguousarray(img)
img_tensor = torch.from_numpy(img).to(device)
img_tensor = img_tensor.float()
img_tensor /= 255.0
if img_tensor.ndimension() == 3:
img_tensor = img_tensor.unsqueeze(0)
try:
pred = model(img_tensor, augment=False)[0]
logging.info("Inference completed")
except Exception as e:
logging.error(f"Error during inference: {e}")
return []
pred = non_max_suppression(pred, conf_thres, iou_thres, classes=classes, agnostic=agnostic)
if len(pred):
pred[:, :4] = scale_coords(img.shape[1:], pred[:, :4], img_size).round()
logging.info("Non-maximum suppression completed")
return pred

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

@ -1,2 +0,0 @@
主要实现每1s读取一次img目录中的图片并且识别的图片中的文字会存储到txt目录中
另外txt目录中设置了当存储的备份文件即历史识别后结构仅仅保留最后1m以来做记录器。

@ -1,99 +0,0 @@
import pytesseract
from PIL import Image
import sys
import os
import time
import datetime
def ensure_directories():
# 确保存储输出文本的目录存在
output_dir = 'txt'
if not os.path.exists(output_dir):
os.makedirs(output_dir)
def ensure_pytesseract_installed():
try:
# 尝试导入pytesseract以确认它已安装
import pytesseract
except ImportError:
print("pytesseract库未安装。请运行'pip install pytesseract'来安装它。")
sys.exit(1)
def ensure_tesseract_executable_configured():
try:
# 尝试获取Tesseract的路径以确认它已配置
pytesseract.pytesseract.tesseract_cmd
except AttributeError:
print("未配置Tesseract可执行文件的路径。请在pytesseract中设置tesseract_cmd。")
sys.exit(1)
def image_to_text(image_path):
try:
# 打开图像文件
img = Image.open(image_path)
except IOError:
print(f"无法打开图像文件:{image_path}")
return None
try:
# 使用pytesseract进行文字识别
text = pytesseract.image_to_string(img, lang='eng')
except Exception as e:
print(f"文字识别过程中发生错误:{e}")
return None
return text
def main():
# 确保pytesseract库已安装
ensure_pytesseract_installed()
# 确保配置了Tesseract可执行文件的路径
ensure_tesseract_executable_configured()
# 确保输出目录存在
ensure_directories()
# 设置输出目录路径
output_dir_path = 'txt'
# 主循环每3秒处理一张图片
while True:
# 获取当前时间,并格式化为文件名
current_time = datetime.datetime.now().strftime("%Y%m%d%H%M%S")
image_filename = f"{current_time}.jpg"
#image_path = os.path.join('img', image_filename)
image_path = 'img/22.jpg'
output_file_path = os.path.join(output_dir_path, f"{current_time}.txt")
# 检查图片是否存在
if not os.path.exists(image_path):
print(f"图片 {image_path} 不存在,等待下一张...")
time.sleep(1)
continue
# 调用image_to_text函数并将结果写入文件
text = image_to_text(image_path)
if text:
with open(output_file_path, 'w', encoding='utf-8') as file:
file.write(text)
print(f"图片 {image_filename} 的识别结果已保存到 {output_file_path}")
else:
print(f"无法识别图片 {image_filename} 中的文字。")
# 检查txt文件夹中的文件数量如果超过60个删除最早的文件
files = os.listdir(output_dir_path)
if len(files) > 60:
# 对文件进行排序,以便找到最早的文件
files.sort()
oldest_file_path = os.path.join(output_dir_path, files[0])
os.remove(oldest_file_path)
print(f"已删除最早的文件:{oldest_file_path}")
# 等待1秒
time.sleep(1)
if __name__ == "__main__":
main()

@ -1,242 +0,0 @@
2024年 07月 01日 星期一 21:13:13 CST: wenzhi.py 被停止, PID: 29387
2024年 07月 01日 星期一 21:13:13 CST: tts.py 运行失败,退出状态码 1, PID: 29405
2024年 07月 01日 星期一 21:13:18 CST: wenzhi.py 被停止, PID: 29408
2024年 07月 01日 星期一 21:13:18 CST: tts.py 运行失败,退出状态码 1, PID: 29435
2024年 07月 01日 星期一 21:13:23 CST: wenzhi.py 被停止, PID: 29456
2024年 07月 01日 星期一 21:13:23 CST: tts.py 运行失败,退出状态码 1, PID: 29474
2024年 07月 01日 星期一 21:14:26 CST: wenzhi.py 被停止, PID: 29817
2024年 07月 01日 星期一 21:14:26 CST: tts.py 运行失败,退出状态码 1, PID: 29835
2024年 07月 01日 星期一 21:14:31 CST: wenzhi.py 被停止, PID: 29838
2024年 07月 01日 星期一 21:14:31 CST: tts.py 运行失败,退出状态码 1, PID: 29865
2024年 07月 01日 星期一 21:16:08 CST: wenzhi.py 被停止, PID: 30373
2024年 07月 01日 星期一 21:16:08 CST: tts.py 运行失败,退出状态码 1, PID: 30391
2024年 07月 01日 星期一 21:16:13 CST: wenzhi.py 被停止, PID: 30412
2024年 07月 01日 星期一 21:16:13 CST: tts.py 运行失败,退出状态码 1, PID: 30466
2024年 07月 01日 星期一 21:16:18 CST: wenzhi.py 被停止, PID: 30469
2024年 07月 01日 星期一 21:16:18 CST: tts.py 运行失败,退出状态码 1, PID: 30550
2024年 07月 01日 星期一 21:16:42 CST: wenzhi.py 被停止, PID: 30664
2024年 07月 01日 星期一 21:16:42 CST: tts.py 运行失败,退出状态码 1, PID: 30691
2024年 07月 01日 星期一 21:16:47 CST: wenzhi.py 被停止, PID: 30694
2024年 07月 01日 星期一 21:16:47 CST: tts.py 运行失败,退出状态码 1, PID: 30721
2024年 07月 01日 星期一 21:16:52 CST: wenzhi.py 被停止, PID: 30733
2024年 07月 01日 星期一 21:16:52 CST: tts.py 运行失败,退出状态码 1, PID: 30769
2024年 07月 01日 星期一 21:16:57 CST: wenzhi.py 被停止, PID: 30781
2024年 07月 01日 星期一 21:16:57 CST: tts.py 运行失败,退出状态码 1, PID: 30835
2024年 07月 01日 星期一 21:17:02 CST: wenzhi.py 被停止, PID: 30838
2024年 07月 01日 星期一 21:17:02 CST: tts.py 运行失败,退出状态码 1, PID: 30895
2024年 07月 01日 星期一 21:19:05 CST: wenzhi.py 被停止, PID: 31525
2024年 07月 01日 星期一 21:19:05 CST: tts.py 运行失败,退出状态码 1, PID: 31543
2024年 07月 01日 星期一 21:19:10 CST: wenzhi.py 被停止, PID: 31546
2024年 07月 01日 星期一 21:19:10 CST: tts.py 运行失败,退出状态码 1, PID: 31573
2024年 07月 01日 星期一 21:20:16 CST: wenzhi.py 被停止, PID: 31924
2024年 07月 01日 星期一 21:20:17 CST: tts.py 运行失败,退出状态码 1, PID: 31960
2024年 07月 01日 星期一 21:20:22 CST: wenzhi.py 被停止, PID: 31981
2024年 07月 01日 星期一 21:20:22 CST: tts.py 运行失败,退出状态码 1, PID: 32008
2024年 07月 01日 星期一 21:20:27 CST: wenzhi.py 被停止, PID: 32029
2024年 07月 01日 星期一 21:20:27 CST: tts.py 运行失败,退出状态码 1, PID: 32056
2024年 07月 01日 星期一 21:20:32 CST: wenzhi.py 被停止, PID: 32059
2024年 07月 01日 星期一 21:20:32 CST: tts.py 运行失败,退出状态码 1, PID: 32086
2024年 07月 01日 星期一 21:20:37 CST: wenzhi.py 被停止, PID: 32125
2024年 07月 01日 星期一 21:20:37 CST: tts.py 运行失败,退出状态码 1, PID: 32161
2024年 07月 01日 星期一 21:20:42 CST: wenzhi.py 被停止, PID: 32191
2024年 07月 01日 星期一 21:20:42 CST: tts.py 运行失败,退出状态码 1, PID: 32264
2024年 07月 01日 星期一 21:20:47 CST: wenzhi.py 被停止, PID: 32267
2024年 07月 01日 星期一 21:20:47 CST: tts.py 运行失败,退出状态码 1, PID: 32303
2024年 07月 01日 星期一 21:20:52 CST: wenzhi.py 被停止, PID: 32306
2024年 07月 01日 星期一 21:20:52 CST: tts.py 运行失败,退出状态码 1, PID: 32351
2024年 07月 01日 星期一 21:20:57 CST: wenzhi.py 被停止, PID: 32354
2024年 07月 01日 星期一 21:20:57 CST: tts.py 运行失败,退出状态码 1, PID: 32426
2024年 07月 01日 星期一 23:05:26 CST: wenzhi.py 被停止, PID: 8301
2024年 07月 01日 星期一 23:05:26 CST: tts.py 运行失败,退出状态码 1, PID: 8318
2024年 07月 01日 星期一 23:05:28 CST: wenzhi.py 被停止, PID: 8322
2024年 07月 01日 星期一 23:05:28 CST: tts.py 运行失败,退出状态码 1, PID: 8339
2024年 07月 01日 星期一 23:05:30 CST: wenzhi.py 被停止, PID: 8352
2024年 07月 01日 星期一 23:05:30 CST: tts.py 运行失败,退出状态码 1, PID: 8369
2024年 07月 01日 星期一 23:05:32 CST: wenzhi.py 被停止, PID: 8373
2024年 07月 01日 星期一 23:05:32 CST: tts.py 运行失败,退出状态码 1, PID: 8400
2024年 07月 01日 星期一 23:05:34 CST: wenzhi.py 被停止, PID: 8422
2024年 07月 01日 星期一 23:05:34 CST: tts.py 运行失败,退出状态码 1, PID: 8448
2024年 07月 01日 星期一 23:09:24 CST: wenzhi.py 被停止, PID: 10042
2024年 07月 01日 星期一 23:09:24 CST: tts.py 运行失败,退出状态码 1, PID: 10069
2024年 07月 01日 星期一 23:09:26 CST: wenzhi.py 被停止, PID: 10073
2024年 07月 01日 星期一 23:09:27 CST: tts.py 运行失败,退出状态码 1, PID: 10090
2024年 07月 01日 星期一 23:09:29 CST: wenzhi.py 被停止, PID: 10121
2024年 07月 01日 星期一 23:09:29 CST: tts.py 运行失败,退出状态码 1, PID: 10129
2024年 07月 01日 星期一 23:09:31 CST: wenzhi.py 被停止, PID: 10178
2024年 07月 01日 星期一 23:09:31 CST: tts.py 运行失败,退出状态码 1, PID: 10195
2024年 07月 01日 星期一 23:09:33 CST: wenzhi.py 被停止, PID: 10208
2024年 07月 01日 星期一 23:09:33 CST: tts.py 运行失败,退出状态码 1, PID: 10225
2024年 07月 01日 星期一 23:09:35 CST: wenzhi.py 被停止, PID: 10229
2024年 07月 01日 星期一 23:09:35 CST: tts.py 运行失败,退出状态码 1, PID: 10237
2024年 07月 01日 星期一 23:09:37 CST: wenzhi.py 被停止, PID: 10241
2024年 07月 01日 星期一 23:09:37 CST: tts.py 运行失败,退出状态码 1, PID: 10249
2024年 07月 01日 星期一 23:09:39 CST: wenzhi.py 被停止, PID: 10289
2024年 07月 01日 星期一 23:09:39 CST: tts.py 运行失败,退出状态码 1, PID: 10306
2024年 07月 01日 星期一 23:09:41 CST: wenzhi.py 被停止, PID: 10310
2024年 07月 01日 星期一 23:09:41 CST: tts.py 运行失败,退出状态码 1, PID: 10327
2024年 07月 01日 星期一 23:09:43 CST: wenzhi.py 被停止, PID: 10340
2024年 07月 01日 星期一 23:09:43 CST: tts.py 运行失败,退出状态码 1, PID: 10357
2024年 07月 01日 星期一 23:09:45 CST: wenzhi.py 被停止, PID: 10379
2024年 07月 01日 星期一 23:09:45 CST: tts.py 运行失败,退出状态码 1, PID: 10396
2024年 07月 01日 星期一 23:13:21 CST: wenzhi.py 被停止, PID: 11686
2024年 07月 01日 星期一 23:13:21 CST: tts.py 运行成功, PID: 11694
2024年 07月 01日 星期一 23:13:23 CST: wenzhi.py 被停止, PID: 11698
2024年 07月 01日 星期一 23:13:23 CST: tts.py 运行成功, PID: 11733
2024年 07月 01日 星期一 23:14:23 CST: wenzhi.py 被停止, PID: 12133
2024年 07月 01日 星期一 23:14:23 CST: tts.py 运行成功, PID: 12141
2024年 07月 01日 星期一 23:14:25 CST: wenzhi.py 被停止, PID: 12154
2024年 07月 01日 星期一 23:14:25 CST: tts.py 运行成功, PID: 12180
2024年 07月 01日 星期一 23:16:13 CST: wenzhi.py 被停止, PID: 12910
2024年 07月 01日 星期一 23:16:13 CST: tts.py 运行成功, PID: 12918
2024年 07月 01日 星期一 23:16:15 CST: wenzhi.py 被停止, PID: 12940
2024年 07月 01日 星期一 23:16:15 CST: tts.py 运行成功, PID: 12957
2024年 07月 01日 星期一 23:16:17 CST: wenzhi.py 被停止, PID: 12961
2024年 07月 01日 星期一 23:16:17 CST: tts.py 运行成功, PID: 12978
2024年 07月 01日 星期一 23:16:19 CST: wenzhi.py 被停止, PID: 12982
2024年 07月 01日 星期一 23:16:19 CST: tts.py 运行成功, PID: 12990
2024年 07月 01日 星期一 23:16:21 CST: wenzhi.py 被停止, PID: 12994
2024年 07月 01日 星期一 23:16:21 CST: tts.py 运行成功, PID: 13002
2024年 07月 01日 星期一 23:16:23 CST: wenzhi.py 被停止, PID: 13024
2024年 07月 01日 星期一 23:16:23 CST: tts.py 运行成功, PID: 13041
2024年 07月 01日 星期一 23:16:25 CST: wenzhi.py 被停止, PID: 13054
2024年 07月 01日 星期一 23:16:25 CST: tts.py 运行成功, PID: 13062
2024年 07月 01日 星期一 23:16:27 CST: wenzhi.py 被停止, PID: 13075
2024年 07月 01日 星期一 23:16:27 CST: tts.py 运行成功, PID: 13083
2024年 07月 01日 星期一 23:17:10 CST: wenzhi.py 被停止, PID: 13388
2024年 07月 01日 星期一 23:17:10 CST: tts.py 运行成功, PID: 13396
2024年 07月 01日 星期一 23:17:12 CST: wenzhi.py 被停止, PID: 13400
2024年 07月 01日 星期一 23:17:12 CST: tts.py 运行成功, PID: 13408
2024年 07月 01日 星期一 23:17:23 CST: wenzhi.py 被停止, PID: 13502
2024年 07月 01日 星期一 23:17:23 CST: tts.py 运行成功, PID: 13510
2024年 07月 01日 星期一 23:17:25 CST: wenzhi.py 被停止, PID: 13514
2024年 07月 01日 星期一 23:17:25 CST: tts.py 运行成功, PID: 13522
2024年 07月 01日 星期一 23:17:27 CST: wenzhi.py 被停止, PID: 13526
2024年 07月 01日 星期一 23:17:27 CST: tts.py 运行成功, PID: 13534
2024年 07月 01日 星期一 23:17:59 CST: wenzhi.py 被停止, PID: 13762
2024年 07月 01日 星期一 23:17:59 CST: tts.py 运行失败,退出状态码 1, PID: 13779
2024年 07月 01日 星期一 23:18:01 CST: wenzhi.py 被停止, PID: 13783
2024年 07月 01日 星期一 23:18:01 CST: tts.py 运行失败,退出状态码 1, PID: 13791
2024年 07月 01日 星期一 23:18:03 CST: wenzhi.py 被停止, PID: 13795
2024年 07月 01日 星期一 23:18:03 CST: tts.py 运行失败,退出状态码 1, PID: 13821
2024年 07月 01日 星期一 23:18:05 CST: wenzhi.py 被停止, PID: 13825
2024年 07月 01日 星期一 23:18:05 CST: tts.py 运行失败,退出状态码 1, PID: 13833
2024年 07月 01日 星期一 23:18:07 CST: wenzhi.py 被停止, PID: 13837
2024年 07月 01日 星期一 23:18:07 CST: tts.py 运行失败,退出状态码 1, PID: 13854
2024年 07月 01日 星期一 23:18:09 CST: wenzhi.py 被停止, PID: 13867
2024年 07月 01日 星期一 23:18:09 CST: tts.py 运行失败,退出状态码 1, PID: 13875
2024年 07月 01日 星期一 23:18:11 CST: wenzhi.py 被停止, PID: 13879
2024年 07月 01日 星期一 23:18:11 CST: tts.py 运行失败,退出状态码 1, PID: 13887
2024年 07月 01日 星期一 23:18:13 CST: wenzhi.py 被停止, PID: 13891
2024年 07月 01日 星期一 23:18:13 CST: tts.py 运行失败,退出状态码 1, PID: 13899
2024年 07月 01日 星期一 23:18:15 CST: wenzhi.py 被停止, PID: 13903
2024年 07月 01日 星期一 23:18:15 CST: tts.py 运行失败,退出状态码 1, PID: 13911
2024年 07月 01日 星期一 23:18:17 CST: wenzhi.py 被停止, PID: 13915
2024年 07月 01日 星期一 23:18:18 CST: tts.py 运行失败,退出状态码 1, PID: 13923
2024年 07月 01日 星期一 23:18:20 CST: wenzhi.py 被停止, PID: 13927
2024年 07月 01日 星期一 23:18:20 CST: tts.py 运行失败,退出状态码 1, PID: 13935
2024年 07月 01日 星期一 23:18:22 CST: wenzhi.py 被停止, PID: 13939
2024年 07月 01日 星期一 23:18:22 CST: tts.py 运行失败,退出状态码 1, PID: 13947
2024年 07月 01日 星期一 23:18:24 CST: wenzhi.py 被停止, PID: 13960
2024年 07月 01日 星期一 23:18:24 CST: tts.py 运行失败,退出状态码 1, PID: 13968
2024年 07月 01日 星期一 23:18:26 CST: wenzhi.py 被停止, PID: 13972
2024年 07月 01日 星期一 23:18:26 CST: tts.py 运行失败,退出状态码 1, PID: 13980
2024年 07月 01日 星期一 23:18:28 CST: wenzhi.py 被停止, PID: 13984
2024年 07月 01日 星期一 23:18:28 CST: tts.py 运行失败,退出状态码 1, PID: 13992
2024年 07月 01日 星期一 23:18:30 CST: wenzhi.py 被停止, PID: 13996
2024年 07月 01日 星期一 23:18:30 CST: tts.py 运行失败,退出状态码 1, PID: 14004
2024年 07月 01日 星期一 23:18:32 CST: wenzhi.py 被停止, PID: 14017
2024年 07月 01日 星期一 23:18:32 CST: tts.py 运行失败,退出状态码 1, PID: 14025
2024年 07月 01日 星期一 23:18:34 CST: wenzhi.py 被停止, PID: 14029
2024年 07月 01日 星期一 23:18:34 CST: tts.py 运行失败,退出状态码 1, PID: 14046
2024年 07月 01日 星期一 23:18:36 CST: wenzhi.py 被停止, PID: 14050
2024年 07月 01日 星期一 23:18:36 CST: tts.py 运行失败,退出状态码 1, PID: 14076
2024年 07月 01日 星期一 23:18:38 CST: wenzhi.py 被停止, PID: 14080
2024年 07月 01日 星期一 23:18:38 CST: tts.py 运行失败,退出状态码 1, PID: 14088
2024年 07月 01日 星期一 23:18:40 CST: wenzhi.py 被停止, PID: 14092
2024年 07月 01日 星期一 23:18:40 CST: tts.py 运行失败,退出状态码 1, PID: 14109
2024年 07月 01日 星期一 23:18:42 CST: wenzhi.py 被停止, PID: 14113
2024年 07月 01日 星期一 23:18:42 CST: tts.py 运行失败,退出状态码 1, PID: 14130
2024年 07月 01日 星期一 23:18:44 CST: wenzhi.py 被停止, PID: 14134
2024年 07月 01日 星期一 23:18:44 CST: tts.py 运行失败,退出状态码 1, PID: 14142
2024年 07月 01日 星期一 23:18:46 CST: wenzhi.py 被停止, PID: 14146
2024年 07月 01日 星期一 23:18:46 CST: tts.py 运行失败,退出状态码 1, PID: 14154
2024年 07月 01日 星期一 23:18:48 CST: wenzhi.py 被停止, PID: 14167
2024年 07月 01日 星期一 23:18:48 CST: tts.py 运行失败,退出状态码 1, PID: 14184
2024年 07月 01日 星期一 23:18:50 CST: wenzhi.py 被停止, PID: 14197
2024年 07月 01日 星期一 23:18:50 CST: tts.py 运行失败,退出状态码 1, PID: 14223
2024年 07月 01日 星期一 23:18:52 CST: wenzhi.py 被停止, PID: 14227
2024年 07月 01日 星期一 23:18:52 CST: tts.py 运行失败,退出状态码 1, PID: 14235
2024年 07月 01日 星期一 23:18:54 CST: wenzhi.py 被停止, PID: 14248
2024年 07月 01日 星期一 23:18:54 CST: tts.py 运行失败,退出状态码 1, PID: 14282
2024年 07月 01日 星期一 23:18:56 CST: wenzhi.py 被停止, PID: 14296
2024年 07月 01日 星期一 23:18:56 CST: tts.py 运行失败,退出状态码 1, PID: 14313
2024年 07月 01日 星期一 23:18:58 CST: wenzhi.py 被停止, PID: 14334
2024年 07月 01日 星期一 23:18:58 CST: tts.py 运行失败,退出状态码 1, PID: 14361
2024年 07月 01日 星期一 23:19:00 CST: wenzhi.py 被停止, PID: 14374
2024年 07月 01日 星期一 23:19:00 CST: tts.py 运行失败,退出状态码 1, PID: 14391
2024年 07月 01日 星期一 23:19:02 CST: wenzhi.py 被停止, PID: 14395
2024年 07月 01日 星期一 23:19:02 CST: tts.py 运行失败,退出状态码 1, PID: 14403
2024年 07月 01日 星期一 23:19:04 CST: wenzhi.py 被停止, PID: 14425
2024年 07月 01日 星期一 23:19:04 CST: tts.py 运行失败,退出状态码 1, PID: 14433
2024年 07月 01日 星期一 23:19:06 CST: wenzhi.py 被停止, PID: 14446
2024年 07月 01日 星期一 23:19:07 CST: tts.py 运行失败,退出状态码 1, PID: 14463
2024年 07月 01日 星期一 23:19:09 CST: wenzhi.py 被停止, PID: 14485
2024年 07月 01日 星期一 23:19:09 CST: tts.py 运行失败,退出状态码 1, PID: 14502
2024年 07月 01日 星期一 23:19:11 CST: wenzhi.py 被停止, PID: 14515
2024年 07月 01日 星期一 23:19:11 CST: tts.py 运行失败,退出状态码 1, PID: 14532
2024年 07月 01日 星期一 23:19:13 CST: wenzhi.py 被停止, PID: 14536
2024年 07月 01日 星期一 23:19:13 CST: tts.py 运行失败,退出状态码 1, PID: 14544
2024年 07月 01日 星期一 23:19:15 CST: wenzhi.py 被停止, PID: 14548
2024年 07月 01日 星期一 23:19:15 CST: tts.py 运行失败,退出状态码 1, PID: 14574
2024年 07月 01日 星期一 23:19:17 CST: wenzhi.py 被停止, PID: 14578
2024年 07月 01日 星期一 23:19:17 CST: tts.py 运行失败,退出状态码 1, PID: 14586
2024年 07月 01日 星期一 23:19:19 CST: wenzhi.py 被停止, PID: 14599
2024年 07月 01日 星期一 23:19:19 CST: tts.py 运行失败,退出状态码 1, PID: 14616
2024年 07月 01日 星期一 23:19:21 CST: wenzhi.py 被停止, PID: 14620
2024年 07月 01日 星期一 23:19:21 CST: tts.py 运行失败,退出状态码 1, PID: 14646
2024年 07月 01日 星期一 23:19:23 CST: wenzhi.py 被停止, PID: 14650
2024年 07月 01日 星期一 23:19:23 CST: tts.py 运行失败,退出状态码 1, PID: 14658
2024年 07月 01日 星期一 23:19:25 CST: wenzhi.py 被停止, PID: 14671
2024年 07月 01日 星期一 23:19:25 CST: tts.py 运行失败,退出状态码 1, PID: 14679
2024年 07月 01日 星期一 23:19:27 CST: wenzhi.py 被停止, PID: 14692
2024年 07月 01日 星期一 23:19:27 CST: tts.py 运行失败,退出状态码 1, PID: 14709
2024年 07月 01日 星期一 23:19:29 CST: wenzhi.py 被停止, PID: 14713
2024年 07月 01日 星期一 23:19:29 CST: tts.py 运行失败,退出状态码 1, PID: 14721
2024年 07月 01日 星期一 23:19:31 CST: wenzhi.py 被停止, PID: 14735
2024年 07月 01日 星期一 23:19:31 CST: tts.py 运行失败,退出状态码 1, PID: 14743
2024年 07月 01日 星期一 23:19:33 CST: wenzhi.py 被停止, PID: 14756
2024年 07月 01日 星期一 23:19:33 CST: tts.py 运行失败,退出状态码 1, PID: 14773
2024年 07月 01日 星期一 23:19:35 CST: wenzhi.py 被停止, PID: 14777
2024年 07月 01日 星期一 23:19:35 CST: tts.py 运行失败,退出状态码 1, PID: 14785
2024年 07月 01日 星期一 23:19:37 CST: wenzhi.py 被停止, PID: 14798
2024年 07月 01日 星期一 23:19:37 CST: tts.py 运行失败,退出状态码 1, PID: 14815
2024年 07月 01日 星期一 23:19:39 CST: wenzhi.py 被停止, PID: 14819
2024年 07月 01日 星期一 23:19:39 CST: tts.py 运行失败,退出状态码 1, PID: 14836
2024年 07月 01日 星期一 23:19:41 CST: wenzhi.py 被停止, PID: 14840
2024年 07月 01日 星期一 23:19:41 CST: tts.py 运行失败,退出状态码 1, PID: 14848
2024年 07月 01日 星期一 23:19:43 CST: wenzhi.py 被停止, PID: 14852
2024年 07月 01日 星期一 23:19:43 CST: tts.py 运行失败,退出状态码 1, PID: 14860
2024年 07月 01日 星期一 23:19:45 CST: wenzhi.py 被停止, PID: 14864
2024年 07月 01日 星期一 23:19:45 CST: tts.py 运行失败,退出状态码 1, PID: 14872
2024年 07月 01日 星期一 23:19:47 CST: wenzhi.py 被停止, PID: 14885
2024年 07月 01日 星期一 23:19:47 CST: tts.py 运行失败,退出状态码 1, PID: 14893
2024年 07月 01日 星期一 23:19:49 CST: wenzhi.py 被停止, PID: 14897
2024年 07月 01日 星期一 23:19:49 CST: tts.py 运行失败,退出状态码 1, PID: 14905
2024年 07月 01日 星期一 23:19:51 CST: wenzhi.py 被停止, PID: 14909
2024年 07月 01日 星期一 23:19:51 CST: tts.py 运行失败,退出状态码 1, PID: 14926
2024年 07月 01日 星期一 23:19:53 CST: wenzhi.py 被停止, PID: 14948
2024年 07月 01日 星期一 23:19:53 CST: tts.py 运行失败,退出状态码 1, PID: 14956
2024年 07月 01日 星期一 23:19:55 CST: wenzhi.py 被停止, PID: 14969
2024年 07月 01日 星期一 23:19:55 CST: tts.py 运行失败,退出状态码 1, PID: 14977
2024年 07月 01日 星期一 23:19:58 CST: wenzhi.py 被停止, PID: 14981
2024年 07月 01日 星期一 23:19:58 CST: tts.py 运行失败,退出状态码 1, PID: 15007
2024年 07月 01日 星期一 23:20:00 CST: wenzhi.py 被停止, PID: 15020
2024年 07月 01日 星期一 23:20:00 CST: tts.py 运行失败,退出状态码 1, PID: 15037
2024年 07月 01日 星期一 23:20:02 CST: wenzhi.py 被停止, PID: 15041
2024年 07月 01日 星期一 23:20:02 CST: tts.py 运行失败,退出状态码 1, PID: 15049
2024年 07月 01日 星期一 23:20:04 CST: wenzhi.py 被停止, PID: 15053
2024年 07月 01日 星期一 23:20:04 CST: tts.py 运行失败,退出状态码 1, PID: 15061
2024年 07月 01日 星期一 23:20:06 CST: wenzhi.py 被停止, PID: 15067
2024年 07月 01日 星期一 23:20:06 CST: tts.py 运行失败,退出状态码 1, PID: 15075
2024年 07月 01日 星期一 23:20:08 CST: wenzhi.py 被停止, PID: 15079
2024年 07月 01日 星期一 23:20:08 CST: tts.py 运行失败,退出状态码 1, PID: 15105

@ -1,40 +0,0 @@
#!/bin/bash
# repted.sh
while true; do
# 在后台运行itt目录中的wenzhi.py脚本并获取其PID
python3 itt/wenzhi.py &
wenzhi_pid=$!
# 等待一段时间让wenzhi.py开始执行
sleep 1
# 检查wenzhi.py是否还在运行
if kill -0 $wenzhi_pid 2>/dev/null; then
# wenzhi.py仍在运行尝试停止它
kill $wenzhi_pid
wait $wenzhi_pid
echo "$(date): wenzhi.py 被停止, PID: $wenzhi_pid" >> log.txt
else
# wenzhi.py已经停止记录日志
echo "$(date): wenzhi.py 已经停止, PID: $wenzhi_pid" >> log.txt
fi
# 在后台运行tts目录中的tts.py脚本并获取其PID
python3 tts/tts.py &
tts_pid=$!
# 等待tts.py脚本结束以获取其退出状态
wait $tts_pid
tts_exit_status=$?
# 检查tts.py脚本是否成功运行
if [ $tts_exit_status -eq 0 ]; then
echo "$(date): tts.py 运行成功, PID: $tts_pid" >> log.txt
else
echo "$(date): tts.py 运行失败,退出状态码 $tts_exit_status, PID: $tts_pid" >> log.txt
fi
# 等待一段时间后再重复这个过程
sleep 1
done

@ -1,69 +0,0 @@
import numpy as np
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import OneHotEncoder
from keras.models import Sequential
from keras.layers import Dense, Embedding, Flatten
from keras.preprocessing.sequence import pad_sequences
from keras.utils import to_categorical
import re
# 文本清洗函数
def clean_text(text):
# 使用正则表达式去除非标准字符
cleaned_text = re.sub(r'[^a-zA-Z0-9\s]', '', text.lower())
return cleaned_text
# 读取文本文件
def read_text_file(file_path):
with open(file_path, 'r', encoding='utf-8') as f:
return f.read()
# 数据准备
def prepare_data(text, max_sequence_length=10):
words = set(clean_text(text).split())
word2index = {word: i for i, word in enumerate(words, 1)}
index2word = {i: word for word, i in word2index.items()}
sentences = text.split('. ')
X, y = [], []
for sentence in sentences:
cleaned_sentence = clean_text(sentence)
tokens = [word2index[word] for word in cleaned_sentence.split() if word in word2index]
for i in range(1, len(tokens)):
X.append(tokens[:-i])
y.append(tokens[i])
# 使用pad_sequences处理变长序列
X = pad_sequences(X, maxlen=max_sequence_length, padding='pre', truncating='post')
y = to_categorical(np.array(y), num_classes=len(word2index))
return X, y, word2index, index2word
# 读取文本文件并准备数据
text = read_text_file('input.txt') # 假设输入文件名为input.txt
X, y, word2index, index2word = prepare_data(text)
# 划分训练集和测试集
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)
# 构建NNLM模型这里使用Embedding层来捕获词汇之间的相似性
model = Sequential()
model.add(Embedding(input_dim=len(word2index) + 1, output_dim=32, input_length=max_sequence_length))
model.add(Flatten())
model.add(Dense(128, activation='relu'))
model.add(Dense(len(word2index), activation='softmax'))
model.compile(optimizer='adam', loss='categorical_crossentropy')
# 训练模型
model.fit(np.array([x for x in X_train]), y_train, epochs=10, batch_size=32)
# 预测
predictions = model.predict([x for x in X_test])
predicted_words = [np.argmax(pred) for pred in predictions]
predicted_sentences = [' '.join(index2word[word] for word in [sentence[0]] + [predicted_words[i] for i, _ in enumerate(sentence[1:]) if i < len(predicted_words)])
for sentence in X_test]
# 将预测结果写入文本文件
with open('output.txt', 'w', encoding='utf-8') as f:
for sentence in predicted_sentences:
f.write(sentence + '\n')

@ -1,76 +0,0 @@
import subprocess
import os
import datetime
from datetime import timedelta
import re
def speak_text_from_file(file_path, voice='zh', speed=150, pitch=50, output_file=None):
"""
从文件中读取文本并使用espeak将其转换为语音
:param file_path: 文本文件的路径
:param voice: 使用的声音例如 'zh' 用于中文
:param speed: 语速默认为 150
:param pitch: 音调默认为 50
:param output_file: 如果指定将语音输出保存为WAV文件
"""
with open(file_path, 'r', encoding='utf-8') as file:
text = file.read()
# 构建espeak命令
cmd = ['espeak', '-v', voice, '-s', str(speed), '-p', str(pitch)]
if output_file:
cmd.extend(['-w', output_file])
else:
# 如果没有指定输出文件,则直接播放语音
pass # 这里可以添加其他选项,如音量调整等
# 使用stdin将文本传递给espeak
try:
proc = subprocess.Popen(cmd, stdin=subprocess.PIPE, stderr=subprocess.PIPE, encoding='utf-8')
proc.communicate(input=text)
if proc.returncode != 0:
# 获取并打印错误信息
error_message = proc.stderr.read()
print(f"Error executing espeak: {error_message}")
except Exception as e:
print(f"An error occurred: {e}")
# 获取当前文件夹路径
current_dir = os.getcwd()
# 获取父文件夹路径
parent_dir = os.path.dirname(current_dir)
specific_folder_name = "txt"
specific_folder_path = os.path.join(current_dir, specific_folder_name)
# 列出当前文件夹中的所有txt文件
txt_files = [f for f in os.listdir(specific_folder_path) if f.endswith('.txt')]
# 提取文件名中的数字,并找出最大的数字
max_number = -1
max_file = None
for txt_file in txt_files:
# 使用正则表达式提取文件名中的数字
match = re.search(r'^(\d+)\.txt$', txt_file)
if match:
file_number = int(match.group(1))
if file_number > max_number:
max_number = file_number
max_file = txt_file
# 检查是否找到了数字命名最大的txt文件
if max_file:
file_path = os.path.join(current_dir, max_file)
# 调用函数来朗读文本文件
speak_text_from_file(file_path, voice='zh', speed=140, pitch=55)
# 如果你想要将语音保存为WAV文件可以这样做
output_wav_file = 'output/output.wav' # WAV文件的输出路径
speak_text_from_file(file_path, voice='zh', speed=140, pitch=55, output_file=output_wav_file)
else:
print("没有找到数字命名最大的txt文件。")
print(specific_folder_path)

@ -1,54 +0,0 @@
/lib/libsnowboy-detect.a
snowboy-detect-swig.cc
snowboydetect.py
Snowboy.pm
.DS_Store
*.dylib
*.pyc
*.o
*.so
*.swp
*.swo
/examples/C/pa_stable_v19_20140130.tgz
/examples/C/pa_stable_v190600_20161030.tgz
/examples/C/portaudio
/examples/C/demo
/examples/C++/pa_stable_v19_20140130.tgz
/examples/C++/pa_stable_v190600_20161030.tgz
/examples/C++/portaudio
/examples/C++/demo
/examples/C++/demo2
/examples/Java/Demo.class
/examples/Perl/data/
/examples/iOS/Obj-C/Pods/Pods.xcodeproj/xcuserdata/
/examples/iOS/Obj-C/SnowboyTest.xcodeproj/project.xcworkspace/xcuserdata/
/examples/iOS/Obj-C/SnowboyTest.xcodeproj/xcuserdata/
/examples/iOS/Obj-C/SnowboyTest.xcworkspace/xcuserdata/
/examples/iOS/Swift3/SnowboyTest.xcodeproj/project.xcworkspace/xcuserdata/
/examples/iOS/Swift3/SnowboyTest.xcodeproj/xcuserdata/
/swig/Android/OpenBLAS-0.2.18.tar.gz
/swig/Android/android-ndk-r11c-darwin-x86_64.zip
/swig/Android/android-ndk-r14b-darwin-x86_64.zip
/swig/Android/android-ndk-r11c-linux-x86_64.zip
/swig/Android/OpenBLAS-Android/
/swig/Android/OpenBLAS-Android-ARM32/
/swig/Android/android-ndk-r11c/
/swig/Android/android-ndk-r14b/
/swig/Android/ndk_install/
/swig/Android/ndk_install_32bit/
/swig/Android/java/
/swig/Android/jniLibs/
/swig/Java/java/
/swig/Java/jniLibs/
/build
/node_modules
/lib/node/binding
/lib/node/index.js
/dist
**/snowboy.egg-info
/.idea

@ -1,22 +0,0 @@
/lib/libsnowboy-detect.a
snowboy-detect-swig.cc
snowboydetect.py
.DS_Store
*.pyc
*.o
*.so
/examples/C++/*
/examples/Python/*
/swig/Android/*
/swig/Python/*
/build
/node_modules
/lib/node/*.ts
.npmignore
.travis.yml

@ -1,90 +0,0 @@
language: cpp
# Cache node dependencies
cache:
directories:
- node_modules
# Ubuntu 14.04 Trusty support
sudo: required
dist: trusty
addons:
apt:
sources:
# add PPAs with more up-to-date toolchains
- ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.9
packages:
# install toolchains
- libmagic-dev
- libatlas-base-dev
- gcc-5
- g++-5
- clang-3.8
os:
- linux
- osx
env:
global:
- secure: Hpft/SbwPrjQbHq+3DeJ8aMCpg2uW4z9MY4XaPPA5FQ80QkUdFMqALRvdBhXf/hm6bEZVLbIMXxqCImL5C4nx1SMUmsL6w/FbJjnamYEopk2MKCPZHKtZOdxsbdUwpL30WRH85DQ0KbcG9LatEr+qLwf9adRQrozhh5zhoRXzjuH8nxS/GRkYuZgTt4wxNt7xYnCVlARS9/V15OeOGcRWw/Q/r++ipINz8ylGqUnTGImZrDZ2nhlOkBSNzrPA7NhCSw1OiGvZpg4zVj/gDkSkPNFn4oDFr1nNDqg0EPFGVXDDI0KA7dpw2DhrJk1z8HgXw8PorPGP0mLnDl4i811KkCz6g6y+ETC6k1VtdB2jss0MCnD9HtxM0RS62yls6Bm5aMhoFjryOHgLHNrjiHfW2/lki421K6QlGp3a2ONkRk9zHiti3uTdtbxlz0kcu7Z8FT045lHNZX0B6QpPiLi2sy7H/dItqAGdWuY0lrGrddX1PpxCckBAZLO8/VEGGGkLQtzbxEXgF+EW0HJxURvUYUF2VCy+kaq86KrFzvSKS/evW/vj7Sq2rNbOCtnIy/rvIKAXU0bbR/1imuEiiMhKdiZku+jRfZZmpjKHoydba9SsHpuNGnR/sH40AIHv7Lv6q+z3mEI+X1YaOVAAlLYWExuHLLbWYjng2gEBIHwmuU=
- secure: RNZDzRXBhS98DMpa0QIKQjL8Nl7Pbo6cYtPyaMjEgF2nv+W+gwhcyDDRUE4psJm26Qkz3AZNfLx/kGKPhhAjBpuGFreCbAFy3uDfbDdcn2K68E+yRSdBAoTIKlxVPpQR11hfPHiAs+3s4BIwLGnuwJSK3JMisboji4ceaxVQpdo0ZcJnNKykN2zabUl+8BW8SYQ8cYp/DLg+wSeqq7eplyYD7zoT/GGnSNylkrRsJxB5zlrRQC/ngUfK7AuxhkfQ14dsdWkkrx0RyVFul5VAc85qAbrtJvLZs2Cu/J3ohNzcRZG7m8+U4diHuIlBFx0ezL3hVBfXkOf74dP8+OnL3rAr/1n+dczl5/5mQqlSsy8UAtUtfdAtd+wRNRy5d+er1YuJBWOGs2SXInjNViEY1Phgs6bY/Lu3wiIxDJH0TORan6ZVSje2/vi7aegRoiqHNrs4m2JuQDCPXu53HKh22+nWgRLLXFT2oBN3FdCz3xj04t+LyT+P5uq9q0jXxKc1nlNpvF3nDzhIuJKcfgBRNm9Wt1vz04xzSRgZEFGMTRWkYTdV+0ZVeqEQjEPo4fRNJ6PT1Tem8VqIoHEKGivGkwiAZ6FhQ/TNkVD7tv5Vhq7eK3ZPXDRakuBsLJ5Nc9QnLCpoEqbuIYqjr8ODKV2HSjS16VaGPbvtYPWzhGKU9C4=
matrix:
- NODE_VERSION="4.0.0"
- NODE_VERSION="5.0.0"
- NODE_VERSION="6.0.0"
- NODE_VERSION="7.0.0"
- NODE_VERSION="8.0.0"
- NODE_VERSION="9.0.0"
before_install:
# use the correct version of node
- rm -rf ~/.nvm/ && git clone --depth 1 https://github.com/creationix/nvm.git ~/.nvm
- source ~/.nvm/nvm.sh
- nvm install $NODE_VERSION
- nvm use $NODE_VERSION
# get commit message
- COMMIT_MESSAGE=$(git show -s --format=%B $TRAVIS_COMMIT | tr -d '\n')
# put local node-pre-gyp on PATH
- export PATH=./node_modules/.bin/:$PATH
# put global node-gyp and nan on PATH
- npm install node-gyp -g
# install aws-sdk so it is available for publishing
- npm install aws-sdk nan typescript @types/node
# figure out if we should publish or republish
- PUBLISH_BINARY=false
- REPUBLISH_BINARY=false
# if we are building a tag then publish
# - if [[ $TRAVIS_BRANCH == `git describe --tags --always HEAD` ]]; then PUBLISH_BINARY=true; fi;
# or if we put [publish binary] in the commit message
- if test "${COMMIT_MESSAGE#*'[publish binary]'}" != "$COMMIT_MESSAGE"; then PUBLISH_BINARY=true; fi;
# alternativly we can [republish binary] which will replace any existing binary
- if test "${COMMIT_MESSAGE#*'[republish binary]'}" != "$COMMIT_MESSAGE"; then PUBLISH_BINARY=true && REPUBLISH_BINARY=true; fi;
install:
# ensure source install works
- npm install --build-from-source
# test our module
- node lib/node/index.js
before_script:
# if publishing, do it
- if [[ $REPUBLISH_BINARY == true ]]; then node-pre-gyp package unpublish; fi;
- if [[ $PUBLISH_BINARY == true ]]; then node-pre-gyp package publish; fi;
# cleanup
- node-pre-gyp clean
- node-gyp clean
script:
# if publishing, test installing from remote
- INSTALL_RESULT=0
- if [[ $PUBLISH_BINARY == true ]]; then INSTALL_RESULT=$(npm install --fallback-to-build=false > /dev/null)$? || true; fi;
# if install returned non zero (errored) then we first unpublish and then call false so travis will bail at this line
- if [[ $INSTALL_RESULT != 0 ]]; then echo "returned $INSTALL_RESULT";node-pre-gyp unpublish;false; fi
# If success then we arrive here so lets clean up
- node-pre-gyp clean
after_success:
# if success then query and display all published binaries
- node-pre-gyp info

@ -1,206 +0,0 @@
THIS LICENSE GOVERNS THE SOURCE CODE, THE LIBRARIES, THE RESOURCE FILES, AS WELL
AS THE HOTWORD MODEL snowboy/resources/snowboy.umdl PROVIDED IN THIS REPOSITORY.
ALL OTHER HOTWORD MODELS ARE GOVERNED BY THEIR OWN LICENSES.
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
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.

@ -1,12 +0,0 @@
recursive-include include *
recursive-include lib *
recursive-include swig/Python *
recursive-include resources *
include README.md
exclude *.txt
exclude *.pyc
global-exclude .DS_Store _snowboydetect.so
prune resources/alexa
prune lib/ios
prune lib/android

@ -1,489 +0,0 @@
*Dear KITT.AI users,*
*We are writing this update to let you know that we plan to shut down all KITT.AI products (Snowboy, NLU and Chatflow) by Dec. 31st, 2020.*
*we launched our first product Snowboy in 2016, and then NLU and Chatflow later that year. Since then, we have served more than 85,000 developers, worldwide, accross all our products. It has been 4 extraordinary years in our life, and we appreciate the opportunity to be able to serve the community.*
*The field of artificial intelligence is moving rapidly. As much as we like our products, we still see that they are getting outdated and are becoming difficult to maintain. All official websites/APIs for our products will be taken down by Dec. 31st, 2020. Our github repositories will remain open, but only community support will be available from this point beyond.*
*Thank you all, and goodbye!*
*The KITT.AI Team
Mar. 18th, 2020*
# Snowboy Hotword Detection
by [KITT.AI](http://kitt.ai).
[Home Page](https://snowboy.kitt.ai)
[Full Documentation](http://docs.kitt.ai/snowboy) and [FAQ](http://docs.kitt.ai/snowboy#faq)
[Discussion Group](https://groups.google.com/a/kitt.ai/forum/#!forum/snowboy-discussion) (or send email to snowboy-discussion@kitt.ai)
[Commercial application FAQ](README_commercial.md)
Version: 1.3.0 (2/19/2018)
## Alexa support
Snowboy now brings hands-free experience to the [Alexa AVS sample app](https://github.com/alexa/avs-device-sdk/wiki/Raspberry-Pi-Quick-Start-Guide-with-Script) on Raspberry Pi! See more info below regarding the performance and how you can use other hotword models. The following instructions currently support AVS sdk Version 1.12.1.
**Performance**
The performance of hotword detection usually depends on the actual environment, e.g., is it used with a quality microphone, is it used on the street, in a kitchen, or is there any background noise, etc. So we feel it is best for the users to evaluate it in their real environment. For the evaluation purpose, we have prepared an Android app which can be installed and run out of box: [SnowboyAlexaDemo.apk](https://github.com/Kitt-AI/snowboy/raw/master/resources/alexa/SnowboyAlexaDemo.apk) (please uninstall any previous versions first if you have installed this app before).
**Kittai KWD Engine**
* Set up [Alexa AVS sample app](https://github.com/alexa/avs-device-sdk/wiki/Raspberry-Pi-Quick-Start-Guide-with-Script) following the official AVS instructions
* Apply patch to replace the Sensory KWD engine with Kittai engine
```
# Copy the patch file to the root directory of Alexa AVS sample app. Please replace $ALEXA_AVS_SAMPLE_APP_PATH with the actual path where you
# cloned the Alexa AVS sample app repository, and replace $SNOWBOY_ROOT_PATH with the actual path where you clone the Snowboy repository
cd $ALEXA_AVS_SAMPLE_APP_PATH
cp $SNOWBOY_PATH/resource/alexa/alexa-avs-sample-app/avs-kittai.patch ./
# Apply the patch, this will modify the scripts setup.sh and pi.sh
patch < avs-kittai.patch
```
* Re-compile the avs-device-sdk and sample app
```
sudo bash setup.sh config.json
```
* Run the sample app
```
sudo bash startsample.sh
```
Here is a [demo video](https://www.youtube.com/watch?v=wiLEr6TeE58) for how to use Snowboy hotword engine in Alexa Voice Service.
**Personal model**
* Create your personal hotword model through our [website](https://snowboy.kitt.ai) or [hotword API](https://snowboy.kitt.ai/api/v1/train/)
* Put your personal model in [snowboy/resources](https://github.com/Kitt-AI/snowboy/tree/master/resources)
```
# Please put YOUR_PERSONAL_MODEL.pmdl in $ALEXA_AVS_SAMPLE_APP_PATH/third-party/snowboy/resources,
# and $ALEXA_AVS_SAMPLE_APP_PATH with the actual path where you put the Alexa AVS sample app repository.
cp YOUR_PERSONAL_MODEL.pmdl $ALEXA_AVS_SAMPLE_APP_PATH/third-party/snowboy/resources/
```
* Replace the model name 'alexa.umdl' with your personal model name, update `KITT_AI_SENSITIVITY`, set `KITT_AI_APPLY_FRONT_END_PROCESSING` to `false` in the [Alexa AVS sample app code](https://github.com/alexa/avs-device-sdk/blob/master/KWD/KWDProvider/src/KeywordDetectorProvider.cpp) and re-compile
```
# Modify $ALEXA_AVS_SAMPLE_APP_PATH/avs-device-sdk/blob/master/KWD/KWDProvider/src/KeywordDetectorProvider.cpp:
# Replace the model name 'alexa.umdl' with your personal model name 'YOUR_PERSONAL_MODEL.pmdl' at line 52
# Update `KITT_AI_SENSITIVITY` at line 26
# Set `KITT_AI_APPLY_FRONT_END_PROCESSING` to `false` at line 32
sudo bash setup.sh config.json
```
* Run the wake word agent with engine set to `kitt_ai`!
Here is a [demo video](https://www.youtube.com/watch?v=9Bj8kdfwG7I) for how to use a personal model in Alexa Voice Service.
**Universal model**
* Put your personal model in [snowboy/resources](https://github.com/Kitt-AI/snowboy/tree/master/resources)
```
# Please put YOUR_UNIVERSAL_MODEL.umdl in $ALEXA_AVS_SAMPLE_APP_PATH/third-party/snowboy/resources,
# and $ALEXA_AVS_SAMPLE_APP_PATH with the actual path where you put the Alexa AVS sample app repository.
cp YOUR_UNIVERSAL_MODEL.umdl $ALEXA_AVS_SAMPLE_APP_PATH/third-party/snowboy/resources/
```
* Replace the model name 'alexa.umdl' with your universal model name, update `KITT_AI_SENSITIVITY` in the [Alexa AVS sample app code](https://github.com/alexa/avs-device-sdk/blob/master/KWD/KWDProvider/src/KeywordDetectorProvider.cpp) and re-compile
```
# Modify $ALEXA_AVS_SAMPLE_APP_PATH/avs-device-sdk/blob/master/KWD/KWDProvider/src/KeywordDetectorProvider.cpp:
# Replace the model name 'alexa.umdl' with your universal model name 'YOUR_UNIVERSAL_MODEL.umdl' at line 52
# Update `KITT_AI_SENSITIVITY` at line 26
sudo bash setup.sh config.json
```
* Run the wake word agent with engine set to `kitt_ai`!
## Hotword as a Service
Snowboy now offers **Hotword as a Service** through the ``https://snowboy.kitt.ai/api/v1/train/``
endpoint. Check out the [Full Documentation](http://docs.kitt.ai/snowboy) and example [Python/Bash script](examples/REST_API) (other language contributions are very welcome).
As a quick start, ``POST`` to https://snowboy.kitt.ai/api/v1/train:
{
"name": "a word",
"language": "en",
"age_group": "10_19",
"gender": "F",
"microphone": "mic type",
"token": "<your auth token>",
"voice_samples": [
{wave: "<base64 encoded wave data>"},
{wave: "<base64 encoded wave data>"},
{wave: "<base64 encoded wave data>"}
]
}
then you'll get a trained personal model in return!
## Introduction
Snowboy is a customizable hotword detection engine for you to create your own
hotword like "OK Google" or "Alexa". It is powered by deep neural networks and
has the following properties:
* **highly customizable**: you can freely define your own magic phrase here
let it be “open sesame”, “garage door open”, or “hello dreamhouse”, you name it.
* **always listening** but protects your privacy: Snowboy does not use Internet
and does *not* stream your voice to the cloud.
* light-weight and **embedded**: it even runs on a Raspberry Pi and consumes
less than 10% CPU on the weakest Pi (single-core 700MHz ARMv6).
* Apache licensed!
Currently Snowboy supports (look into the [lib](lib) folder):
* all versions of Raspberry Pi (with Raspbian based on Debian Jessie 8.0)
* 64bit Mac OS X
* 64bit Ubuntu 14.04
* iOS
* Android
* ARM64 (aarch64, Ubuntu 16.04)
It ships in the form of a **C++ library** with language-dependent wrappers
generated by SWIG. We welcome wrappers for new languages -- feel free to send a
pull request!
Currently we have built wrappers for:
* C/C++
* Java/Android
* Go (thanks to @brentnd and @deadprogram)
* Node (thanks to @evancohen and @nekuz0r)
* Perl (thanks to @iboguslavsky)
* Python2/Python3
* iOS/Swift3 (thanks to @grimlockrocks)
* iOS/Object-C (thanks to @patrickjquinn)
If you want support on other hardware/OS, please send your request to
[snowboy@kitt.ai](mailto:snowboy.kitt.ai)
Note: **Snowboy does not support Windows** yet. Please build Snowboy on *nix platforms.
## Pricing for Snowboy models
Hackers: free
* Personal use
* Community support
Business: please contact us at [snowboy@kitt.ai](mailto:snowboy@kitt.ai)
* Personal use
* Commercial license
* Technical support
## Pretrained universal models
We provide pretrained universal models for testing purpose. When you test those
models, bear in mind that they may not be optimized for your specific device or
environment.
Here is the list of the models, and the parameters that you have to use for them:
* **resources/alexa/alexa-avs-sample-app/alexa.umdl**: Universal model for the hotword "Alexa" optimized for [Alexa AVS sample app](https://github.com/alexa/alexa-avs-sample-app). Set SetSensitivity to 0.6, and set ApplyFrontend to true. This is so far the best "Alexa" model we released publicly, when ApplyFrontend is set to true.
* **resources/models/snowboy.umdl**: Universal model for the hotword "Snowboy". Set SetSensitivity to 0.5 and ApplyFrontend to false.
* **resources/models/jarvis.umdl**: Universal model for the hotword "Jarvis" (https://snowboy.kitt.ai/hotword/29). It has two different models for the hotword Jarvis, so you have to use two sensitivites. Set sensitivities to "0.8,0.80" and ApplyFrontend to true.
* **resources/models/smart_mirror.umdl**: Universal model for the hotword "Smart Mirror" (https://snowboy.kitt.ai/hotword/47). Set sensitivity to Sensitivity to 0.5, and ApplyFrontend to false.
* **resources/models/subex.umdl**: Universal model for the hotword "Subex" (https://snowboy.kitt.ai/hotword/22014). Set sensitivity to Sensitivity to 0.5, and ApplyFrontend to true.
* **resources/models/neoya.umdl**: Universal model for the hotword "Neo ya" (https://snowboy.kitt.ai/hotword/22171). It has two different models for the hotword "Neo ya", so you have to use two sensitivites. Set sensitivities to "0.7,0.7", and ApplyFrontend to true.
* **resources/models/hey_extreme.umdl**: Universal model for the hotword "Hey Extreme" (https://snowboy.kitt.ai/hotword/15428). Set sensitivity to Sensitivity to 0.6, and ApplyFrontend to true.
* **resources/models/computer.umdl**: Universal model for the hotword "Computer" (https://snowboy.kitt.ai/hotword/46). Set sensitivity to Sensitivity to 0.6, and ApplyFrontend to true.
* **resources/models/view_glass.umdl**: Universal model for the hotword "View Glass" (https://snowboy.kitt.ai/hotword/7868). Set Sensitivity to 0.7, and ApplyFrontend to true.
## Precompiled node module
Snowboy is available in the form of a native node module precompiled for:
64 bit Ubuntu, MacOS X, and the Raspberry Pi (Raspbian 8.0+). For quick
installation run:
npm install --save snowboy
For sample usage see the `examples/Node` folder. You may have to install
dependencies like `fs`, `wav` or `node-record-lpcm16` depending on which script
you use.
## Precompiled Binaries with Python Demo
* 64 bit Ubuntu [14.04](https://s3-us-west-2.amazonaws.com/snowboy/snowboy-releases/ubuntu1404-x86_64-1.3.0.tar.bz2)
* [MacOS X](https://s3-us-west-2.amazonaws.com/snowboy/snowboy-releases/osx-x86_64-1.3.0.tar.bz2)
* Raspberry Pi with Raspbian 8.0, all versions
([1/2/3/Zero](https://s3-us-west-2.amazonaws.com/snowboy/snowboy-releases/rpi-arm-raspbian-8.0-1.3.0.tar.bz2))
If you want to compile a version against your own environment/language, read on.
## Dependencies
To run the demo you will likely need the following, depending on which demo you
use and what platform you are working with:
* SoX (audio conversion)
* PortAudio or PyAudio (audio capturing)
* SWIG 3.0.10 or above (compiling Snowboy for different languages/platforms)
* ATLAS or OpenBLAS (matrix computation)
You can also find the exact commands you need to install the dependencies on
Mac OS X, Ubuntu or Raspberry Pi below.
### Mac OS X
`brew` install `swig`, `sox`, `portaudio` and its Python binding `pyaudio`:
brew install swig portaudio sox
pip install pyaudio
If you don't have Homebrew installed, please download it [here](http://brew.sh/). If you don't have `pip`, you can install it [here](https://pip.pypa.io/en/stable/installing/).
Make sure that you can record audio with your microphone:
rec t.wav
### Ubuntu/Raspberry Pi/Pine64/Nvidia Jetson TX1/Nvidia Jetson TX2
First `apt-get` install `sox`, `portaudio` and its Python binding `pyaudio`:
sudo apt-get install python-pyaudio python3-pyaudio sox
pip install pyaudio
Compile a supported swig version (3.0.10 or above)
wget http://downloads.sourceforge.net/swig/swig-3.0.10.tar.gz
sudo apt-get install libpcre3 libpcre3-dev
./configure --prefix=/usr \
--without-clisp \
--without-maximum-compile-warnings &&
make
make install &&
install -v -m755 -d /usr/share/doc/swig-3.0.10 &&
cp -v -R Doc/* /usr/share/doc/swig-3.0.10
Then install the `atlas` matrix computing library:
sudo apt-get install libatlas-base-dev
Make sure that you can record audio with your microphone:
rec t.wav
If you need extra setup on your audio (especially on a Raspberry Pi), please see the [full documentation](http://docs.kitt.ai/snowboy).
## Compile a Node addon
Compiling a node addon for Linux and the Raspberry Pi requires the installation of the following dependencies:
sudo apt-get install libmagic-dev libatlas-base-dev
Then to compile the addon run the following from the root of the snowboy repository:
npm install
./node_modules/node-pre-gyp/bin/node-pre-gyp clean configure build
## Compile a Java Wrapper
# Make sure you have JDK installed.
cd swig/Java
make
SWIG will generate a directory called `java` which contains converted Java wrappers and a directory called `jniLibs` which contains the JNI library.
To run the Java example script:
cd examples/Java
make run
## Compile a Python Wrapper
cd swig/Python
make
SWIG will generate a `_snowboydetect.so` file and a simple (but hard-to-read) python wrapper `snowboydetect.py`. We have provided a higher level python wrapper `snowboydecoder.py` on top of that.
Feel free to adapt the `Makefile` in `swig/Python` to your own system's setting if you cannot `make` it.
## Compile a GO Wrapper
cd examples/Go
go get github.com/Kitt-AI/snowboy/swig/Go
go build -o snowboy main.go
./snowboy ../../resources/snowboy.umdl ../../resources/snowboy.wav
Expected Output:
```
Snowboy detecting keyword in ../../resources/snowboy.wav
Snowboy detected keyword 1
```
For more, please read `examples/Go/readme.md`.
## Compile a Perl Wrapper
cd swig/Perl
make
The Perl examples include training personal hotword using the KITT.AI RESTful APIs, adding Google Speech API after the hotword detection, etc. To run the examples, do the following
cd examples/Perl
# Install cpanm, if you don't already have it.
curl -L https://cpanmin.us | perl - --sudo App::cpanminus
# Install the dependencies. Note, on Linux you will have to install the
# PortAudio package first, using e.g.:
# apt-get install portaudio19-dev
sudo cpanm --installdeps .
# Run the unit test.
./snowboy_unit_test.pl
# Run the personal model training example.
./snowboy_RESTful_train.pl <API_TOKEN> <Hotword> <Language>
# Run the Snowboy Google Speech API example. By default it uses the Snowboy
# universal hotword.
./snowboy_googlevoice.pl <Google_API_Key> [Hotword_Model]
## Compile an iOS Wrapper
Using Snowboy library in Objective-C does not really require a wrapper. It is basically the same as using C++ library in Objective-C. We have compiled a "fat" static library for iOS devices, see the library here `lib/ios/libsnowboy-detect.a`.
To initialize Snowboy detector in Objective-C:
snowboy::SnowboyDetect* snowboyDetector = new snowboy::SnowboyDetect(
std::string([[[NSBundle mainBundle]pathForResource:@"common" ofType:@"res"] UTF8String]),
std::string([[[NSBundle mainBundle]pathForResource:@"snowboy" ofType:@"umdl"] UTF8String]));
snowboyDetector->SetSensitivity("0.45"); // Sensitivity for each hotword
snowboyDetector->SetAudioGain(2.0); // Audio gain for detection
To run hotword detection in Objective-C:
int result = snowboyDetector->RunDetection(buffer[0], bufferSize); // buffer[0] is a float array
You may want to play with the frequency of the calls to `RunDetection()`, which controls the CPU usage and the detection latency.
Thanks to @patrickjquinn and @grimlockrocks, we now have examples of using Snowboy in both Objective-C and Swift3. Check out the examples at `examples/iOS/`, and the screenshots below!
<img src=https://s3-us-west-2.amazonaws.com/kittai-cdn/Snowboy/Obj-C_Demo_02172017.png alt="Obj-C Example" width=300 /> <img src=https://s3-us-west-2.amazonaws.com/kittai-cdn/Snowboy/Swift3_Demo_02172017.png alt="Swift3 Example" width=300 />
## Compile an Android Wrapper
Full README and tutorial is in [Android README](examples/Android/README.md) and here's a screenshot:
<img src="https://s3-us-west-2.amazonaws.com/kittai-cdn/Snowboy/SnowboyAlexaDemo-Andriod.jpeg" alt="Android Alexa Demo" width=300 />
We have prepared an Android app which can be installed and run out of box: [SnowboyAlexaDemo.apk](https://github.com/Kitt-AI/snowboy/raw/master/resources/alexa/SnowboyAlexaDemo.apk) (please uninstall any previous one first if you installed this app before).
## Quick Start for Python Demo
Go to the `examples/Python` folder and open your python console:
In [1]: import snowboydecoder
In [2]: def detected_callback():
....: print "hotword detected"
....:
In [3]: detector = snowboydecoder.HotwordDetector("resources/snowboy.umdl", sensitivity=0.5, audio_gain=1)
In [4]: detector.start(detected_callback)
Then speak "snowboy" to your microphone to see whetheer Snowboy detects you.
The `snowboy.umdl` file is a "universal" model that detect different people speaking "snowboy". If you want other hotwords, please go to [snowboy.kitt.ai](https://snowboy.kitt.ai) to record, train and downloand your own personal model (a `.pmdl` file).
When `sensitiviy` is higher, the hotword gets more easily triggered. But you might get more false alarms.
`audio_gain` controls whether to increase (>1) or decrease (<1) input volume.
Two demo files `demo.py` and `demo2.py` are provided to show more usages.
Note: if you see the following error:
TypeError: __init__() got an unexpected keyword argument 'model_str'
You are probably using an old version of SWIG. Please upgrade. We have tested with SWIG version 3.0.7 and 3.0.8.
## Advanced Usages & Demos
See [Full Documentation](http://docs.kitt.ai/snowboy).
## Change Log
**v1.3.0, 2/19/2018**
* Added Frontend processing for all platforms
* Added `resources/models/smart_mirror.umdl` for https://snowboy.kitt.ai/hotword/47
* Added `resources/models/jarvis.umdl` for https://snowboy.kitt.ai/hotword/29
* Added README for Chinese
* Cleaned up the supported platforms
* Re-structured the model path
**v1.2.0, 3/25/2017**
* Added better Alexa model for [Alexa AVS sample app](https://github.com/alexa/alexa-avs-sample-app)
* New decoder that works well for short hotwords like Alexa
**v1.1.1, 3/24/2017**
* Added Android demo
* Added iOS demos
* Added Samsung Artik support
* Added Go support
* Added Intel Edison support
* Added Pine64 support
* Added Perl Support
* Added a more robust "Alexa" model (umdl)
* Offering Hotword as a Service through ``/api/v1/train`` endpoint.
* Decoder is not changed.
**v1.1.0, 9/20/2016**
* Added library for Node.
* Added support for Python3.
* Added universal model `alexa.umdl`
* Updated universal model `snowboy.umdl` so that it works in noisy environment.
**v1.0.4, 7/13/2016**
* Updated universal `snowboy.umdl` model to make it more robust.
* Various improvements to speed up the detection.
* Bug fixes.
**v1.0.3, 6/4/2016**
* Updated universal `snowboy.umdl` model to make it more robust in non-speech environment.
* Fixed bug when using float as input data.
* Added library support for Android ARMV7 architecture.
* Added library for iOS.
**v1.0.2, 5/24/2016**
* Updated universal `snowboy.umdl` model
* added C++ examples, docs will come in next release.
**v1.0.1, 5/16/2016**
* VAD now returns -2 on silence, -1 on error, 0 on voice and >0 on triggered models
* added static library for Raspberry Pi in case people want to compile themselves instead of using the binary version
**v1.0.0, 5/10/2016**
* initial release

@ -1,427 +0,0 @@
# Snowboy 唤醒词检测
[KITT.AI](http://kitt.ai)出品。
[Home Page](https://snowboy.kitt.ai)
[Full Documentation](http://docs.kitt.ai/snowboy) 和 [FAQ](http://docs.kitt.ai/snowboy#faq)
[Discussion Group](https://groups.google.com/a/kitt.ai/forum/#!forum/snowboy-discussion) (或者发送邮件给 snowboy-discussion@kitt.ai)
因为我们每天都会收到很多消息从2016年9月开始建立了讨论组。请在这里发送一般性的讨论。关于错误请使用Github问题标签。
版本1.3.02/19/2018
## Alexa支持
Snowboy现在为运行在Raspberry Pi上的[Alexa AVS sample app](https://github.com/alexa/alexa-avs-sample-app)提供了hands-free的体验有关性能以及如何使用其他唤醒词模型请参阅下面的信息。
**性能**
唤醒检测的性能通常依赖于实际的环境,例如,它是否与高质量麦克风一起使用,是否在街道上,在厨房中,是否有背景噪音等等. 所以对于性能我们觉得最好是在使用者真实的环境中进行评估。为了方便评估我们准备了一个可以直接安装训醒的Android应用程序[SnowboyAlexaDemo.apk](https://github.com/Kitt-AI/snowboy/raw/master/resources/alexa/SnowboyAlexaDemo.apk) (如果您之前安装了此应用程序,请先卸载它) 。
**个人模型**
* 用以下方式创建您的个人模型:[website](https://snowboy.kitt.ai) 或者 [hotword API](https://snowboy.kitt.ai/api/v1/train/)
* 将[Alexa AVS sample app](https://github.com/alexa/alexa-avs-sample-app)(安装后)的唤醒词模型替换为您的个人模型
```
# Please replace YOUR_PERSONAL_MODEL.pmdl with the personal model you just
# created, and $ALEXA_AVS_SAMPLE_APP_PATH with the actual path where you
# cloned the Alexa AVS sample app repository.
cp YOUR_PERSONAL_MODEL.pmdl $ALEXA_AVS_SAMPLE_APP_PATH/samples/wakeWordAgent/ext/resources/alexa.umdl
```
* 在[Alexa AVS sample app code](https://github.com/alexa/alexa-avs-sample-app/blob/master/samples/wakeWordAgent/src/KittAiSnowboyWakeWordEngine.cpp)中设置 `APPLY_FRONTEND``false`,更新 `SENSITIVITY`,并重新编译
```
# Please replace $ALEXA_AVS_SAMPLE_APP_PATH with the actual path where you
# cloned the Alexa AVS sample app repository.
cd $ALEXA_AVS_SAMPLE_APP_PATH/samples/wakeWordAgent/src/
# Modify KittAiSnowboyWakeWordEngine.cpp and update SENSITIVITY at line 28.
# Modify KittAiSnowboyWakeWordEngine.cpp and set APPLY_FRONTEND to false at
# line 30.
make
```
* 运行程序,并且把唤醒词引擎设置为`kitt_ai`
**通用模型**
* 将[Alexa AVS sample app](https://github.com/alexa/alexa-avs-sample-app)(安装后)的唤醒词模型替换为您的通用模型
```
# Please replace YOUR_UNIVERSAL_MODEL.umdl with the personal model you just
# created, and $ALEXA_AVS_SAMPLE_APP_PATH with the actual path where you
# cloned the Alexa AVS sample app repository.
cp YOUR_UNIVERSAL_MODEL.umdl $ALEXA_AVS_SAMPLE_APP_PATH/samples/wakeWordAgent/ext/resources/alexa.umdl
```
* 在[Alexa AVS sample app code](https://github.com/alexa/alexa-avs-sample-app/blob/master/samples/wakeWordAgent/src/KittAiSnowboyWakeWordEngine.cpp) 中更新 `SENSITIVITY`, 并重新编译
```
# Please replace $ALEXA_AVS_SAMPLE_APP_PATH with the actual path where you
# cloned the Alexa AVS sample app repository.
cd $ALEXA_AVS_SAMPLE_APP_PATH/samples/wakeWordAgent/src/
# Modify KittAiSnowboyWakeWordEngine.cpp and update SENSITIVITY at line 28.
make
```
* 运行程序,并且把唤醒词引擎设置为`kitt_ai`
## 个人唤醒词训练服务
Snowboy现在通过 `https://snowboy.kitt.ai/api/v1/train/` 端口提供 **个人唤醒词训练服务**, 请查看[Full Documentation](http://docs.kitt.ai/snowboy)和示例[Python/Bash script](examples/REST_API)(非常欢迎贡献其他的语言)。
简单来说,`POST` 下面代码到https://snowboy.kitt.ai/api/v1/train
{
"name": "a word",
"language": "en",
"age_group": "10_19",
"gender": "F",
"microphone": "mic type",
"token": "<your auth token>",
"voice_samples": [
{wave: "<base64 encoded wave data>"},
{wave: "<base64 encoded wave data>"},
{wave: "<base64 encoded wave data>"}
]
}
然后您会获得一个训练好的个人模型!
## 介绍
Snowboy是一款可定制的唤醒词检测引擎可为您创建像 "OK Google" 或 "Alexa" 这样的唤醒词。Snowboy基于神经网络具有以下特性
* **高度可定制**:您可以自由定义自己的唤醒词 -
比如说“open sesame”“garage door open”或 “hello dreamhouse”等等。
* **总是在监听** 但保护您的个人隐私Snowboy不使用互联网不会将您的声音传输到云端。
* **轻量级和嵌入式的**它可以轻松在Raspberry Pi上运行甚至在最弱的Pi单核700MHz ARMv6Snowboy占用的CPU也少于10%。
* Apache授权!
目前Snowboy支持查看lib文件夹
* 所有版本的Raspberry PiRaspbian基于Debian Jessie 8.0
* 64位Mac OS X
* 64位Ubuntu 14.04
* iOS
* Android
* ARM64aarch64Ubuntu 16.04)
Snowboy底层库由C++写成通过swig被封装成能在多种操作系统和语言上使用的软件库。我们欢迎新语言的封装请随时发送你们的Pull Request
目前我们已经现实封装的有:
* C/C++
* Java / Android
* Gothanks to @brentnd and @deadprogram
* Nodethanks to @evancohen和@ nekuz0r
* Perlthanks to @iboguslavsky
* Python2/Python3
* iOS / Swift3thanks to @grimlockrocks
* iOS / Object-Cthanks to @patrickjquinn
如果您想要支持其他硬件或操作系统,请将您的请求发送至[snowboy@kitt.ai](mailto:snowboy.kitt.ai)
注意:**Snowboy还不支持Windows** 。请在 *nix平台上编译Snowboy。
## Snowboy模型的定价
黑客:免费
* 个人使用
* 社区支持
商业:请通过[snowboy@kitt.ai](mailto:snowboy@kitt.ai)与我们联系
* 个人使用
* 商业许可证
* 技术支持
## 预训练的通用模型
为了测试方便,我们提供一些事先训练好的通用模型。当您测试那些模型时,请记住他们可能没有为您的特定设备或环境进行过优化。
以下是模型列表和您必须使用的参数:
* **resources/alexa/alexa-avs-sample-app/alexa.umdl**:这个是为[Alexa AVS sample app](https://github.com/alexa/alexa-avs-sample-app)优化过的唤醒词为“Alexa”的通用模型将`SetSensitivity`设置为`0.6`,并将`ApplyFrontend`设置为true。当`ApplyFrontend`设置为`true`时这是迄今为止我们公开发布的最好的“Alexa”的模型。
* **resources/models/snowboy.umdl**唤醒词为“snowboy”的通用模型。将`SetSensitivity`设置为`0.5``ApplyFrontend`设置为`false`。
* **resources/models/jarvis.umdl**: 唤醒词为“Jarvis” (https://snowboy.kitt.ai/hotword/29) 的通用模型其中包含了对应于“Jarvis”的两个唤醒词模型所以需要设置两个`sensitivity`。将`SetSensitivity`设置为`0.8,0.8``ApplyFrontend`设置为`true`。
* **resources/models/smart_mirror.umdl**: 唤醒词为“Smart Mirror” (https://snowboy.kitt.ai/hotword/47) 的通用模型。将`SetSensitivity`设置为`0.5``ApplyFrontend`设置为`false`。
* **resources/models/subex.umdl**: 唤醒词为“Subex”(https://snowboy.kitt.ai/hotword/22014) 的通用模型。将`SetSensitivity`设置为`0.5``ApplyFrontend`设置为`true`。
* **resources/models/neoya.umdl**: 唤醒词为“Neo ya”(https://snowboy.kitt.ai/hotword/22171) 的通用模型。其中包含了对应于“Neo ya”的两个>唤醒词模型,所以需要设置两个`sensitivity`。将`SetSensitivity`设置为`0.7,0.7``ApplyFrontend`设置为`true`。
* **resources/models/hey_extreme.umdl**: 唤醒词为“Hey Extreme” (https://snowboy.kitt.ai/hotword/15428)的通用模型。将`SetSensitivity`设置为`0.6``ApplyFrontend`设置为`true`。
* **resources/models/computer.umdl**: 唤醒词为“Computer” (https://snowboy.kitt.ai/hotword/46) 的通用模型。将`SetSensitivity`设置为`0.6``ApplyFrontend`设置为`true`。
* **resources/models/view_glass.umdl**: 唤醒词为“View Glass” (https://snowboy.kitt.ai/hotword/7868) 的通用模型。将`SetSensitivity`设置为`0.7``ApplyFrontend`设置为`true`。
## 预编译node模块
Snowboy为一下平台编译了node模块64位UbuntuMacOS X和Raspberry PiRaspbian 8.0+)。快速安装运行:
npm install --save snowboy
有关示例用法请参阅examples/Node文件夹。根据您使用的脚本可能需要安装依赖关系库例如fswav或node-record-lpcm16。
## 预编译Python Demo的二进制文件
* 64 bit Ubuntu [12.04](https://s3-us-west-2.amazonaws.com/snowboy/snowboy-releases/ubuntu1204-x86_64-1.2.0.tar.bz2)
/ [14.04](https://s3-us-west-2.amazonaws.com/snowboy/snowboy-releases/ubuntu1404-x86_64-1.3.0.tar.bz2)
* [MacOS X](https://s3-us-west-2.amazonaws.com/snowboy/snowboy-releases/osx-x86_64-1.3.0.tar.bz2)
* Raspberry Pi with Raspbian 8.0, all versions
([1/2/3/Zero](https://s3-us-west-2.amazonaws.com/snowboy/snowboy-releases/rpi-arm-raspbian-8.0-1.3.0.tar.bz2))
* Pine64 (Debian Jessie 8.5 (3.10.102)), Nvidia Jetson TX1 and Nvidia Jetson TX2 ([download](https://s3-us-west-2.amazonaws.com/snowboy/snowboy-releases/pine64-debian-jessie-1.2.0.tar.bz2))
* Intel Edison (Ubilinux based on Debian Wheezy 7.8) ([download](https://s3-us-west-2.amazonaws.com/snowboy/snowboy-releases/edison-ubilinux-1.2.0.tar.bz2))
如果您要根据自己的环境/语言编译版本,请继续阅读。
## 依赖
要运行demo您可能需要以下内容具体取决于您使用的示例和您正在使用的平台
* SoX音频转换
* PortAudio或PyAudio音频录音
* SWIG 3.0.10或以上(针对不同语言/平台编译Snowboy
* ATLAS或OpenBLAS矩阵计算
在下面您还可以找到在Mac OS XUbuntu或Raspberry Pi上安装依赖关系所需的确切命令。
### Mac OS X
`brew` 安装 `swig``sox``portaudio` 和绑定了 `pyaudio`的Python
brew install swig portaudio sox
pip install pyaudio
如果您没有安装Homebrew请在这里[here](http://brew.sh/)下载。如果没有pip可以在这里[here](https://pip.pypa.io/en/stable/installing/)安装。
确保您可以用麦克风录制音频:
rec t.wav
### Ubuntu / Raspberry Pi / Pine64 / Nvidia Jetson TX1 / Nvidia Jetson TX2
首先 `apt-get` 安装 `swig``sox``portaudio`和绑定了 `pyaudio` 的 Python
sudo apt-get install swig3.0 python-pyaudio python3-pyaudio sox
pip install pyaudio
然后安装 `atlas` 矩阵计算库:
sudo apt-get install libatlas-base-dev
确保您可以用麦克风录制音频:
rec t.wav
如果您需要额外设置您的音频特别是Raspberry Pi请参阅[full documentation](http://docs.kitt.ai/snowboy)。
## 编译Node插件
为Linux和Raspberry Pi编译node插件需要安装以下依赖项:
sudo apt-get install libmagic-dev libatlas-base-dev
然后编译插件从snowboy代码库的根目录运行以下内容
npm install
./node_modules/node-pre-gyp/bin/node-pre-gyp clean configure build
## 编译Java Wrapper
# Make sure you have JDK installed.
cd swig/Java
make
SWIG将生成一个包含转换成Java封装的`java`目录和一个包含JNI库的`jniLibs`目录。
运行Java示例脚本
cd examples/Java
make run
## 编译Python Wrapper
cd swig/Python
make
SWIG将生成一个_snowboydetect.so文件和一个简单但难以阅读的python 封装snowboydetect.py。我们已经提供了一个更容易读懂的python封装snowboydecoder.py。
如果不能make请适配`swig/Python`中的Makefile到您自己的系统设置。
## 编译GO Warpper
cd examples/Go
go get github.com/Kitt-AI/snowboy/swig/Go
go build -o snowboy main.go
./snowboy ../../resources/snowboy.umdl ../../resources/snowboy.wav
期望输出:
Snowboy detecting keyword in ../../resources/snowboy.wav
Snowboy detected keyword 1
更多细节,请阅读 'examples/Go/readme.md'。
## 编译Perl wrapper
cd swig/Perl
make
Perl示例包括使用KITT.AI RESTful API训练个人唤醒词在检测到唤醒之后添加Google Speech API等。要运行示例请执行以下操作
cd examples/Perl
# Install cpanm, if you don't already have it.
curl -L https://cpanmin.us | perl - --sudo App::cpanminus
# Install the dependencies. Note, on Linux you will have to install the
# PortAudio package first, using e.g.:
# apt-get install portaudio19-dev
sudo cpanm --installdeps .
# Run the unit test.
./snowboy_unit_test.pl
# Run the personal model training example.
./snowboy_RESTful_train.pl <API_TOKEN> <Hotword> <Language>
# Run the Snowboy Google Speech API example. By default it uses the Snowboy
# universal hotword.
./snowboy_googlevoice.pl <Google_API_Key> [Hotword_Model]
## 编译iOS wrapper
在Objective-C中使用Snowboy库不需要封装. 它与Objective-C中使用C++库基本相同. 我们为iOS设备编写了一个 "fat" 静态库,请参阅这里的库`lib/ios/libsnowboy-detect.a`。
在Objective-C中初始化Snowboy检测器
snowboy::SnowboyDetect* snowboyDetector = new snowboy::SnowboyDetect(
std::string([[[NSBundle mainBundle]pathForResource:@"common" ofType:@"res"] UTF8String]),
std::string([[[NSBundle mainBundle]pathForResource:@"snowboy" ofType:@"umdl"] UTF8String]));
snowboyDetector->SetSensitivity("0.45"); // Sensitivity for each hotword
snowboyDetector->SetAudioGain(2.0); // Audio gain for detection
在Objective-C中运行唤醒词检测
int result = snowboyDetector->RunDetection(buffer[0], bufferSize); // buffer[0] is a float array
您可能需要按照一定的频率调用RunDetection()从而控制CPU使用率和检测延迟。
感谢@patrickjquinn和@grimlockrocks我们现在有了在Objective-C和Swift3中使用Snowboy的例子。看看下面的例子`examples/iOS/`和下面的截图!
<img src=https://s3-us-west-2.amazonaws.com/kittai-cdn/Snowboy/Obj-C_Demo_02172017.png alt="Obj-C Example" width=300 /> <img src=https://s3-us-west-2.amazonaws.com/kittai-cdn/Snowboy/Swift3_Demo_02172017.png alt="Swift3 Example" width=300 />
# 编译Android Wrapper
完整的README和教程在[Android README](examples/Android/README.md),这里是一个截图:
<img src="https://s3-us-west-2.amazonaws.com/kittai-cdn/Snowboy/SnowboyAlexaDemo-Andriod.jpeg" alt="Android Alexa Demo" width=300 />
我们准备了一个可以安装并运行的Android应用程序[SnowboyAlexaDemo.apk](https://github.com/Kitt-AI/snowboy/raw/master/resources/alexa/SnowboyAlexaDemo.apk)(如果您之前安装了此应用程序,请先卸载它们)。
## Python demo快速入门
进入 `examples/Python` 文件夹并打开你的python控制台
In [1]: import snowboydecoder
In [2]: def detected_callback():
....: print "hotword detected"
....:
In [3]: detector = snowboydecoder.HotwordDetector("resources/snowboy.umdl", sensitivity=0.5, audio_gain=1)
In [4]: detector.start(detected_callback)
然后对你的麦克风说"snowboy"看看是否Snowboy检测到你。
这个 `snowboy.umdl` 文件是一个 "通用" 模型,可以检测不同的人说 "snowboy" 。 如果你想要其他的唤醒词,请去[snowboy.kitt.ai](https://snowboy.kitt.ai)录音,训练和下载你自己的个人模型(一个.pmdl文件)。
`sensitiviy` 设置越高,唤醒越容易触发。但是你也可能会收到更多的误唤醒。
`audio_gain` 控制是否增加(> 1或降低<1)输入音量。
我们提供了两个演示文件 `demo.py`, `demo2.py` 以显示更多的用法。
注意:如果您看到以下错误:
TypeError: __init__() got an unexpected keyword argument 'model_str'
您可能正在使用旧版本的SWIG. 请升级SWIG。我们已经测试过SWIG 3.0.7和3.0.8。
## 高级用法与演示
请参阅[Full Documentation](http://docs.kitt.ai/snowboy)。
## 更改日志
**v1.3.0, 2/19/2018**
* 添加前端处理到所有平台
* 添加`resources/models/smart_mirror.umdl` 给 https://snowboy.kitt.ai/hotword/47
* 添加`resources/models/jarvis.umdl` 给 https://snowboy.kitt.ai/hotword/29
* 添加中文文档
* 清理支持的平台
* 重新定义了模型路径
**v1.2.0, 3/25/2017**
* 为[Alexa AVS sample app](https://github.com/alexa/alexa-avs-sample-app)添加更好的Alexa模型
* 新的解码器适用于像Alexa这样的简短的词条
**v1.1.1, 3/24/2017**
* 添加Android演示
* 添加了iOS演示
* 增加了三星Artik支持
* 添加Go支持
* 增加了英特尔爱迪生支持
* 增加了Pine64的支持
* 增加了Perl支持
* 添加了更强大的“Alexa”模型umdl
* 通过/api/v1/train终端提供Hotword即服务。
* 解码器没有改变
**v1.1.0, 9/20/2016**
* 添加了Node的库
* 增加了对Python3的支持
* 增加了通用模型 alexa.umdl
* 更新通用模型snowboy.umdl使其在嘈杂的环境中工作
**v1.0.4, 7/13/2016**
* 更新通用snowboy.umdl模型使其更加健壮
* 各种改进加快检测
* Bug修复
**v1.0.3, 6/4/2016**
* 更新的通用snowboy.umdl模型使其在非语音环境中更加强大
* 修正使用float作为输入数据时的错误
* 为Android ARMV7架构增加了库支持
* 为iOS添加了库
**v1.0.2, 5/24/2016**
* 更新通用snowboy.umdl模型
* 添加C ++示例,文档将在下一个版本中
**v1.0.1, 5/16/2016**
* VAD现在返回-2为静音-1为错误0为语音大于0为触发了唤醒
* 添加了Raspberry Pi的静态库以防人们想自己编译而不是使用二进制版本
**v1.0.0, 5/10/2016**
* 初始版本

@ -1,134 +0,0 @@
# Common Questions for a Commercial Application
You are looking for a way to put Snowboy in a commercial application. We have compiled a large collection of common questions from our customers all over the world in various industries.
## Universal models (paid) vs. personal models (free)
Personal models:
* are the models you downloaded from https://snowboy.kitt.ai or using our `/train` SaaS API.
* are good for quick demos
* are built with only 3 voice samples
* are not noise robust and you'll get a lot of false alarms in real environment
* only work on your own voice or a very similar voice, thus is speaker dependent
* are free
Universal models:
* are built using a lot more voice samples (at least thousands)
* take effort to collect those voice samples
* take a lot of GPU time to train
* are more robust against noise
* are mostly speaker independent (with challenges on children's voice and accents)
* cannot be built by yourself using the web interface or the SaaS API
* cost you money
### FAQ for universal & personal models
Q: **If I record multiple times on snowboy.kitt.ai, can I improve the personal models?**
A: No. Personal models only take 3 voice samples to build. Each time you record new voices, the previous samples are overwritten and not used in your current model.
Q: **How can I get a universal model for free?**
A: The *one and only* way: Ask 500 people to log in to snowboy.kitt.ai, contribute their voice samples to a particular hotword, then ask us to build a universal model for that hotword.
Q: **Can I use your API to collect voices from 500 people and increment the sample counter from snowboy.kitt.ai?**
A: No. The [SaaS](https://github.com/kitt-ai/snowboy#hotword-as-a-service) API is separate from the website.
Q: **How long does it take to get a universal model?**
A: Usually a month.
## Licensing
### Explain your license again?
Everything on Snowboy's GitHub repo is Apache licensed, including various sample applications and wrapper codes, though the Snowboy library is binary code compiled against different platforms.
With that said, if you built an application from https://github.com/kitt-ai/snowboy or personal models downloaded from https://snowboy.kitt.ai, you don't need to pay a penny.
If you want to use a universal model with your own customized hotword, you'll need an **evaluation license** and a **commercial license**.
### Evaluation license
Each hotword is different. When you train a universal model with your own hotword, nobody can guarantee that it works on your system without any flaws. Thus you'll need to get an evaluation license first to test whether your universal model works for you.
An evaluation license:
* gives you a 90 day window to evaluate the universal model we build for you
* costs you money
**Warning: an evaluation license will expire after 90 days. Make sure you don't use the model with evaluation license in production systems.** Get a commercial license from us for your production system.
#### Evaluation license FAQ
Q: **How much does it cost?**
A: A few thousand dollars.
Q: **Can I get a discount as a {startup, student, NGO}?**
A: No. Our pricing is already at least half of what others charge.
Q: **How can you make sure your universal model works for me?**
A: We simply can't. However we have a few sample universal models from our GitHub [repo](https://github.com/Kitt-AI/snowboy/tree/master/resources), including "alexa.umdl", "snowboy.umdl", and "smart_mirror.umdl". The "alexa.umdl" model is enhanced with a lot more data and is not a typical case. So pay attention to test "snowboy.umdl" and "smart_mirror.umdl". They offer similar performance to your model.
### Commercial license
After evaluation, if you feel want to go with Snowboy, you'll need a commercial license to deploy it. We usually charge a flat fee per unit of hardware you sell.
#### Commercial license FAQ
Q: **Is it a one-time license or subscription-based license?**
A: It's a perpetual license for each device. Since the Snowboy library runs *offline* on your device, you can run it forever without worrying about any broken and dependent web services.
Q: **What's your pricing structure?**
A: We have tiered pricing depending on your volume. We charge less if you sell more.
Q: **Can you give me one example?**
A: For instance, if your product is a talking robot with a $300 price tag, and you sell at least 100,000 units per year, we'll probably charge you $1 per unit once you go over 100,000 units. If your product is a smart speaker with a $30 price tag, we won't charge you $1, but you'll have to sell a lot more to make the business sense to us.
Q: **I plan to sell 1000 units a year, can I license your software for $1 per unit?**
A: No. In that way we only make $1000 a year, which is not worth the amount of time we put on your hotword.
Q: **I make a cellphone app, not a hardware product, what's the pricing structure?**
A: Depends on how you generate revenue. For instance, if your app is priced at $1.99, we'll collect cents per paid user, assuming you have a large user base. If you only have 2000 paid users, we'll make a revenue of less than a hundred dollars and it won't make sense to us.
### What's the process of getting a license?
1. Make sure Snowboy can run on your system
2. Reach out to us with your hotword name, commercial application, and target market
3. Discuss with us about **commercial license** fee to make sure our pricing fits your budget
4. Sign an evaluation contract, pay 50% of invoice
5. We'll train a universal model for you and give you an **evaluation license** of 90 days
6. Test the model and discuss how we can improve it
7. If you decide to go with it, get a commercial license from us
## General Questions
### What language does Snowboy support?
We support North American English and Chinese the best. We can deal with a bit of Indian accents as well. For other languages, we'll need to first listen to your hotword (please send us a few .wav voice samples) before we can engage.
### How many voice samples do you need?
Usually 1500 voice samples from 500 people to get started. The more the better. If your hotword is in English, we can collect the voice samples for you. Otherwise you'll need to collect it yourself and send to us.
### What's the format on voice samples?
16000Hz sample rate, 16 bit integer, mono channel, .wav files.
### Does Snowboy do: AEC, VAD, Noise Suppression, Beam Forming?
Snowboy has a weak support for VAD and noise suppression, as we found some customers would use Snowboy without a microphone array. Snowboy is not a audio frontend processing toolkit thus does not support AEC and beam forming.
If your application wants to support far-field speech, i.e., verbal communication at least 3 feet away, you'll need a microphone array to enhance incoming speech and reduce noise. Please do not reply on Snowboy to do everything.
### Can you compile Snowboy for my platform?
If your platform is not listed [here](https://github.com/Kitt-AI/snowboy/tree/master/lib), and you want to get a commercial license from us, please contact us with your toolchain, hardware chip, RAM, OS, GCC/G++ version. Depending on the effort, we might charge an NRE fee for cross compiling.
### Contact
If this document doesn't cover what's needed, feel free to reach out to us at snowboy@kitt.ai

@ -1,85 +0,0 @@
{
'targets': [{
'target_name': 'snowboy',
'sources': [
'swig/Node/snowboy.cc'
],
'conditions': [
['OS=="mac"', {
'link_settings': {
'libraries': [
'<(module_root_dir)/lib/osx/libsnowboy-detect.a',
]
}
}],
['OS=="linux" and target_arch=="x64"', {
'link_settings': {
'ldflags': [
'-Wl,--no-as-needed',
],
'libraries': [
'<(module_root_dir)/lib/ubuntu64/libsnowboy-detect.a',
]
}
}],
['OS=="linux" and target_arch=="arm"', {
'link_settings': {
'ldflags': [
'-Wl,--no-as-needed',
],
'libraries': [
'<(module_root_dir)/lib/rpi/libsnowboy-detect.a',
]
}
}],
['OS=="linux" and target_arch=="arm64"', {
'link_settings': {
'ldflags': [
'-Wl,--no-as-needed',
],
'libraries': [
'<(module_root_dir)/lib/aarch64-ubuntu1604/libsnowboy-detect.a',
]
}
}]
],
'cflags': [
'-std=c++11',
'-fexceptions',
'-Wall',
'-D_GLIBCXX_USE_CXX11_ABI=0'
],
'cflags!': [
'-fno-exceptions'
],
'cflags_cc!': [
'-fno-exceptions'
],
'include_dirs': [
"<!(node -e \"require('nan')\")",
"<!(pwd)/include"
],
'libraries': [
'-lcblas'
],
'xcode_settings': {
'MACOSX_DEPLOYMENT_TARGET': '10.11',
"GCC_ENABLE_CPP_EXCEPTIONS": "YES",
'OTHER_CFLAGS': [
'-std=c++11',
'-stdlib=libc++'
]
}
},
{
"target_name": "action_after_build",
"type": "none",
"dependencies": [ "<(module_name)" ],
"copies": [
{
"files": [ "<(PRODUCT_DIR)/<(module_name).node" ],
"destination": "<(module_path)"
}
]
}]
}

@ -1,83 +0,0 @@
# Snowboy Demo on Android
Note:
1. supported building platforms are Android Studio running on Mac OS X or Ubuntu. Windows is not supported.
2. supported target CPU is ARMv7 (32bit) and ARMv8 (64bit) (most Android phones run on ARM CPUs)
3. we have prepared an Android app which can be installed and run out of box: [SnowboyAlexaDemo.apk](https://github.com/Kitt-AI/snowboy/raw/master/resources/alexa/SnowboyAlexaDemo.apk) (please uninstall any previous one first if you installed this app before).
## General Workflow
1. Install `swig`. For Mac, do `brew install swig`; for Ubuntu, do `sudo apt-get install swig3.0`. Make sure your `swig` version is at least `3.0.10`. You'll also need `wget` to download files.
2. Go to `swig/Android` and build swig wrappers for Snowboy:
cd swig/Android
make
To make for ARMv8 64bit:
make BIT=64
Ths will generate a cross-compiled library for ARM:
jniLibs/
├── arm64-v8a
│   └── libsnowboy-detect-android.so
└── armeabi-v7a
└── libsnowboy-detect-android.so
and a few Java wrapper files:
java
└── ai
└── kitt
└── snowboy
├── SnowboyDetect.java
├── snowboy.java
└── snowboyJNI.java
The generated `.so` and `.java` files are hyperlinked to the `examples/Android/SnowboyAlexaDemo` folder.
3. Use Android Studio to open the project in `examples/Android/SnowboyAlexaDemo` and run it.
Screenshot (say "Alexa" after clicking "Start"):
<img src="https://s3-us-west-2.amazonaws.com/kittai-cdn/Snowboy/SnowboyAlexaDemo-Andriod.jpeg" alt="Android Alexa Demo" width=300 />
Don't forget to disable the "debug" option when releasing your Android App!
Note: If you need to copy the Android demo to another folder, please use the `-RL` option of `cp` to replace the relative symbol links with real files:
cp -RL SnowboyAlexaDemo Other_Folder
Note: The sample app will save/overwrite all audio to a file (`recording.pcm`). Make sure you do not leave it on for a long time.
## Useful Code Snippets
To initialize Snowboy detector in Java:
# Assume you put the model related files under /sdcard/snowboy/
SnowboyDetect snowboyDetector = new SnowboyDetect("/sdcard/snowboy/common.res",
"/sdcard/snowboy/snowboy.umdl");
snowboyDetector.SetSensitivity("0.45"); // Sensitivity for each hotword
snowboyDetector.SetAudioGain(2.0); // Audio gain for detection
To run hotword detection in Java:
int result = snowboyDetector.RunDetection(buffer, buffer.length); // buffer is a short array.
You may want to play with the frequency of the calls to `RunDetection()`, which controls the CPU usage and the detection latency.
## Common Asks
The following issues have been fixed pushed to `master`.
- [x] softfloating point support with OpenBlas
- [x] upgrade NDK version to newer than r11c
- [x] NDK toolchain building: remove `--stl=libc++` option

@ -1,9 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="output" path="bin/classes"/>
</classpath>

@ -1,14 +0,0 @@
*.iml
.gradle
/local.properties
/.idea/workspace.xml
/.idea/libraries
.DS_Store
/build
/captures
.externalNativeBuild
*.apk
*.ap_
.metadata/
.idea/workspace.xml
.idea/tasks.xml

@ -1,22 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<resourceExtensions />
<wildcardResourcePatterns>
<entry name="!?*.java" />
<entry name="!?*.form" />
<entry name="!?*.class" />
<entry name="!?*.groovy" />
<entry name="!?*.scala" />
<entry name="!?*.flex" />
<entry name="!?*.kt" />
<entry name="!?*.clj" />
<entry name="!?*.aj" />
</wildcardResourcePatterns>
<annotationProcessing>
<profile default="true" name="Default" enabled="false">
<processorPath useClasspath="true" />
</profile>
</annotationProcessing>
</component>
</project>

@ -1,3 +0,0 @@
<component name="CopyrightManager">
<settings default="" />
</component>

@ -1,9 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding">
<file url="file://$PROJECT_DIR$/src/ai/kitt/snowboy/Demo.java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/src/ai/kitt/snowboy/audio/AudioDataSaver.java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/src/ai/kitt/snowboy/audio/RecordingThread.java" charset="UTF-8" />
<file url="PROJECT" charset="ISO-8859-1" />
</component>
</project>

@ -1,17 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
</set>
</option>
<option name="resolveModulePerSourceSet" value="false" />
</GradleProjectSettings>
</option>
</component>
</project>

@ -1,46 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="EntryPointsManager">
<entry_points version="2.0" />
</component>
<component name="NullableNotNullManager">
<option name="myDefaultNullable" value="android.support.annotation.Nullable" />
<option name="myDefaultNotNull" value="android.support.annotation.NonNull" />
<option name="myNullables">
<value>
<list size="4">
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" />
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nullable" />
<item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.Nullable" />
<item index="3" class="java.lang.String" itemvalue="android.support.annotation.Nullable" />
</list>
</value>
</option>
<option name="myNotNulls">
<value>
<list size="4">
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" />
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nonnull" />
<item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" />
<item index="3" class="java.lang.String" itemvalue="android.support.annotation.NonNull" />
</list>
</value>
</option>
</component>
<component name="ProjectLevelVcsManager" settingsEditedManually="false">
<OptionsSetting value="true" id="Add" />
<OptionsSetting value="true" id="Remove" />
<OptionsSetting value="true" id="Checkout" />
<OptionsSetting value="true" id="Update" />
<OptionsSetting value="true" id="Status" />
<OptionsSetting value="true" id="Edit" />
<ConfirmationsSetting value="0" id="Add" />
<ConfirmationsSetting value="0" id="Remove" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">
<option name="id" value="Android" />
</component>
</project>

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/SnowboyAlexaDemo.iml" filepath="$PROJECT_DIR$/SnowboyAlexaDemo.iml" />
</modules>
</component>
</project>

@ -1,12 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RunConfigurationProducerService">
<option name="ignoredProducers">
<set>
<option value="org.jetbrains.plugins.gradle.execution.test.runner.AllInPackageGradleConfigurationProducer" />
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestClassGradleConfigurationProducer" />
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestMethodGradleConfigurationProducer" />
</set>
</option>
</component>
</project>

@ -1,33 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>Alexa19</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.android.ide.eclipse.adt.ApkBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>com.android.ide.eclipse.adt.AndroidNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

@ -1,20 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
android:versionCode="1"
android:versionName="1.0" package="ai.kitt.snowboy.demo" >
<application android:label="@string/app_name" android:icon="@mipmap/ic_launcher">
<activity android:name="ai.kitt.snowboy.Demo"
android:windowSoftInputMode="stateHidden"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<uses-sdk android:minSdkVersion="3" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"></uses-permission>
<uses-permission android:name="android.permission.RECORD_AUDIO"></uses-permission>
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
</manifest>

@ -1 +0,0 @@
../../../../../resources/alexa/alexa-avs-sample-app/alexa.umdl

@ -1,52 +0,0 @@
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.0'
}
}
apply plugin: 'android'
dependencies {
compile fileTree(include: '*.jar', dir: 'libs')
}
android {
signingConfigs {
}
compileSdkVersion 25
buildToolsVersion '25.0.0'
compileOptions.encoding = 'ISO-8859-1'
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
// Move the tests to tests/java, tests/res, etc...
instrumentTest.setRoot('tests')
// Move the build types to build-types/<type>
// For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
// This moves them out of them default location under src/<type>/... which would
// conflict with src/ being used by the main source set.
// Adding new build types or product flavors should be accompanied
// by a similar customization.
debug.setRoot('build-types/debug')
release.setRoot('build-types/release')
}
buildTypes {
release {
}
}
defaultConfig {
}
productFlavors {
}
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save