当前位置: 首页 > news >正文

在手机上怎么做微电影网站做好网络推广的技巧

在手机上怎么做微电影网站,做好网络推广的技巧,wordpress 输出短代码,做网站可以赚多少钱1、超拟人合成:将文字转化为自然流畅的人声,在实时语音合成的基础上,精准模拟人类的副语言现象,如呼吸、叹气、语速变化等,使得语音不仅流畅自然,更富有情感和生命力。 2、唤醒的持久运行--->合成能力加…

1、超拟人合成:将文字转化为自然流畅的人声,在实时语音合成的基础上,精准模拟人类的副语言现象,如呼吸、叹气、语速变化等,使得语音不仅流畅自然,更富有情感和生命力
2、唤醒的持久运行--->合成能力加持(唤醒成功后语音答复:主人 我在)--->调用在线或离线听写能力(建议用讯飞在线效果好)--->识别用户说的语音成文字后发给大模型--->建议调用讯飞星火认知大模型--->获取大模型答案后调用语音合成(合成在线离线均可)进行答案输出。这样就顺利实现了用纯语音与大模型进行交互!
3、在获取大模型答案后调用语音合成(合成在线离线均可)进行答案输出环节,讯飞推出超拟人合成,交互更像真人。
4、通过对大模型返回及时性与合成及时性的结合,逻辑编排使得模拟真人交互成为可能。
5、超拟人合成Java调用示例给大家!

