第三篇:ASR(Automatic Speech Recognition)语音识别
ASR(Automatic Speech Recognition)语音识别:
https://ai.baidu.com/docs#/ASR-Online-Python-SDK/top
第三方模块:pip install baidu-aip
ASR_test.py
from aip import AipSpeech
import os """ 你的 APPID AK SK """
APP_ID = ''
API_KEY = 'jM4b8GIG9gzrzySTRq3szK2E'
SECRET_KEY = 'iE626cEpjT1iAVwh24XV5h1QFuR8FPD2' client = AipSpeech(APP_ID, API_KEY, SECRET_KEY) # 读取文件
def get_file_content(filePath): #文件格式转换成pcm(前提是需要安装ffmpeg软件并配置环境变量)
pcm_filePath = filePath.split('.')[0] + '.pcm'
cmd_str=f'ffmpeg -y -i {filePath} -acodec pcm_s16le -f s16le -ac 1 -ar 16000 {pcm_filePath}'
os.system(cmd_str)#调用os.system()在CMD执行命令
filePath=pcm_filePath with open(filePath, 'rb') as fp:
return fp.read() # 识别本地文件
result=client.asr(get_file_content('1.m4a'), 'pcm', 16000, {
'dev_pid': 1536,
})
text=result.get('result')[0] print(result) print(text) '''
asr函数需要四个参数,第四个参数可以忽略,自有默认值,参照一下这些参数是做什么的 第一个参数: speech 音频文件流 建立包含语音内容的Buffer对象, 语音文件的格式,pcm 或者 wav 或者 amr。(虽说支持这么多格式,但是只有pcm的支持是最好的) 第二个参数: format 文件的格式,包括pcm(不压缩)、wav、amr (虽说支持这么多格式,但是只有pcm的支持是最好的) 第三个参数: rate 音频文件采样率 如果使用刚刚的FFmpeg的命令转换的,你的pcm文件就是16000 第四个参数: dev_pid 音频文件语言id 默认1537(普通话 输入法模型)
'''
原始语音文件
通过windows10自带的<录音机>进行录制等,转换成语音识别推荐格式pcm
,最后识别输出文字
第三篇:ASR(Automatic Speech Recognition)语音识别的更多相关文章
- 论文翻译:2015_DNN-Based Speech Bandwidth Expansion and Its Application to Adding High-Frequency Missing Features for Automatic Speech Recognition of Narrowband Speech
论文地址:基于DNN的语音带宽扩展及其在窄带语音自动识别中加入高频缺失特征的应用 论文代码:github 博客作者:凌逆战 博客地址:https://www.cnblogs.com/LXP-Never ...
- 论文阅读笔记“Attention-based Audio-Visual Fusion for Rubust Automatic Speech recognition”
关于论文的阅读笔记 论文的题目是“Attention-based Audio-Visual Fusion for Rubust Automatic Speech recognition”,翻译成中文为 ...
- A Bayesian Approach to Deep Neural Network Adaptation with Applications to Robust Automatic Speech Recognition
基于贝叶斯的深度神经网络自适应及其在鲁棒自动语音识别中的应用 直接贝叶斯DNN自适应 使用高斯先验对DNN进行MAP自适应 为何贝叶斯在模型自适应中很有用? 因为自适应问题可以视为后验估计问题 ...
- C#的语音识别 using System.Speech.Recognition;
using System; using System.Collections.Generic; using System.Linq; using System.Speech.Recognition; ...
- FPGA 17最佳论文导读 ESE: Efficient Speech Recognition Engine with Compressed LSTM on FPGA
欢迎转载,转载请注明:本文出自Bin的专栏blog.csdn.net/xbinworld. 技术交流QQ群:433250724,欢迎对算法.机器学习技术感兴趣的同学加入. 后面陆续写一些关于神经网络加 ...
- 第三篇 :微信公众平台开发实战Java版之请求消息,响应消息以及事件消息类的封装
微信服务器和第三方服务器之间究竟是通过什么方式进行对话的? 下面,我们先看下图: 其实我们可以简单的理解: (1)首先,用户向微信服务器发送消息: (2)微信服务器接收到用户的消息处理之后,通过开发者 ...
- Utterance-Wise Recurrent Dropout And Iterative Speaker Adaptation For Robust Monaural Speech Recognition
单声道语音识别的逐句循环Dropout迭代说话人自适应 WRBN(wide residual BLSTM network,宽残差双向长短时记忆网络) [2] J. Heymann, L. Dr ...
- (三)Hololens Unity 开发之 语音识别
学习源于官方文档 Voice input in Unity 笔记一部分是直接翻译官方文档,部分各人理解不一致的和一些比较浅显的保留英文原文 (三)Hololens Unity 开发之 语音识别 Hol ...
- [翻译]Review——How to do Speech Recognition with Deep Learning
原文地址:https://medium.com/@ageitgey/machine-learning-is-fun-part-6-how-to-do-speech-recognition-with-d ...
随机推荐
- centos7.4挂载硬盘
场景:新网上买了台服务器,有个数据盘需要自己挂载 fdisk -l 能看见有一个85.9g的硬盘 然后mkfs -t ext4 /dev/sdb 格式化硬盘 mkdir /data新建data文件夹用 ...
- SpringBoot系列(十二)过滤器配置详解
SpringBoot(十二)过滤器详解 往期精彩推荐 SpringBoot系列(一)idea新建Springboot项目 SpringBoot系列(二)入门知识 springBoot系列(三)配置文件 ...
- Django 内置分页的简单使用
1, 文档 https://docs.djangoproject.com/en/1.11.1/topics/pagination/ 2,视图 from django.core.paginator im ...
- C++类的开发实战--班级成绩管理系统
#include<bits/stdc++.h> using namespace std; struct birth { int year,month,day; }; struct grad ...
- 图论--2-SAT--HDU/HDOJ 4115 Eliminate the Conflict
Problem Description Conflicts are everywhere in the world, from the young to the elderly, from famil ...
- CodeForces - 1245F Daniel and Spring Cleaning (数位DP)
While doing some spring cleaning, Daniel found an old calculator that he loves so much. However, it ...
- kafka-eagle监控kafka
最近想做一个kafka监控,本来准备用zabbix来监控的,需要重复造轮子,本来准备用kafka-Manager的,在GitHub上无意发现了kafka-eagle,看了官方介绍准备试一下..... ...
- Python基础02 变量
Python中的变量有两个特点: 1. 无需声明 a = 1 2. 不与类型绑定 a = 1 a = 'hello world' 变量名只是内存中具体对象的一个引用(reference). 对于 a ...
- linux多线程入门
linux下的多线程通过pthread实现,下面给个简单的例子. #include <stdio.h> #include <stdlib.h> #include <pth ...
- A. Guest From the Past(数学推式子)
\(n元,买塑料杯子a元,买玻璃杯子b元,但玻璃杯子用完后可以卖c元\) \(求最多买的杯子.\) \(---------------------------分割------------------- ...