使用openai-fm生成语音的步骤如下:
- Getting the API key:首先需要在OpenAI官网注册/登录账户,在API密钥管理页面创建并保存OPENAI_API_KEY
- 安装项目:克隆GitHub仓库(
git clone https://github.com/openai/openai-fm.git
),进入项目目录并安装依赖(npm install
) - Configuring Environment Variables:可通过系统环境变量或项目内的.env文件设置API密钥
- Initiation of projects: Run
npm run dev
Start the development server and access thehttp://localhost:3000
- input text:在网页界面输入要转换的文本,支持多行文本输入
- 选择音色和风格:从下拉菜单中选择语音类型和情感风格
- 生成和播放:点击生成按钮调用API,生成后会自动播放,也可以下载WAV格式文件
如需使用分享功能,还需配置PostgreSQL数据库连接。整个过程简单直观,适合开发者快速测试和体验。
This answer comes from the articleOpenAI.fm: an interactive demo tool showcasing the OpenAI speech APIsThe