marytts.util.io.FileUtils.copy()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(9.2k)|赞(0)|评价(0)|浏览(145)

本文整理了Java中marytts.util.io.FileUtils.copy()方法的一些代码示例,展示了FileUtils.copy()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FileUtils.copy()方法的具体详情如下:
包路径:marytts.util.io.FileUtils
类名称:FileUtils
方法名:copy

FileUtils.copy介绍

暂无

代码示例

代码示例来源:origin: marytts/marytts

  1. /**
  2. * Sampling Rate Conversion doing with SOX.
  3. *
  4. * @param outpath
  5. * @param targetSamplingRate
  6. * @throws IOException
  7. */
  8. private void samplingRateConverter(String waveFile, int targetSamplingRate) throws IOException {
  9. Runtime rtime = Runtime.getRuntime();
  10. String soxCommandLine = soxPath + " " + waveFile + " -r " + targetSamplingRate + " tempOut.wav";
  11. Process process = rtime.exec(soxCommandLine);
  12. try {
  13. process.waitFor();
  14. } catch (InterruptedException e) {
  15. e.printStackTrace();
  16. }
  17. File outFile = new File("tempOut.wav");
  18. if (!outFile.renameTo(new File(waveFile)))
  19. FileUtils.copy(outFile.getAbsolutePath(), waveFile);
  20. }

代码示例来源:origin: marytts/marytts

  1. public static void copyFolderRecursive(String sourceFolder, String targetFolder, boolean bForceDeleteTarget)
  2. throws IOException {
  3. String fileSeparator = System.getProperty("file.separator");
  4. if (exists(sourceFolder)) {
  5. if (exists(targetFolder) && bForceDeleteTarget)
  6. delete(targetFolder);
  7. createDirectory(targetFolder);
  8. if (exists(targetFolder)) {
  9. String[] fileList = new File(sourceFolder).list();
  10. if (fileList != null) {
  11. for (int i = 0; i < fileList.length; i++) {
  12. if (!fileList[i].startsWith(".")) {
  13. String source = StringUtils.checkLastSlash(sourceFolder) + fileList[i];
  14. if (new File(source).isDirectory()) {
  15. String newTargetFolder = StringUtils.checkLastSlash(targetFolder) + fileList[i];
  16. copyFolderRecursive(source, newTargetFolder, bForceDeleteTarget);
  17. } else {
  18. String targetFile = StringUtils.checkLastSlash(targetFolder) + fileList[i];
  19. copy(source, targetFile);
  20. }
  21. }
  22. }
  23. }
  24. } else
  25. System.out.println("Could not create target folder!");
  26. } else
  27. System.out.println("Source folder does not exist!");
  28. }

代码示例来源:origin: marytts/marytts

  1. /**
  2. * Sampling Rate Conversion doing with SOX.
  3. *
  4. * @param outpath
  5. * @param targetSamplingRate
  6. * @throws IOException
  7. */
  8. private void samplingRateConverter(String waveFile, int targetSamplingRate) throws IOException {
  9. Runtime rtime = Runtime.getRuntime();
  10. String soxCommandLine = soxPath + " " + waveFile + " -r " + targetSamplingRate + " tempOut.wav";
  11. Process process = rtime.exec(soxCommandLine);
  12. try {
  13. process.waitFor();
  14. } catch (InterruptedException e) {
  15. e.printStackTrace();
  16. }
  17. File outFile = new File("tempOut.wav");
  18. if (!outFile.renameTo(new File(waveFile)))
  19. FileUtils.copy(outFile.getAbsolutePath(), waveFile);
  20. }

代码示例来源:origin: marytts/marytts

  1. public static void copyFolderRecursive(String sourceFolder, String targetFolder, boolean bForceDeleteTarget)
  2. throws IOException {
  3. String fileSeparator = System.getProperty("file.separator");
  4. if (exists(sourceFolder)) {
  5. if (exists(targetFolder) && bForceDeleteTarget)
  6. delete(targetFolder);
  7. createDirectory(targetFolder);
  8. if (exists(targetFolder)) {
  9. String[] fileList = new File(sourceFolder).list();
  10. if (fileList != null) {
  11. for (int i = 0; i < fileList.length; i++) {
  12. if (!fileList[i].startsWith(".")) {
  13. String source = StringUtils.checkLastSlash(sourceFolder) + fileList[i];
  14. if (new File(source).isDirectory()) {
  15. String newTargetFolder = StringUtils.checkLastSlash(targetFolder) + fileList[i];
  16. copyFolderRecursive(source, newTargetFolder, bForceDeleteTarget);
  17. } else {
  18. String targetFile = StringUtils.checkLastSlash(targetFolder) + fileList[i];
  19. copy(source, targetFile);
  20. }
  21. }
  22. }
  23. }
  24. } else
  25. System.out.println("Could not create target folder!");
  26. } else
  27. System.out.println("Source folder does not exist!");
  28. }

