1
$\begingroup$

I have 20 short audio samples of a piano playing a single note. Due to internal limitations of my application, I need to concatenate and combine these into a single lossy file (either MP3 or AAC). This concatenated buffer will later be read, decoded to PCM, and split back into 20 buffers.

I realize that both VBR MP3 and AAC take advantage of various pyschoacoustic phenomena, including possible temporal masking. Is there a specific amount of silence that I must insert between the various samples in order to ensure that one does not affect the encoding of the other? Is this impossible to know due to the way encoders work?

I know that MP3 has a frame size of 1152 samples and AAC has a frame size of 1024 samples. Would 1152 samples of silence be enough?

$\endgroup$
1
$\begingroup$

The temporal masking effect is minimal. If your samples do not have extreme differences in loudness, one frame of silence should be enough. Depending on sampling rate one frame is >20ms, that should be plenty.

$\endgroup$
  • $\begingroup$ Thank you! Can you quantify "extreme"? Being piano samples, one sample will sustain and release almost entirely to silence followed by the loud transient attack of the next sample. $\endgroup$ – iccir Apr 4 at 10:13
  • 1
    $\begingroup$ I meant differences between samples, not in one sample. I think in general you will get way more problems with the lossy coding in general, than by too short stretches of silence between them. What do you need to do with the data? Will it be analyzed somehow, or just played back? Is your question solely regarding influences between samples, or does loss of data in a single sample matter? $\endgroup$ – Max Apr 4 at 11:19
  • $\begingroup$ The data will be used for playback (it's for a sampler/synthesizer project). The question was solely for influences between samples. I already have it working well with large amounts of silence between the samples, I just wasn't sure if there were caveats of reducing that to a single frame. $\endgroup$ – iccir Apr 5 at 1:33
  • 1
    $\begingroup$ I would just give it a try. Compare error signals (difference of original PCM data and decoded data) with different stretches of silence inserted. I don't think one frame will be a problem, but as its easy to check, you should do it. $\endgroup$ – Max Apr 5 at 5:29
  • $\begingroup$ I've been doing that, and it sounds fine, but I always worry that I've overlooked something. Thanks for your help! $\endgroup$ – iccir Apr 6 at 3:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.