-3
import java.io.File;

import java.io.FileInputStream;

//import javax.swing.JFrame;
public class filterpanitha {
//public void graph(){

//}
/**
 * @param args
 */
public static void main(String[] args) {
    // First, get the data from a sound file in .wav format into your program
    // You will have to modify the following line to point to your own file
    // String fileName = "C:\\Huhns\\Teaching\\CSCE145\\Code\\Noise3\\preamble.wav";
    FileInputStream fileInputStream = null;
    File file = new File("C:\\Users\\sudharshan_03713\\Desktop\\audio\\1A5.wav");
    // Next, print the sound to find out its length in samples
    System.out.println(file);
    // The following two methods calls get the value of a sound sample at
    // index 1000 and then set its value to half of the original.
    int index = 1000;
    int value = file.getSampleValueAt(index);
    file.setSampleValueAt(index, value / 2);
    // The following loop sets every sound sample to be twice its original value
    for (int n = 0; n < file.getNumSamples(); n++) {
        value = file.getSampleValueAt(n);
        file.setSampleValueAt(n, value * 2);
    }

    // Listen to the sound
    //sound1.play();
}
}

当我运行它时请帮忙说

Exception in thread "main" java.lang.RuntimeException: Uncompilable source code - Erroneous sym type: java.io.File.getSampleValueAt
 at Prepro.filterpanitha.main(filterpanitha.java:41)   

我不知道为什么它会弹出...是否有任何音频格式我需要查看如果是这样如何...请帮助

4

2 回答 2

5

使用允许您运行项目/代码的 IDE 时会出现此异常java.lang.RuntimeException: Uncompilable source code,即使某些类未编译(由于代码错误)。我建议在运行项目之前修复您的代码,并且您的错误为零。

另外,java.io.File永远不要有方法setSampleValueAt()。这就是导致您的代码永远无法编译的原因。

于 2013-05-27T07:14:25.210 回答
2

你的错误在这一行

int value = file.getSampleValueAt(index);

File不提供方法getSampleValueAt

于 2013-05-27T07:15:02.443 回答