Java jFLAC。分割FLAC文件
我需要把flac文件分成很多部分。我正在使用jFLAC库读取flac文件Java jFLAC。分割FLAC文件,java,audio,split,flac,Java,Audio,Split,Flac,我需要把flac文件分成很多部分。我正在使用jFLAC库读取flac文件 FLACDecoder decoder = new FLACDecoder(inputStream); 然后,我尝试解码到搜索点之间的父文件 decoder.decode(seekPointFrom, seekPointTo); 我也不太明白如何正确地获得秒的seekpoints值。例如,我需要从0秒到150秒的第一个搜索点。如何获得正确的搜索点对象?Seekpoint cinstructor是 /** * The
FLACDecoder decoder = new FLACDecoder(inputStream);
然后,我尝试解码到搜索点之间的父文件
decoder.decode(seekPointFrom, seekPointTo);
我也不太明白如何正确地获得秒的seekpoints值。例如,我需要从0秒到150秒的第一个搜索点。如何获得正确的搜索点对象?Seekpoint cinstructor是
/**
* The constructor.
* @param sampleNumber The sample number of the target frame
* @param streamOffset The offset, in bytes, of the target frame with respect to beginning of the first frame
* @param frameSamples The number of samples in the target frame
*/
public SeekPoint(long sampleNumber, long streamOffset, int frameSamples) {
this.sampleNumber = sampleNumber;
this.streamOffset = streamOffset;
this.frameSamples = frameSamples;
}
解码器还有一些侦听器,可以侦听每个读块操作
@Override
public void processPCM(ByteData pcm) {
try {
outputStream.write(pcm.getData(), 0, pcm.getLen());
} catch (IOException e) {
e.printStackTrace();
}
}
写完后,我准备播放新的flac文件,但我的播放器提示该文件不正确。我需要做什么才能打开我的flac文件?可能我需要为此文件或其他文件写入一些头?关于FLAC SeekPoints,无法保证会有一个对应于给定秒的SeekPoints-整个音频文件中可能只有几个SeekPoints 因此,我最近使用seek函数更新了jFLAC,以使您至少获得最近的音频帧:
关于写入新文件,解码数据将在原始PCM样本中。因此,如果您想要一个有效的FLAC文件作为输出,您需要将其通过管道传输到FLAC编码器中。或者,您可以写出波形头并转储原始PCM样本,然后将生成的波形文件转换为FLAC文件。您应该在