0
iは、以下の下に、以下のJavaサウンドAPIはどのようなデータ形式変換を行うことができますか?
import javax.sound.sampled.*;
public class Main {
public static void main(String[] args) throws Exception {
AudioFormat af_src = AudioSystem.getAudioInputStream(new java.io.File("myfile.wav")).getFormat();
System.out.println(af_src.getEncoding() + " " + af_src.getSampleRate());
AudioFormat af_tgt = new AudioFormat(8000, 8, 1, true, false);
System.out.println(AudioSystem.isConversionSupported(af_tgt, af_src));
}
}
出力を、.wav data format
高いビットレートを変換するjavax.sound.sampled
パッケージを使用
44100 PCM
false
あなたは、Sunのdefault implementation
によってサポートされているJDK 6で何data format conversion
の種類教えて助けてもらえあなたの経験によれば? @Andrew Thompson
さんsuggstionによると、私は以下の試験を行った
@EDIT
、
import javax.sound.sampled.*;
public class Main {
public static void main(String[] args) {
float sourceSampleRate = 44100;
int sourceSampleSizeInBits = 16;
int sourceChannels = 2;
AudioFormat sourceAudioFormat = new AudioFormat(sourceSampleRate, sourceSampleSizeInBits, sourceChannels, true, false);
float targetSampleRate = sourceSampleRate/4;
int targetSampleSizeInBits = sourceSampleSizeInBits/2;
int targetChannels = sourceChannels/2;
AudioFormat targetAudioFormat = new AudioFormat(targetSampleRate, targetSampleSizeInBits, targetChannels, true, false);
System.out.println(AudioSystem.isConversionSupported(targetAudioFormat, sourceAudioFormat));
}
}
出力が残る:
false
任意のアイデア?
@EDIT data format conversion
上の2
JavaSound事実implments何も。サードパーティのプラグインがほとんど見つからない場合は、APIユーザーの義務の呼び出しです。
JavaSoundは仮想的にこの点に関して何も実装していないので、自分の実装では少し複雑な 'データフォーマット変換 'を行うよう提案しましたか? – sof
...何ですか?あなたはそれを言い換えることができますか? 'Java'の後の最後の単語として 'does not'が追加された場合は意味があります。 –
申し訳ありませんが、を入力してくださいを熱心に入力してください。言い換えれば – sof