Commit 8d5e9bb1 authored by 周亚武's avatar 周亚武

语音合成规则修改

parent 646e6d81
...@@ -161,6 +161,13 @@ ...@@ -161,6 +161,13 @@
<version>${pcap4j.version}</version> <version>${pcap4j.version}</version>
</dependency> </dependency>
<!--fileInputstream转file-->
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.11.0</version>
</dependency>
<!--Zxing 条形码二维码生成和解析工具--> <!--Zxing 条形码二维码生成和解析工具-->
<dependency> <dependency>
<groupId>com.google.zxing</groupId> <groupId>com.google.zxing</groupId>
......
...@@ -321,19 +321,19 @@ public class MainWindow { ...@@ -321,19 +321,19 @@ public class MainWindow {
// while (true){ while (true){
// try { try {
// Thread.sleep(2000); Thread.sleep(2000);
// } catch (InterruptedException e) { } catch (InterruptedException e) {
// throw new RuntimeException(e); throw new RuntimeException(e);
// } }
//
// FlowNumBean flowNumBean = new FlowNumBean(6, "A00"+(msgIndex%100), "010", "010", System.currentTimeMillis()); FlowNumBean flowNumBean = new FlowNumBean(6, "A00"+(msgIndex%100), "010", "010", System.currentTimeMillis());
// pushRabbitMsg("请"+flowNumBean.getFlownum()+"号到"+flowNumBean.getWindowfromnum()+"号窗口"); pushRabbitMsg("请"+flowNumBean.getFlownum()+"号到"+flowNumBean.getWindowfromnum()+"号窗口");
// test(flowNumBean); test(flowNumBean);
//
//
// } }
} }
private void initMQ(){ private void initMQ(){
...@@ -745,8 +745,8 @@ public class MainWindow { ...@@ -745,8 +745,8 @@ public class MainWindow {
try { try {
//语音拼接 //语音拼接
List<String> audioList = new ArrayList<>(); List<String> audioList = new ArrayList<>();
String englishPeople = System.getProperty("user.dir")+"/src/main/resources/sound/en/"; String englishPeople = "sound/en/";
String zangPeople = System.getProperty("user.dir")+"/src/main/resources/sound/zang/"; String zangPeople = "sound/zang/";
if(english){ //英双语 if(english){ //英双语
audioList.add(englishPeople+"qing.mp3"); audioList.add(englishPeople+"qing.mp3");
......
package com.mortals.xhx.tts.utils; package com.mortals.xhx.tts.utils;
import com.mortals.xhx.tts.UI.MainWindow;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
import org.aspectj.util.FileUtil; import org.aspectj.util.FileUtil;
import java.io.*; import java.io.*;
...@@ -18,10 +21,16 @@ public class SpliceMp3Util { ...@@ -18,10 +21,16 @@ public class SpliceMp3Util {
* *
*/ */
public static String fenLiData(String path) throws IOException { public static String fenLiData(String path) throws IOException {
File file = new File(path);// 原文件 ClassLoader classLoader = MainWindow.class.getClassLoader();
InputStream inputStream = classLoader.getResourceAsStream(path);
File tempFile = File.createTempFile("tmp", "mp3");
tempFile.deleteOnExit();
try (FileOutputStream out = new FileOutputStream(tempFile)) {
IOUtils.copy(inputStream, out);
}
File file1 = new File(path + "01");// 分离ID3V2后的文件,这是个中间文件,最后要被删除 File file1 = new File(path + "01");// 分离ID3V2后的文件,这是个中间文件,最后要被删除
File file2 = new File(path + "001");// 分离id3v1后的文件 File file2 = new File(path + "001");// 分离id3v1后的文件
RandomAccessFile rf = new RandomAccessFile(file, "rw");// 随机读取文件 RandomAccessFile rf = new RandomAccessFile(tempFile, "rw");// 随机读取文件
FileOutputStream fos = new FileOutputStream(file1); FileOutputStream fos = new FileOutputStream(file1);
byte ID3[] = new byte[3]; byte ID3[] = new byte[3];
rf.read(ID3); rf.read(ID3);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment