如何使用网络音频 api 获取原始 pcm 音频? [英] How to use web audio api to get raw pcm audio?

查看:38
本文介绍了如何使用网络音频 api 获取原始 pcm 音频?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

usergetmedia 如何在 chrome 中使用麦克风然后流式传输以获取原始音频?我需要获得线性 16 的音频.

How usergetmedia to use the microphone in chrome and then stream to get raw audio? I need need to get the audio in linear 16.

推荐答案

我发现的唯一两个清晰且有意义的示例如下:

The only two examples I've found that are clear and make sense are the following:

AWS 实验室:https://github.com/awslabs/aws-lex-browser-audio-capture/blob/master/lib/worker.js

AWS 资源非常好.它向您展示了如何将录制的音频导出为编码为 PCM 的 WAV 格式".Amazon Lex 是 AWS 提供的一项转录服务,要求音频经过 PCM 编码并包装在 WAV 容器中.您只需修改一些代码即可使其适合您!AWS 有一些附加功能,例如下采样",它允许您在不影响录制的情况下更改采样率.

The AWS resource is very good. It shows you how to export your recorded audio to "WAV format encoded as PCM". Amazon Lex, which is a transcription service offered by AWS requires the audio to be PCM encoded and wrapped in a WAV container. You can merely adapt some of the code to make it work for you! AWS has some additional features such as "downsampling" which allows you to change the sample rate without affecting the recording.

RecordRTC:https://github.com/muaz-khan/RecordRTC/blob/master/simple-demos/raw-pcm.html

RecordRTC 是一个完整的库.您可以再次调整他们的代码或找到将音频编码为原始 PCM 的代码片段.您还可以实现他们的库并按原样使用代码.将此库的音频配置使用desiredSampleRate"选项会对录音产生负面影响.

RecordRTC is a complete library. You can, once again, adapt their code or find the snippet of code that encodes the audio to raw PCM. You could also implement their library and use the code as-is. Using the "desiredSampleRate" option for audio config with this library negatively affects the recording.

它们都是极好的资源,您一定能够解决您的问题.

They are both excellent resources and you'll definitely be able to solve your question.

这篇关于如何使用网络音频 api 获取原始 pcm 音频?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