前往 WaytoAGI 飞书知识库 · 1 亿+ 次访问的开源 AI 知识库 →
通往 AGI 之路 WaytoAGI

知识库 · 数字人与语音合成

语音转文本,文本转语音:OpenAI 发布了 2 套新模型,1 个新网站

OpenAI 凌晨发布 gpt-4o-transcribe、gpt-4o-mini-transcribe 两大 STT 模型及 gpt-4o-mini-tts 模型,同时上线语音调试网站 OpenAI.fm。新 STT 模型在价格、口音、噪音处理上均优于 Whisper。

OpenAI人工智能语音识别语音合成

🔗 原文链接: https://mp.weixin.qq.com/s/YlVUmj6F...

原创 金色传说大聪明 赛博禅心 2025年03月21日 03:11 北京

凌晨 1 点的时候,OpenAI 突然做了三项发布:

  • 语音转文本(STT)模型

  • 文本转语音(TTS)模型

  • 一个体验网站:OpenAI.fm

结论前置:

不大的发布,实用的东西,不错的 PlayGround

剩下的,容我逐个道来。


语音转文本(STT)模型

两款模型: gpt-4o-transcribe 和 gpt-4o-mini-transcribe , 比之前的 Whisper 价格更优,性能更好 ,尤其在处理口音、噪音和不同语速方面表现更佳。

先是价格对比

  • Whisper: ~ $0.006/min

  • gpt-4o-transcribe: ~ $0.006/min

  • gpt-4o-mini-transcribe: ~ $0.003/min

再是错误率对比(越低越好)

对比自家的 Whisper

对比竞品模型

这俩 endpoint,一个是 transcriptions ,另一个是 translations ,同样可以用于新模型。前者是纯转文字,简单调用起来是这样:

from openai import OpenAI
client = OpenAI()

audio_file = open("/path/to/file/audio.mp3", "rb")
transcription = client.audio.transcriptions.create(
  model="whisper-1", 
  file=audio_file
)

print(transcription.text)

后者是转文字+翻译(仅限翻译成英文),调用大概这样。

from openai import OpenAI
client = OpenAI()

audio_file = open("/path/to/file/speech.mp3", "rb")
transcription = client.audio.transcriptions.create(
  model="whisper-1", 
  file=audio_file, 
  response_format="text"
)

print(transcription.text)

剩下的,是一些接口参数更新:

  • 时间戳 (Timestamps) :通过设置 timestamp_granularities 参数,可以获取带有时间戳的 JSON 输出,精确到句子片段或单词级别。

  • 流式转录 (Streaming transcriptions) :通过设置 stream=True ,可以在模型完成音频片段的转录后立即接收到 transcript.text.delta 事件,最终会收到包含完整转录的 transcript.text.done 事件。

  • 实时 API (Realtime API) :对于正在进行的音频流(例如实时会议或语音输入),可以通过 WebSocket 连接实时发送音频数据并接收转录事件。

详细文档:

https://platform.openai.com/docs/guides/speech-to-text


语音转文本(TTS)模型

模型名称是 gpt-4o-mini-tts 可控性很强 的 TTS:

  • 可以指定要说的内容,如:“我是练习时长两年半的个人练习生”

  • 可以指定说话的风格,如:“用娇滴滴的语气”

中文示例

英文示例

我个人感觉效果不是很好 (但可以 roll 点音色);

长度方面,最大支持 2000 token 的内容;

价格方面,是 $0.015/min,示例代码如下:

import asyncio

from openai import AsyncOpenAI
from openai.helpers import LocalAudioPlayer

openai = AsyncOpenAI()

input = """大家好,我是练习时长两年半的个人练习生,你坤坤,喜欢唱、跳、Rap和篮球,music~\n\n在今后的节目中,有我很多作词,作曲,编舞的原创作品,期待的话多多投票吧!"""

instructions = """用娇滴滴的语气,萝莉音"""

asyncdefmain() -> None:

    asyncwith openai.audio.speech.with_streaming_response.create(
        model="gpt-4o-mini-tts",
        voice="alloy",
        input=input,
        instructions=instructions,
        response_format="pcm",
    ) as response:
        await LocalAudioPlayer().play(response)

if __name__ == "__main__":
    asyncio.run(main())

详细文档:

https://platform.openai.com/docs/guides/text-to-speech


新网站:OpenAI.fm

这是一个调试语音的 PlayGround,挺好玩的

关闭

观看更多

更多

退出全屏

切换到横屏模式

🎦 点击观看视频

无法获取音频链接

视频详情

还可以在右上角,一键导出代码


结论

不大的发布,实用的东西:

  • STT 很实用,Whisper 可以退役了

  • TTS 效果一般,不推荐用

  • PlayGround 的设计很不错,代码导出很方便