-1

I have this simple code, but when I run, I get an error of not such a directory or file! how can I solved I tried many ways none of them works!! can anyone help?

public static void main (String [] args) {

    String songA = ("res/raw/canon_d_major.wav");
    String songB = ("res/raw/canon_d_major.wav");

    Wave waveA = new Wave(songA);
    Wave waveB = new Wave(songB);

    String recordedClip = ("res/raw/cock_a.1.wav");
    Wave waveRec = new Wave(recordedClip);

    FingerprintSimilarity similarity1, similarity2;

    similarity1= waveA.getFingerprintSimilarity(waveRec);

    System.out.println("clip is found at " + 
    similarity.getsetMostSimilarTimePosition() + "s in " + songA + 
    " with similarity " + similarity.getSimilarity());

    similarity2 = waveB.getFingerprintSimilarity(waveRec);

    System.out.println("clip is found at " + 
    similarity.getsetMostSimilarTimePosition() + "s in " + songB + 
    " with similarity " + similarity.getSimilarity());

}

1 Answers1

0

File fileName = new File('path/to/file'); does not create file on your hdd. Its only new File object in java that points to the dir you set in constructor. With that said if cock_a.wav doesnt exist while code is executing it wont be physically created.

Use this -> Java's createNewFile() - will it also create directories?

Also it might be helpful if you post your directory structure here.

Tomasz
  • 23
  • 1
  • 6
  • Show your directory structure. Keep in mind that above applies also to your other .wav files. Can you upload error stack trace? – Tomasz May 20 '19 at 08:11
  • Dear, thank you but I solved the problem, the path I provided was wrong, I just copy the path of each audio, now I am getting the results :) – Yosra Bader May 20 '19 at 08:21