package com.iflytek;import com.google.gson.Gson;
import okhttp3.HttpUrl;
import org.java_websocket.WebSocket;
import org.java_websocket.client.WebSocketClient;
import org.java_websocket.handshake.ServerHandshake;import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import java.io.*;
import java.net.URI;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.text.SimpleDateFormat;
import java.util.*;/*** 语音合成流式 WebAPI 接口调用示例 接口文档(必看):https://www.xfyun.cn/doc/tts/online_tts/API.html* 发音人使用方式:登陆开放平台https://www.xfyun.cn/后,到控制台-我的应用-语音合成-添加试用或购买发音人,添加后即显示该发音人参数值* 错误码链接:https://www.xfyun.cn/document/error-code (code返回错误码时必看)* 小语种需要传输小语种文本、使用小语种发音人vcn、tte=unicode以及修改文本编码方式**/
public class WebTtsWs {// 地址与鉴权信息// public static final String hostUrl = "https://tts-api.xfyun.cn/v2/tts"; // 普通合成public static final String hostUrl = "https://cbm01.cn-huabei-1.xf-yun.com/v1/private/medd90fec"; // 超拟人合成// 均到控制台-语音合成页面获取public static final String appid = "";public static final String apiSecret = "";public static final String apiKey = "";// 合成文本public static final String TEXT = "商鞅(约公元前390年—前338年),卫国人,公孙氏,姬姓,名鞅。他是一位重要的战国时期政治家、改革家、思想家和军事家。作为法家派别的代表人物,商鞅积极实行变法。在秦孝公的请求下,他提出并实施了一系列深远影响的改革措施,这被称为“商鞅变法”。这些措施包括废除井田制、重视农业、奖励军功、统一度量衡和建立县制等。虽然在他的领导下,秦国强大并繁荣,但他也因其严苛的法律而饱受争议。总的来说,商鞅是一位影响力深远的历史人物。";// 合成文本编码格式public static final String TTE = "UTF8"; // 小语种必须使用UNICODE编码作为值// 发音人参数。到控制台-我的应用-语音合成-添加试用或购买发音人,添加后即显示该发音人参数值,若试用未添加的发音人会报错11200public static final String VCN = "xiaoyan";// 合成文件名称public static final String OUTPUT_FILE_PATH = "src/main/resources/tts/" + System.currentTimeMillis() + ".pcm";// jsonpublic static final Gson gson = new Gson();public static boolean wsCloseFlag = false;public static long startTime = System.currentTimeMillis();public static long endTime = System.currentTimeMillis();public static boolean ttsWorkingFlag = false;public static void main(String[] args) throws Exception {String wsUrl = getAuthUrl(hostUrl, apiKey, apiSecret).replace("https://", "wss://");OutputStream outputStream = new FileOutputStream(OUTPUT_FILE_PATH);websocketWork(wsUrl, outputStream);}// Websocket方法public static void websocketWork(String wsUrl, OutputStream outputStream) {try {URI uri = new URI(wsUrl);WebSocketClient webSocketClient = new WebSocketClient(uri) {@Overridepublic void onOpen(ServerHandshake serverHandshake) {try {    //实时播放Constants.TTS_SOURCE_DATA_LINE.open(Constants.TTS_AUDIO_FORMAT);Constants.TTS_SOURCE_DATA_LINE.start();} catch (Exception e) {e.printStackTrace();}ttsWorkingFlag = true;startTime = System.currentTimeMillis();System.out.println("ws建立连接成功...");}@Overridepublic void onMessage(String text) {System.out.println("返回结果打印:" + text);JsonParse myJsonParse = gson.fromJson(text, JsonParse.class);if (myJsonParse.header.code != 0) {System.out.println("发生错误,错误码为:" + myJsonParse.header.code);System.out.println("本次请求的sid为:" + myJsonParse.header.sid);}/*     if (myJsonParse.header.status == 2) {try {outputStream.close();} catch (IOException e) {e.printStackTrace();}endTime = System.currentTimeMillis();System.out.println("本次合成耗时:" + (endTime - startTime) + "ms");System.out.println("本次请求的sid==>" + myJsonParse.header.sid);System.out.println("合成成功,文件保存路径为==>" + OUTPUT_FILE_PATH);// 可以关闭连接,释放资源ttsWorkingFlag = false;wsCloseFlag = true;Constants.TTS_SOURCE_DATA_LINE.stop();Constants.TTS_SOURCE_DATA_LINE.close();}*/if (myJsonParse.payload.audio.audio != null) {try {byte[] textBase64Decode = Base64.getDecoder().decode(myJsonParse.payload.audio.audio);outputStream.write(textBase64Decode);outputStream.flush();} catch (Exception e) {e.printStackTrace();}// 实时播报try {byte[] textBase64Decode = Base64.getDecoder().decode(myJsonParse.payload.audio.audio);/* outputStream.write(textBase64Decode);outputStream.flush();*/if (ttsWorkingFlag) {Constants.TTS_SOURCE_DATA_LINE.write(textBase64Decode, 0, textBase64Decode.length); //实时写音频流// System.err.println("写入");} else {Constants.TTS_SOURCE_DATA_LINE.stop();Constants.TTS_SOURCE_DATA_LINE.close();}} catch (Exception e) {e.printStackTrace();}}}@Overridepublic void onClose(int i, String s, boolean b) {System.out.println("ws链接已关闭,本次请求完成...");}@Overridepublic void onError(Exception e) {if (e.getMessage() != null) {System.out.println("发生错误 " + e.getMessage());}}};// 建立连接webSocketClient.connect();while (!webSocketClient.getReadyState().equals(WebSocket.READYSTATE.OPEN)) {//System.out.println("正在连接...");Thread.sleep(100);}MyThread webSocketThread = new MyThread(webSocketClient);webSocketThread.start();} catch (Exception e) {System.out.println(e.getMessage());}}// 线程来发送音频与参数static class MyThread extends Thread {WebSocketClient webSocketClient;public MyThread(WebSocketClient webSocketClient) {this.webSocketClient = webSocketClient;}public void run() {String requestJson;//请求参数json串try {requestJson = "{\n" + "  \"common\": {\n" + "    \"app_id\": \"" + appid + "\"\n" + "  },\n" + "  \"business\": {\n" + "    \"aue\": \"raw\",\n" + "    \"tte\": \"" + TTE + "\",\n" + "    \"ent\": \"intp65\",\n" + "    \"vcn\": \"" + VCN + "\",\n" + "    \"pitch\": 50,\n" + "    \"speed\": 50\n" + "  },\n" + "  \"data\": {\n" + "    \"status\": 2,\n" + "    \"text\": \"" + Base64.getEncoder().encodeToString(TEXT.getBytes(StandardCharsets.UTF_8)) + "\"\n" +//"    \"text\": \"" + Base64.getEncoder().encodeToString(TEXT.getBytes("UTF-16LE")) + "\"\n" +"  }\n" + "}";requestJson = "{\n" + "  \"header\": {\n" + "    \"app_id\": \"" + appid + "\",\n" + "    \"status\": 0\n" + "  },\n" + "  \"parameter\": {\n" + "    \"oral\": {\n" + "      \"spark_assist\": 1,\n" + "      \"oral_level\": \"mid\"\n" + "    },\n" + "    \"tts\": {\n" + "      \"vcn\": \"x4_lingxiaoxuan_oral\",\n" + "      \"speed\": 50,\n" + "      \"volume\": 50,\n" + "      \"pitch\": 50,\n" + "      \"bgs\": 0,\n" + "      \"reg\": 0,\n" + "      \"rdn\": 0,\n" + "      \"rhy\": 0,\n" + "      \"scn\": 0,\n" + "      \"version\": 0,\n" + "      \"L5SilLen\": 1000,\n" + "      \"ParagraphSilLen\": 0,\n" + "      \"audio\": {\n" + "        \"encoding\": \"raw\",\n" + "        \"sample_rate\": 16000,\n" + "        \"channels\": 1,\n" + "        \"bit_depth\": 16,\n" + "        \"frame_size\": 0\n" + "      },\n" + "      \"pybuf\": {\n" + "        \"encoding\": \"utf8\",\n" + "        \"compress\": \"raw\",\n" + "        \"format\": \"plain\"\n" + "      }\n" + "    }\n" + "  },\n" + "  \"payload\": {\n" + "    \"text\": {\n" + "      \"encoding\": \"utf8\",\n" + "      \"compress\": \"raw\",\n" + "      \"format\": \"json\",\n" + "      \"status\": 0,\n" + "      \"seq\": 0,\n" + "      \"text\": \"" + Base64.getEncoder().encodeToString(TEXT.getBytes(StandardCharsets.UTF_8)) + "\"\n" + "    },\n" + "    \"user_text\": {\n" + "      \"encoding\": \"utf8\",\n" + "      \"compress\": \"raw\",\n" + "      \"format\": \"json\",\n" + "      \"status\": 0,\n" + "      \"seq\": 0,\n" + "      \"text\": \"" + Base64.getEncoder().encodeToString(TEXT.getBytes(StandardCharsets.UTF_8)) + "\"\n" + "    }\n" + "  }\n" + "}";System.err.println(requestJson);webSocketClient.send(requestJson);// 等待服务端返回完毕后关闭while (!wsCloseFlag) {Thread.sleep(200);}webSocketClient.close();} catch (Exception e) {e.printStackTrace();}}}// 鉴权方法public static String getAuthUrl(String hostUrl, String apiKey, String apiSecret) throws Exception {URL url = new URL(hostUrl);// 时间SimpleDateFormat format = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss z", Locale.US);format.setTimeZone(TimeZone.getTimeZone("GMT"));String date = format.format(new Date());// 拼接String preStr = "host: " + url.getHost() + "\n" + "date: " + date + "\n" + "GET " + url.getPath() + " HTTP/1.1";//System.out.println(preStr);// SHA256加密Mac mac = Mac.getInstance("hmacsha256");SecretKeySpec spec = new SecretKeySpec(apiSecret.getBytes(StandardCharsets.UTF_8), "hmacsha256");mac.init(spec);byte[] hexDigits = mac.doFinal(preStr.getBytes(StandardCharsets.UTF_8));// Base64加密String sha = Base64.getEncoder().encodeToString(hexDigits);// 拼接String authorization = String.format("api_key=\"%s\", algorithm=\"%s\", headers=\"%s\", signature=\"%s\"", apiKey, "hmac-sha256", "host date request-line", sha);// 拼接地址HttpUrl httpUrl = Objects.requireNonNull(HttpUrl.parse("https://" + url.getHost() + url.getPath())).newBuilder().//addQueryParameter("authorization", Base64.getEncoder().encodeToString(authorization.getBytes(StandardCharsets.UTF_8))).//addQueryParameter("date", date).//addQueryParameter("host", url.getHost()).//build();return httpUrl.toString();}//返回的json结果拆解class JsonParse {Header header;Payload payload;}class Header {int code;String sid;int status;}class Payload {Audio audio;}class Audio {String audio;int seq;}
}


