Git Product home page Git Product logo

listener's Introduction

树莓派谛听记录器: 声音监听记录器, 全天记录周围人说话的声音,并转成文字记录. 安装owncloud私有云盘,录音目录配置成云数据,用一般的智能手机就可以随时调出数据查看.

简介: 语音采集器,有效监听范围3-5米. 能监听到声音开始与结束, 当检测到有人说话时进入录音状态,直到检测到说话停止或达到最长录音时间. 调用百度服务进行语音文字转换,如果没有识别到人声,则丢弃此语音数据. 留存最近5句有识别出文字的原生wav录音.此功能涉及到声音隐私,可能在某些国家中使用是非法的. 代码是写着玩的,供练习用.代码在树莓派3B稳定运行半年以上无故障, 因为效果好,树莓派一直没关机 代码参考了 叮当——中文语音对话机器人里的代码,表示感谢 https://github.com/dingdang-robot/dingdang-robot

算法原理: 1.20秒声音队列,每1秒录一个声音片断,追加到先进先出的队列,无限循环 2.当识别到声音大于某个阀值时,记录下队列的索引位置,同时进入监听模式 3.监听模式下,如果连续两秒声音出现静音,或识别时间>10秒,则结束. 4.把索引位置到当前时间点的录音数据取出来,提交给百度进行识别, 此处的要点是:索引位置减2, 也就是多获取声音阀值前2秒的声音数据,而不是阀值开始的位置 5.如果识别到文字,则记录到log日志中, 同时将wav原始声音文件也放入循环目录备份(循环5个队列)

运行环境: 树莓派3B raspberrypi可稳定运行,半年不关机不会出故障. 但是在树莓派zero上运行1-2天后会发生采集录音数据异常,内存耗尽,进程被kill的现象,可能是因为zero内存只有512M,运行python代码时释放内存效果不好,未深究.

配置: 1.使用时需要修改 baidu_sound_rec.py 里面的这二个变量: api_key = "@@@@@@@@@@@@@@" api_secert = "@@@@@@@@@@@@@@"
2.识别出的说话内容(识别出的文字,最近5句原始wav声音文件)存在放 /myram/目录, 为减少文件经常读写损坏tf卡, 在/etc/rc.local时增加了如下语句将内存虚拟了10M成硬盘使用: sudo mount -t tmpfs -o size=10m,mode=0777 tmpfs /myram 也可以跳过此步骤,直接创建 /myram路径.

运行: python listener.py

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.