Re: Noisy sound function output due to wrong nbits
On Thu, Aug 10, 2017 at 11:43:35 +0000, Bagus Tris Atmaja wrote:
> I have .wav files with 16 and 24 bits precision, when I read it with
> audioread and played it with sound function, I got noise sound. The syntax
> I used:
> >> [y, fs] = audioread('filename.wav');
> >> sound(y, fs)
> I got clean sound when I add nbits argument (n=16) to sound,
> >> sound(y, fs, 16);
> From the 'help sound', it is shown that default nbits is 8.
> So, in case we don't know now the nbits of wav file (I use sox to collect
> the information or old wavread althoug it gives warning), what's the
> workaround for the audioread function?
> I prefer to keep nbits output argument to the new audioread function.
Use the audioinfo function to get the number of bits per sample in the
original audio file:
info = audioinfo ("filename.wav");