代码示例来源:origin: marytts/marytts

  1. private void trimSilences(File wavFile) throws UnsupportedAudioFileException, IOException {
  2. // We hard-code the values here. Use marytts.tools.voiceimport.EndpointDetector if you want to tune them.
  3. int energyBufferLength = 20;
  4. double speechStartLikelihood = 0.1;
  5. double speechEndLikelihood = 0.1;
  6. double shiftFromMinimumEnergyCenter = 0.0;
  7. int numClusters = 4;
  8. double minimumStartSilenceInSeconds = 0.5;
  9. double minimumEndSilenceInSeconds = 0.5;
  10. File tmpFile = new File("tmpAudio.wav");
  11. AudioConverterUtils.removeEndpoints(wavFile.getAbsolutePath(), tmpFile.getAbsolutePath(), energyBufferLength,
  12. speechStartLikelihood, speechEndLikelihood, shiftFromMinimumEnergyCenter, numClusters,
  13. minimumStartSilenceInSeconds, minimumEndSilenceInSeconds);
  14. if (!tmpFile.renameTo(wavFile))
  15. FileUtils.copy(tmpFile.getAbsolutePath(), wavFile.getAbsolutePath());
  16. }
  17. }

代码示例来源:origin: marytts/marytts

  1. private void trimSilences(File wavFile) throws UnsupportedAudioFileException, IOException {
  2. // We hard-code the values here. Use marytts.tools.voiceimport.EndpointDetector if you want to tune them.
  3. int energyBufferLength = 20;
  4. double speechStartLikelihood = 0.1;
  5. double speechEndLikelihood = 0.1;
  6. double shiftFromMinimumEnergyCenter = 0.0;
  7. int numClusters = 4;
  8. double minimumStartSilenceInSeconds = 0.5;
  9. double minimumEndSilenceInSeconds = 0.5;
  10. File tmpFile = new File("tmpAudio.wav");
  11. AudioConverterUtils.removeEndpoints(wavFile.getAbsolutePath(), tmpFile.getAbsolutePath(), energyBufferLength,
  12. speechStartLikelihood, speechEndLikelihood, shiftFromMinimumEnergyCenter, numClusters,
  13. minimumStartSilenceInSeconds, minimumEndSilenceInSeconds);
  14. if (!tmpFile.renameTo(wavFile))
  15. FileUtils.copy(tmpFile.getAbsolutePath(), wavFile.getAbsolutePath());
  16. }
  17. }

