如何将AudioInputStream文件传递给Spectrogram(Wave)构造函数

时间:2014-01-31 15:17:23

标签: java audio audio-player wave

请你帮我从下面的代码中调用构造函数Spectogram()

if (ae.getActionCommand().equals("play")) {
        try {
            ai = AudioSystem.getAudioInputStream(file);
            c.close();
            c = AudioSystem.getClip();
            c.open(ai);
            c.start();

            // As you imagine these types do not match.
            // How can I convert this line to make it workable?? 
            Spectogram sp = new Spectogram(ai);


        } catch (Exception e) {
            e.printStackTrace();
        }
    } 

这是我想要调用的构造函数,用于创建谱图并将其嵌入我的Wave播放器

public Spectogram(Wave wave) {

            this.wave=wave;
            buildSpectrogram();
  }

0 个答案:

没有答案