MP3 is a compressed audio format. You can't just cut the bits and expect the rest to remain a valid MP3 file. In fact, since this is a DCT-based transform, the bits are in the frequency domain instead of the time domain. There are simply no bits for sample 10465. There is a frame that contains sample 10465, and there is a set of bits describing all frequencies in this frame.
The usual cutting of sound on sample 10465 and continuation with some random other sample is likely to lead to a break, which means the number of frequencies present in the emerging missiles. Thus, it definitely means a complete re-code. It’s best to smooth the transition, but this is not a trivial operation. And the result, of course, is slightly different from the input, so it still means transcoding.
I don’t understand why you want to read 20 seconds of sound anyway. Where does this number come from? Usually you want to read everything.
Sound is a wave; he fully expected him to cross zero. Therefore, being close to zero is not special. For a 20 Hz wave (auditory threshold), zero crossings occur 40 times per second, but each time you have several samples near zero. Therefore, you basically need a few samples that are close to zero, but on both sides. 5 6 7 not much for 16-bit sounds, but it could very well be part of a wave that will have a maximum of 10,000. You really need to check at least 0.05 seconds to catch these 20 Hz sounds.
Since you find silence in the 50 millisecond range, you have a “position” that is about a few hundred wide. With some luck, there is a border to the frame. Cut there. Once again for transcoding.
Msalters
source share