2013-05-27 56 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

相關問題