Writing buffer~ to file: small differences in sample values?
Feb 15 2015 | 9:47 pm
Hi
I have come across some strange behaviour when writing a buffer~ to a file.
When I load in an audio file into a buffer~ object and then write the buffer~ content to a new file, the two files have small differences in individual sample values – not all samples but many of them.
For example I might read a value of 0.005188 on a given sample in the original file (using a peek~ object) and a value of 0.005157 on the same sample in the newly written file. This difference would suggest some sort of difference in bit depth (?).
I know that you can set bit depth on the buffer~ by using the 'format' message, this doesn't really seem to be the solution. If, for example, I set the buffer to the format 'int16' and read a file with this format, then the result is the same when I write the buffer to a file – small differences in the sample values.
The reason for this question is that I am working on a Max application for automating splitting of audio files, and I would like to be able to save the extracted files without any degradation of quality.
I have attached a patch for testing the issue.
I hope that someone can enlighten me on this topic. Maybe I'm doing something wrong, or there is an aspect that I have missed.
Best regards Jakob