代码示例来源:origin: marytts/marytts

  1. if (FileUtils.exists(tmpFileIn)) {
  2. try {
  3. FileUtils.copy(tmpFileIn, tmpFileOut);
  4. } catch (IOException e) {
  5. if (FileUtils.exists(tmpFileIn)) {
  6. try {
  7. FileUtils.copy(tmpFileIn, tmpFileOut);
  8. } catch (IOException e) {
  9. if (FileUtils.exists(tmpFileIn)) {
  10. try {
  11. FileUtils.copy(tmpFileIn, tmpFileOut);
  12. } catch (IOException e) {
  13. if (FileUtils.exists(tmpFileIn)) {
  14. try {
  15. FileUtils.copy(tmpFileIn, tmpFileOut);
  16. } catch (IOException e) {

代码示例来源:origin: marytts/marytts

  1. if (FileUtils.exists(tmpFileIn)) {
  2. try {
  3. FileUtils.copy(tmpFileIn, tmpFileOut);
  4. } catch (IOException e) {
  5. if (FileUtils.exists(tmpFileIn)) {
  6. try {
  7. FileUtils.copy(tmpFileIn, tmpFileOut);
  8. } catch (IOException e) {
  9. if (FileUtils.exists(tmpFileIn)) {
  10. try {
  11. FileUtils.copy(tmpFileIn, tmpFileOut);
  12. } catch (IOException e) {
  13. if (FileUtils.exists(tmpFileIn)) {
  14. try {
  15. FileUtils.copy(tmpFileIn, tmpFileOut);
  16. } catch (IOException e) {

代码示例来源:origin: marytts/marytts

  1. public static void copyFolder(String sourceFolder, String targetFolder, boolean bForceDeleteTarget) throws IOException {
  2. if (exists(sourceFolder)) {
  3. if (exists(targetFolder) && bForceDeleteTarget)
  4. delete(targetFolder);
  5. createDirectory(targetFolder);
  6. if (exists(targetFolder)) {
  7. String[] fileList = FileUtils.getFileList(sourceFolder, "*.*");
  8. if (fileList != null) {
  9. for (int i = 0; i < fileList.length; i++) {
  10. String targetFile = StringUtils.checkLastSlash(targetFolder)
  11. + StringUtils.getFileName(fileList[i], false);
  12. copy(fileList[i], targetFile);
  13. }
  14. }
  15. } else
  16. System.out.println("Could not create target folder!");
  17. } else
  18. System.out.println("Source folder does not exist!");
  19. }

代码示例来源:origin: marytts/marytts

  1. public static void copyFolder(String sourceFolder, String targetFolder, boolean bForceDeleteTarget) throws IOException {
  2. if (exists(sourceFolder)) {
  3. if (exists(targetFolder) && bForceDeleteTarget)
  4. delete(targetFolder);
  5. createDirectory(targetFolder);
  6. if (exists(targetFolder)) {
  7. String[] fileList = FileUtils.getFileList(sourceFolder, "*.*");
  8. if (fileList != null) {
  9. for (int i = 0; i < fileList.length; i++) {
  10. String targetFile = StringUtils.checkLastSlash(targetFolder)
  11. + StringUtils.getFileName(fileList[i], false);
  12. copy(fileList[i], targetFile);
  13. }
  14. }
  15. } else
  16. System.out.println("Could not create target folder!");
  17. } else
  18. System.out.println("Source folder does not exist!");
  19. }

代码示例来源:origin: marytts/marytts

  1. FileUtils.copy(targetWavFile, targetWavFile + ".wav");
  2. inputAudioTgt = AudioSystem.getAudioInputStream(new File(targetWavFile + ".wav"));
  3. } catch (UnsupportedAudioFileException e) {

代码示例来源:origin: marytts/marytts

  1. FileUtils.copy(targetWavFile, targetWavFile + ".wav");
  2. inputAudioTgt = AudioSystem.getAudioInputStream(new File(targetWavFile + ".wav"));
  3. } catch (UnsupportedAudioFileException e) {

代码示例来源:origin: marytts/marytts

  1. } else
  2. FileUtils.copy(firstPassOutputWavFile, outputItem.audioFile);

代码示例来源:origin: marytts/marytts

  1. } else
  2. FileUtils.copy(firstPassOutputWavFile, outputItem.audioFile);

代码示例来源:origin: marytts/marytts

  1. } else
  2. FileUtils.copy(firstPassOutputWavFile, outputItem.audioFile);

代码示例来源:origin: marytts/marytts

  1. } else
  2. FileUtils.copy(firstPassOutputWavFile, outputItem.audioFile);

代码示例来源:origin: de.dfki.mary/marytts-builder

  1. String path = gvInFile.getParent();
  2. FileUtils.copy(gvInFile.getAbsolutePath(), path + "/tmp");
  3. gvInFile = new File(path + "/tmp");

代码示例来源:origin: de.dfki.mary/marytts-builder

  1. String path = pdfInFile.getParent();
  2. FileUtils.copy(pdfInFile.getAbsolutePath(), path + "/tmp");
  3. pdfInFile = new File(path + "/tmp");

代码示例来源:origin: de.dfki.mary/marytts-builder

  1. for (int i = 0; i < 10; i++) {
  2. basename = StringUtils.getFileName(feaFiles[i]);
  3. FileUtils.copy(voiceDir + "hts/data/labels/full/" + basename + ".lab", voiceDir + "hts/data/labels/gen/gen_"
  4. + basename + ".lab");

代码示例来源:origin: de.dfki.mary/marytts-builder

  1. FileUtils.copy(sourceScript, logF0ShellScript);
  2. (new File(logF0ShellScript)).setExecutable(true);
  3. FileUtils.copy(sourceScript, logF0TCLScript);
  4. (new File(logF0TCLScript)).setExecutable(true);
  5. FileUtils.copy(sourceScript, strShellScript);
  6. (new File(strShellScript)).setExecutable(true);
  7. FileUtils.copy(sourceScript, strTCLScript);
  8. (new File(strTCLScript)).setExecutable(true);
  9. FileUtils.copy(sourceScript, mgcShellScript);
  10. (new File(mgcShellScript)).setExecutable(true);
  11. FileUtils.copy(sourceScript, filterFile);

相关文章