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

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

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

FileUtils.exists介绍

暂无

代码示例

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

public static void checkMfccFiles(BaselineAdaptationSet fileSet, MfccFileHeader mfccParams, boolean isForcedAnalysis)
      throws IOException {
    System.err.println("Attempting to read MFCC parameters from files...");

    for (int i = 0; i < fileSet.items.length; i++) {
      if (!FileUtils.exists(fileSet.items[i].mfccFile))
        System.err.println("MFCC files not found!Please use SPTK generated raw MFCC file named as "
            + fileSet.items[i].mfccFile);
    }

    System.err.println("MFCC files verified...");
  }
}

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

public static void rename(String existingFile, String newFilename) {
  if (exists(existingFile)) {
    File oldFile = new File(existingFile);
    oldFile.renameTo(new File(newFilename));
  }
}

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

public static void checkMfccFiles(BaselineAdaptationSet fileSet, MfccFileHeader mfccParams, boolean isForcedAnalysis)
      throws IOException {
    System.err.println("Attempting to read MFCC parameters from files...");

    for (int i = 0; i < fileSet.items.length; i++) {
      if (!FileUtils.exists(fileSet.items[i].mfccFile))
        System.err.println("MFCC files not found!Please use SPTK generated raw MFCC file named as "
            + fileSet.items[i].mfccFile);
    }

    System.err.println("MFCC files verified...");
  }
}

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

public static void rename(String existingFile, String newFilename) {
  if (exists(existingFile)) {
    File oldFile = new File(existingFile);
    oldFile.renameTo(new File(newFilename));
  }
}

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

public static void delete(String file) {
  if (exists(file)) {
    delete(file, false);
  }
}

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

public FestivalUtt(String festivalUttFile) {
  keys = new String[6];
  keys[0] = "==Segment==";
  keys[1] = "==Target==";
  keys[2] = "==Syllable==";
  keys[3] = "==Word==";
  keys[4] = "==IntEvent==";
  keys[5] = "==Phrase==";
  labels = new Labels[keys.length];
  if (FileUtils.exists(festivalUttFile)) {
    read(festivalUttFile);
  }
}

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

public static void delete(String file) {
  if (exists(file)) {
    delete(file, false);
  }
}

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

public FestivalUtt(String festivalUttFile) {
  keys = new String[6];
  keys[0] = "==Segment==";
  keys[1] = "==Target==";
  keys[2] = "==Syllable==";
  keys[3] = "==Word==";
  keys[4] = "==IntEvent==";
  keys[5] = "==Phrase==";
  labels = new Labels[keys.length];
  if (FileUtils.exists(festivalUttFile)) {
    read(festivalUttFile);
  }
}

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

public static void energyAnalysis(BaselineAdaptationSet fileSet, EnergyFileHeader energyParams, boolean isForcedAnalysis)
    throws UnsupportedAudioFileException, IOException {
  System.err.println("Starting energy analysis...");
  boolean bAnalyze;
  EnergyContourRms e = null;
  for (int i = 0; i < fileSet.items.length; i++) {
    bAnalyze = true;
    if (!isForcedAnalysis && FileUtils.exists(fileSet.items[i].energyFile)) // No f0 detection if ptc file already exists
      bAnalyze = false;
    if (bAnalyze) {
      e = new EnergyContourRms(fileSet.items[i].audioFile, fileSet.items[i].energyFile,
          energyParams.windowSizeInSeconds, energyParams.skipSizeInSeconds);
      System.err.println("Extracted energy contour: " + fileSet.items[i].energyFile);
    } else
      System.err.println("Energy file found with identical analysis parameters: " + fileSet.items[i].energyFile);
  }
  System.err.println("Energy analysis completed...");
}

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

public static void f0Analysis(BaselineAdaptationSet fileSet, PitchFileHeader ptcParams, boolean isForcedAnalysis)
    throws UnsupportedAudioFileException, IOException {
  System.err.println("Starting f0 analysis...");
  boolean bAnalyze;
  F0TrackerAutocorrelationHeuristic p = new F0TrackerAutocorrelationHeuristic(ptcParams);
  for (int i = 0; i < fileSet.items.length; i++) {
    bAnalyze = true;
    if (!isForcedAnalysis && FileUtils.exists(fileSet.items[i].pitchFile)) // No f0 detection if ptc file already exists
      bAnalyze = false;
    if (bAnalyze) {
      p.pitchAnalyzeWavFile(fileSet.items[i].audioFile, fileSet.items[i].pitchFile);
      System.err.println("Extracted f0 contour: " + fileSet.items[i].pitchFile);
    } else
      System.err.println("F0 file found with identical analysis parameters: " + fileSet.items[i].pitchFile);
  }
  System.err.println("f0 analysis completed...");
}

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

public static void f0Analysis(BaselineAdaptationSet fileSet, PitchFileHeader ptcParams, boolean isForcedAnalysis)
    throws UnsupportedAudioFileException, IOException {
  System.err.println("Starting f0 analysis...");
  boolean bAnalyze;
  F0TrackerAutocorrelationHeuristic p = new F0TrackerAutocorrelationHeuristic(ptcParams);
  for (int i = 0; i < fileSet.items.length; i++) {
    bAnalyze = true;
    if (!isForcedAnalysis && FileUtils.exists(fileSet.items[i].pitchFile)) // No f0 detection if ptc file already exists
      bAnalyze = false;
    if (bAnalyze) {
      p.pitchAnalyzeWavFile(fileSet.items[i].audioFile, fileSet.items[i].pitchFile);
      System.err.println("Extracted f0 contour: " + fileSet.items[i].pitchFile);
    } else
      System.err.println("F0 file found with identical analysis parameters: " + fileSet.items[i].pitchFile);
  }
  System.err.println("f0 analysis completed...");
}

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