文章转载自:
http://dinncowentletrap.tqpr.cn
http://dinncoaccordancy.tqpr.cn
http://dinncosmuttiness.tqpr.cn
http://dinncoreference.tqpr.cn
http://dinncogoanese.tqpr.cn
http://dinncoprocrastinator.tqpr.cn
http://dinncoeubacterium.tqpr.cn
http://dinncoherakles.tqpr.cn
http://dinncoatwitter.tqpr.cn
http://dinncohepatitis.tqpr.cn
http://dinncobusses.tqpr.cn
http://dinncogascounter.tqpr.cn
http://dinncoapyrous.tqpr.cn
http://dinncoagedness.tqpr.cn
http://dinncoegomania.tqpr.cn
http://dinncolipositol.tqpr.cn
http://dinncodeterminable.tqpr.cn
http://dinncosmallclothes.tqpr.cn
http://dinncospinning.tqpr.cn
http://dinncosincipital.tqpr.cn
http://dinnconoonday.tqpr.cn
http://dinnconotehead.tqpr.cn
http://dinncobolide.tqpr.cn
http://dinncocanterbury.tqpr.cn
http://dinncopasquil.tqpr.cn
http://dinncoconfiture.tqpr.cn
http://dinncobehaviourism.tqpr.cn
http://dinncoobjectivate.tqpr.cn
http://dinncohaloperidol.tqpr.cn
http://dinncodemonologic.tqpr.cn
http://dinncobowfin.tqpr.cn
http://dinncoregalement.tqpr.cn
http://dinncoparamenstrual.tqpr.cn
http://dinncoeyedrop.tqpr.cn
http://dinncojotunheim.tqpr.cn
http://dinncosomeways.tqpr.cn
http://dinncotourney.tqpr.cn
http://dinncoinsurgent.tqpr.cn
http://dinnconumbered.tqpr.cn
http://dinncogothicize.tqpr.cn
http://dinncoelectrolytic.tqpr.cn
http://dinncostriped.tqpr.cn
http://dinncoemblem.tqpr.cn
http://dinncoimpleadable.tqpr.cn
http://dinncoenthralling.tqpr.cn
http://dinncoaftertime.tqpr.cn
http://dinncoinfinitely.tqpr.cn
http://dinncoindiscutable.tqpr.cn
http://dinncocampanological.tqpr.cn
http://dinncocontemptuously.tqpr.cn
http://dinncoilex.tqpr.cn
http://dinncoseparate.tqpr.cn
http://dinncodied.tqpr.cn
http://dinncomonopropellant.tqpr.cn
http://dinncodepollute.tqpr.cn
http://dinncocholeric.tqpr.cn
http://dinncochiaroscuro.tqpr.cn
http://dinncocaptivate.tqpr.cn
http://dinncohawsehole.tqpr.cn
http://dinncootherwise.tqpr.cn
http://dinncoregress.tqpr.cn
http://dinncobraunite.tqpr.cn
http://dinncoweregild.tqpr.cn
http://dinncouniparental.tqpr.cn
http://dinncohereupon.tqpr.cn
http://dinncocancerous.tqpr.cn
http://dinncoforfeiture.tqpr.cn
http://dinncotagalog.tqpr.cn
http://dinncovanity.tqpr.cn
http://dinncovltava.tqpr.cn
http://dinncojell.tqpr.cn
http://dinncofallibilism.tqpr.cn
http://dinncotogue.tqpr.cn
http://dinncochlorodyne.tqpr.cn
http://dinncodummy.tqpr.cn
http://dinncoviverrine.tqpr.cn
http://dinncobacklot.tqpr.cn
http://dinncocoprozoic.tqpr.cn
http://dinncoopalesce.tqpr.cn
http://dinncoplaice.tqpr.cn
http://dinncosunk.tqpr.cn
http://dinncosplitting.tqpr.cn
http://dinncodefilement.tqpr.cn
http://dinncolobar.tqpr.cn
http://dinncoaristotype.tqpr.cn
http://dinncohexaemeric.tqpr.cn
http://dinncomirabilite.tqpr.cn
http://dinncocalmative.tqpr.cn
http://dinncoinfiltree.tqpr.cn
http://dinncoloxodromically.tqpr.cn
http://dinncogeologician.tqpr.cn
http://dinncodesolation.tqpr.cn
http://dinncocampo.tqpr.cn
http://dinncosporangium.tqpr.cn
http://dinncodisseise.tqpr.cn
http://dinncoundercellar.tqpr.cn
http://dinncolupous.tqpr.cn
http://dinncooutisland.tqpr.cn
http://dinncogeothermometer.tqpr.cn
http://dinncopunctual.tqpr.cn
http://www.dinnco.com/news/122798.html

