For example, I have 100 Byte PCM buffer and want to increase it to 300 Byte.
what i tried: asume original buffer was 9, 4, 1, 7, 5
They all had weird noise in result audio file.
How can I change length of buffer without effect sound? Is there any formula I can use?
Usually linear interpolation works. What is the bit-resolution of your PCM file? If it is 16 bits (pretty typical), you'll have to first convert two bytes into a single value before applying the interpolation, and then disassemble the values back to bytes. You will need to know the byte order, as it can be either little-endian or big-endian.
EDIT: I should have added that the pitch will drop with this method of lengthening the file, unless the playback frame rate increases. To stretch out a sound in time without affecting its pitch is considerably more complicated.