public static void lsfAnalysis(BaselineAdaptationSet fileSet, LsfFileHeader lsfParams, boolean isForcedAnalysis)
    throws IOException {
  System.err.println("Starting LSF analysis...");
  boolean bAnalyze;
  for (int i = 0; i < fileSet.items.length; i++) {
    bAnalyze = true;
    if (!isForcedAnalysis && FileUtils.exists(fileSet.items[i].lsfFile)) {
      LsfFileHeader tmpParams = new LsfFileHeader(fileSet.items[i].lsfFile);
      if (tmpParams.isIdenticalAnalysisParams(lsfParams))
        bAnalyze = false;
    }
    if (bAnalyze) {
      LsfAnalyser.lsfAnalyzeWavFile(fileSet.items[i].audioFile, fileSet.items[i].lsfFile, lsfParams);
      System.err.println("Extracted LSFs: " + fileSet.items[i].lsfFile);
    } else
      System.err.println("LSF file found with identical analysis parameters: " + fileSet.items[i].lsfFile);
  }
  System.err.println("LSF analysis completed...");
}

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

public F0TrackerAutocorrelationHeuristic(String wavFile, String ptcFile) throws Exception {
  if (FileUtils.exists(wavFile)) {
    params = new PitchFileHeader();
    init();
    PitchReaderWriter f0 = null;
    try {
      f0 = pitchAnalyzeWavFile(wavFile, ptcFile);
    } catch (UnsupportedAudioFileException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    } catch (IOException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
  } else
    throw new Exception("Wav file not found!");
}

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

public F0TrackerAutocorrelationHeuristic(String wavFile, String ptcFile) throws Exception {
  if (FileUtils.exists(wavFile)) {
    params = new PitchFileHeader();
    init();
    PitchReaderWriter f0 = null;
    try {
      f0 = pitchAnalyzeWavFile(wavFile, ptcFile);
    } catch (UnsupportedAudioFileException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    } catch (IOException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
  } else
    throw new Exception("Wav file not found!");
}

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

public F0TrackerAutocorrelationHeuristic(String wavFile) throws Exception {
  if (FileUtils.exists(wavFile)) {
    String ptcFile = StringUtils.modifyExtension(wavFile, "ptc");
    params = new PitchFileHeader();
    init();
    PitchReaderWriter f0 = null;
    try {
      f0 = pitchAnalyzeWavFile(wavFile, ptcFile);
    } catch (UnsupportedAudioFileException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    } catch (IOException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
  } else
    throw new Exception("Wav file not found!");
}

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

public F0TrackerAutocorrelationHeuristic(String wavFile) throws Exception {
  if (FileUtils.exists(wavFile)) {
    String ptcFile = StringUtils.modifyExtension(wavFile, "ptc");
    params = new PitchFileHeader();
    init();
    PitchReaderWriter f0 = null;
    try {
      f0 = pitchAnalyzeWavFile(wavFile, ptcFile);
    } catch (UnsupportedAudioFileException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    } catch (IOException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
  } else
    throw new Exception("Wav file not found!");
}

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

public WeightedCodebook readCodebookFile(String codebookFile) throws IOException {
  WeightedCodebook codebook = null;
  if (FileUtils.exists(codebookFile)) {
    if (status != OPEN_FOR_READ) {
      if (status != NOT_OPENED)
        close();
      init(codebookFile, OPEN_FOR_READ);
    }
    if (status == OPEN_FOR_READ) {
      codebook = new WeightedCodebook();
      codebook.header = readCodebookHeader();
      readCodebookFileExcludingHeader(codebook);
    }
  }
  return codebook;
}

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

public PitchMapping readPitchMappingFile(String pitchMappingFile) throws IOException {
  PitchMapping pitchMapping = null;
  if (FileUtils.exists(pitchMappingFile)) {
    if (status != OPEN_FOR_READ) {
      if (status != NOT_OPENED)
        close();
      init(pitchMappingFile, OPEN_FOR_READ);
    }
    if (status == OPEN_FOR_READ) {
      pitchMapping = new PitchMapping();
      pitchMapping.header = readPitchMappingHeader();
      readPitchMappingFileExcludingHeader(pitchMapping);
    }
  }
  return pitchMapping;
}

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

public WeightedCodebook readCodebookFile(String codebookFile) throws IOException {
  WeightedCodebook codebook = null;
  if (FileUtils.exists(codebookFile)) {
    if (status != OPEN_FOR_READ) {
      if (status != NOT_OPENED)
        close();
      init(codebookFile, OPEN_FOR_READ);
    }
    if (status == OPEN_FOR_READ) {
      codebook = new WeightedCodebook();
      codebook.header = readCodebookHeader();
      readCodebookFileExcludingHeader(codebook);
    }
  }
  return codebook;
}

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

public PitchMapping readPitchMappingFile(String pitchMappingFile) throws IOException {
  PitchMapping pitchMapping = null;
  if (FileUtils.exists(pitchMappingFile)) {
    if (status != OPEN_FOR_READ) {
      if (status != NOT_OPENED)
        close();
      init(pitchMappingFile, OPEN_FOR_READ);
    }
    if (status == OPEN_FOR_READ) {
      pitchMapping = new PitchMapping();
      pitchMapping.header = readPitchMappingHeader();
      readPitchMappingFileExcludingHeader(pitchMapping);
    }
  }
  return pitchMapping;
}

相关文章