如何将 wav 文件转换为 JSON 文件
How to convert a wav file to a JSON file
我有一个名为 student 的 WAV 文件,现在我想将其转换为文本并将该文本下载为 JSON 文件。
WAV 文件(音频)具有以下内容"Hello, I'm Michel. I am a student of Georgian college"
JSON文件需要将以上内容作为字符串。
基本上,将语音转换为文本。
很多语音识别软件都依赖HMM or Hidden Markov Model. This approach works on the assumption that a speech signal, when viewed on a short enough timescale (say, ten milliseconds), can be reasonably approximated as a stationary process - meaning, a process in which statistical properties do not change over time. The speech is divided into 10 mm fragments and is mapped to a vector of real numbers known as cepstral系数,然后将这些向量与音素进行匹配。这是对典型语音识别系统的非常高的概述。
现在,回到您的要求,稍作研究就会把您带到像这样的图书馆 -
现在使用 SpeechRecognition 就像(取自 源代码 并在我的电脑上试过)-
import speech_recognition as sr
from os import path
AUDIO_FILE = path.join(path.dirname(path.realpath(__file__)), "english.wav")
r = sr.Recognizer()
with sr.AudioFile(AUDIO_FILE) as source:
audio = r.record(source) # read the entire audio file
try:
print("Sphinx thinks you said " + r.recognize_sphinx(audio))
except sr.UnknownValueError:
print("Sphinx could not understand audio")
except sr.RequestError as e:
print("Sphinx error; {0}".format(e))
瞧,它在 10 行代码中起作用,这要归功于开发这些代码的了不起的人:)
编辑 - 您需要PocketSphinx设置此代码才能工作。
我有一个名为 student 的 WAV 文件,现在我想将其转换为文本并将该文本下载为 JSON 文件。
WAV 文件(音频)具有以下内容"Hello, I'm Michel. I am a student of Georgian college"
JSON文件需要将以上内容作为字符串。
基本上,将语音转换为文本。
很多语音识别软件都依赖HMM or Hidden Markov Model. This approach works on the assumption that a speech signal, when viewed on a short enough timescale (say, ten milliseconds), can be reasonably approximated as a stationary process - meaning, a process in which statistical properties do not change over time. The speech is divided into 10 mm fragments and is mapped to a vector of real numbers known as cepstral系数,然后将这些向量与音素进行匹配。这是对典型语音识别系统的非常高的概述。
现在,回到您的要求,稍作研究就会把您带到像这样的图书馆 -
现在使用 SpeechRecognition 就像(取自 源代码 并在我的电脑上试过)-
import speech_recognition as sr
from os import path
AUDIO_FILE = path.join(path.dirname(path.realpath(__file__)), "english.wav")
r = sr.Recognizer()
with sr.AudioFile(AUDIO_FILE) as source:
audio = r.record(source) # read the entire audio file
try:
print("Sphinx thinks you said " + r.recognize_sphinx(audio))
except sr.UnknownValueError:
print("Sphinx could not understand audio")
except sr.RequestError as e:
print("Sphinx error; {0}".format(e))
瞧,它在 10 行代码中起作用,这要归功于开发这些代码的了不起的人:)
编辑 - 您需要PocketSphinx设置此代码才能工作。