문제

I have an android application that records AUDIO in raw format how can i extract a sample of the recording? for example if the raw file has 3 minutes of audio recorded, i would like to extract 20 seconds of the contents from an arbitrary start position is this possible?

도움이 되었습니까?

해결책

If the file contains interleaved PCM data with no header and you know the properties of the audio data (sample rate, number of channels, etc) the problem can be solved with basic math:

The number of bytes of audio data per second is sampleRate * bytesPerSample * numChannels.

The starting offset in bytes would be then be bytesPerSecond * offsetInSeconds, and the size of the chunk to read (in bytes) would be bytesPerSecond * lengthInSeconds.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top