如何将mic音频输入转换为LINEAR16编码BASE64字符串 [英] How to convert mic audio input to LINEAR16 encoding BASE64 string
问题描述
我使用谷歌云语音API通过使用麦克风将语音转换为文本。我正在获取音频的arraybuffer,现在我需要在Javascript中将其转换为linear16编码base64字符串。请建议是否有任何可能的解决方案。
我尝试过:
在javascript中获取音频的arraybuffer。
I am using google cloud speech API to convert speech to text by using mic. I am getting the arraybuffer of audio, now I need to convert it to linear16 encoding base64 string in Javascript. Please suggest if any possible solution for this.
What I have tried:
getting arraybuffer of audio in javascript.
推荐答案
您可以在网站上找到的简单解决方案使用Google Speech API将语音从音频文件转换为文本。
困难的方法:你必须知道你的输入格式,而不是从它找到一个转换器到你的LINEAR16格式。有时,3个步骤的转换效果最好:
The easist solution you may find with the website Convert speech from an audio file to text using Google Speech API.
The hard way: you must know your input format and than find a converter from it to your LINEAR16 format. Sometimes a conversion in 3 steps for works best like:
Your input format => meta format (like PCM) => LINEAR16
因为你可能会找到一些转换器或代码。
在Javascript中使用as64字符串编码该字节缓冲区一块蛋糕,有人已经为你烘焙了。
because you may find some converter or code.
Encoding that byte buffer with as base64 string in Javascript is a piece of cake which somebody has already baked for you.
这篇关于如何将mic音频输入转换为LINEAR16编码BASE64字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!