百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
S

speech2text

> 编程语言
开源

使用 Google 语音转文字 API 为音频文件提供简单的转换接口

361 stars0 点赞1 次浏览
访问官网GitHub

工具介绍

使用 Google 语音转文字 API 为音频文件提供简单的转换接口

= Speech2Text

Using the power of ffmpeg/flac/Google and ruby here is a simple interface to play with to convert speech to text.

Using a new undocumentd speech API from Google with the help of this article: http://mikepultz.com/2011/03/accessing-google-speech-api-chrome-11/

We're able to provide a very simple API in Ruby to decode simple audio to text.

The API from Google is not yet public and so may change. It also seems to be very fragile as more times than not it will return a 500, so the library has retry code built in - for larger audio files 10+ failures may return before a successful result is retrieved...

It also appears that the API only likes smaller audio files so there is a built in chunker that allows us to split the audio up into smaller chunks.

== Installation

Add this line to your application's Gemfile:

gem 'speech2text'

And then execute:

$ bundle

Or install it yourself as:

$ gem install speech2text

You must also install the ffmpeg utility on your local machine. If you are using OS X, the easiest way to do this is to install brew. You may need to instal XQuartz before installing ffmpeg:

$ ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"
# You may be prompted to install XQuartz. Get it at https://xquartz.macosforge.org
$ brew install ffmpeg

== Example

require 'speech'

audio = Speech::AudioToText.new("i-like-pickles.wav") puts audio.to_text.inspect => {"captured_json"=>[["I like pickles", 0.92731786]], "confidence"=>0.92731786}

== Command Line

speech2text i-like-pickles.wav cat i-like-pickles.json {"captured_json"=>[["I like pickles", 0.92731786]], "confidence"=>0.92731786}

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Ruby

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言