2013-05-27 57 views
-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(); 
} 
} 

当我运行请帮助其说不可编译的源代码 - 错误的符号类型:java.io.File.getSampleV

​​

我不知道为什么它pooping起来......是疗法任何音频格式我需要看看如果是这样如何...请帮助

+0

哪条线是41线? – 2013-05-27 07:06:14

回答

5

这个异常java.lang.RuntimeException: Uncompilable source code是使用IDE,它允许您运行您的项目/代码,即使某些类未编译(由于错误码)。我建议在运行你的项目之前修复你的代码,并且你没有错误。

另外,java.io.File从来没有方法setSampleValueAt()。这是导致你的代码永远不能编译的原因。

2

你的错误是在这一行

int value = file.getSampleValueAt(index); 

File不提供方法getSampleValueAt

相关问题