牙叔教程 简单易懂
为什么不用腾讯阿里讯飞的呢?
他们的中文也许还行, 但是英文我试了都不满意, 我再网上搜到的我认为最好的是
但是丫真贵 Best Free Text To Speech Voice Reader | Speechify
现在的汇率是
139 × 6.91 = 960.49
一年一千块, 好像还行哈, 但是没卡呀, 擦,
比来比去, 还是微软Azure性价比最高,
没有微软Azure的可以去某宝搜索Azure, 一般人也没卡, 你懂吧.
进入Azure首页
云计算服务 | Microsoft Azure
点击右上角登录按钮, 会进入这个页面
点击左上角的创建资源
点击AI + 机器学习, 里面的语音
带*号的都是必填的, 资源组没有的话就新建, 定价层我选的free
填完以后点击下一步
一直点击下一步下一步/ 创建
点击转到资源
记住底部的秘钥和终结点, 后期会用到, 点击 转到 Speech Studio
往下翻页, 就能找到 文本转语音了
你可以先试试语音库, 听一听音色, 选择自己喜欢的, 并记住名字
我选择托尼老师
聆听声音右侧有代码
在音色下方是后序步骤
点击 打开快速入门
选择你自己使用的语言
我选的是js
安装依赖
npm install microsoft-cognitiveservices-speech-sdk
复制黏贴代码
let config = require("./config.js"); console.log(config); (function () {var sdk = require("microsoft-cognitiveservices-speech-sdk");var readline = require("readline");var audioFile = "cool.mp3";// This example requires environment variables named "SPEECH_KEY" and "SPEECH_REGION"const speechConfig = sdk.SpeechConfig.fromSubscription(config.SPEECH_KEY, config.SPEECH_REGION);const audioConfig = sdk.AudioConfig.fromAudioFileOutput(audioFile);// The language of the voice that speaks.speechConfig.speechSynthesisVoiceName = "en-US-TonyNeural";// Create the speech synthesizer.var synthesizer = new sdk.SpeechSynthesizer(speechConfig, audioConfig);var rl = readline.createInterface({input: process.stdin,output: process.stdout,});rl.question("Enter some text that you want to speak >\n> ", function (text) {rl.close();// Start the synthesizer and wait for a result.synthesizer.speakTextAsync(text,function (result) {if (result.reason === sdk.ResultReason.SynthesizingAudioCompleted) {console.log("synthesis finished.");} else {console.error("Speech synthesis canceled, " + result.errorDetails + "\nDid you set the speech resource key and region values?");}synthesizer.close();synthesizer = null;},function (err) {console.trace("err - " + err);synthesizer.close();synthesizer = null;});console.log("Now synthesizing to: " + audioFile);}); })();
生成的音频文件叫cool.mp3, 里面就是文字转换好的语音
公众号 牙叔教程
这个ChatGPT星球有多牛逼 (yuque.com)