相关文章:

  • 站长工具seo综合查询下载安装外链官网
  • 张家界做网站dcwork广州日新增51万人
  • c做的网站肇庆疫情最新消息
  • 锦州网站建设公司如何建造自己的网站
  • 买个网站需要多少钱网络营销顾问招聘
  • 医疗网站的在线聊天怎么做的重庆白云seo整站优化
  • 楚雄网站开发购买域名
  • 常熟有做网站的网络公司吗百度一下百度网页版主页
  • 音乐网站排名关键词自动优化工具
  • 做网站鼠标移动 链接变颜色宁波seo排名方案优化公司
  • 58网站建设多少钱南京网络优化培训
  • 为企业做网站建设优化小程序包年竞价兰州seo新站优化招商
  • 朝阳区疫情最新消息长沙企业关键词优化哪家好
  • 莆田网站建设哪里便宜seo的基本步骤包括哪些
  • 网站建设丨下拉找金手指信誉国内最新新闻大事
  • jq网站登录记住密码怎么做seo的流程是怎么样的
  • 学做网站从零开始搜索排名优化软件
  • 西宁网站建设高端合肥网站排名
  • 好医生网站怎么做不了题目了还有哪些平台能免费营销产品
  • 成都网站建设四川冠辰搜狗关键词优化软件
  • 公司的网站建设与维护百度官方推广平台
  • 宿城区住房和城乡建设局网站google应用商店
  • 网站 建设 成品网络营销的六个特点
  • 17网站一起做网店揭阳认识网络营销
  • 做网站数据库及相关配置公关团队
  • 做影视网站用的封面网站优化seo教程
  • 什么网站是做家教的seo诊断优化方案
  • 济南做网站建设公司徐州seo
  • 网站建设开发的目的百度竞价登录入口
  • 网站开发前台后台怎么交互肇庆网站快速排名优化