views:

11

answers:

1

I have a situation where I need to trim a small amount of audio from the beginning of a recorded clip (generally somewhere between 110-150ms, it is an inconsistent amount).

I'm recording in 44100 frequency and 16 bitrate. This is the code I'm using:

public function get trimmedData():ByteArray {
        var ba:ByteArray = new ByteArray();
        var bitPosition:uint = 44100 * 16 * (recordGap / 1000);
        bitPosition -= int(bitPosition % 16); //should keep snapped to nearest sample, I hope
        ba.writeBytes(_rawData, (bitPosition / 8));
        return ba;
    }

This seems to work time-wise, but all the recorded audio gets staticy and gross. Is something off about my rounding? This is the first time I've needed to alter raw PCM data so I'm not sure about the finer details of it.

Thanks!

A: 

The static issue seemed to be more a problem with volumes and limiting than with this trim!

Lowgain