本文整理汇总了Java中javax.sound.sampled.AudioFileFormat.Type.WAVE属性的典型用法代码示例。如果您正苦于以下问题:Java Type.WAVE属性的具体用法?Java Type.WAVE怎么用?Java Type.WAVE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类javax.sound.sampled.AudioFileFormat.Type
的用法示例。
在下文中一共展示了Type.WAVE属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getAudioFileTypes
@Override
public Type[] getAudioFileTypes(AudioInputStream stream) {
if (!stream.getFormat().getEncoding().equals(Encoding.PCM_FLOAT))
return new Type[0];
return new Type[] { Type.WAVE };
}
示例2: getAudioFileTypes
public Type[] getAudioFileTypes(AudioInputStream stream) {
if (!stream.getFormat().getEncoding().equals(
AudioFloatConverter.PCM_FLOAT))
return new Type[0];
return new Type[] { Type.WAVE };
}
示例3: main
/**
* @param args
* @throws Exception
*/
public static void main(String[] args) throws Exception {
// Load a project
FrinikaAudioSystem.usePhysicalAudioOutput = false;
ProjectContainer project = ProjectContainer.loadProject(new File("/home/peter/mystudio/faro.frinika"));
long startTick = 0;
long endTick = 128*16;
FrinikaAudioServer audioServer = (FrinikaAudioServer)project.getAudioServer();
MyMidiRenderer midiRenderer = new MyMidiRenderer(project.getMixer(),project.getSequencer(),startTick,(int)(endTick-startTick),project.getAudioServer().getSampleRate());
audioServer.setRealTime(false);
long numberOfSamples = midiRenderer.available()/4;
byte[] buffer = new byte[1024];
Type type = Type.WAVE;
File outputFile = new File("/home/peter/mystudio/faro.wav");
try
{
AudioInputStream ais = new AudioInputStream(midiRenderer,new AudioFormat((float) FrinikaConfig.sampleRate,16,2,true,true),numberOfSamples);
FrinikaSequencer sequencer = project.getSequencer();
sequencer.setRealtime(false);
sequencer.start();
System.out.println("Writing");
AudioSystem.write(ais,type,outputFile);
System.out.println("Done writing");
sequencer.stop();
project.close();
System.out.println("Done with all");
} catch(Exception e)
{
e.printStackTrace();
}
}
示例4: getAudioFileTypes
public Type[] getAudioFileTypes() {
return new Type[] { Type.WAVE };
}