Noisy sound function output due to wrong nbits

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Noisy sound function output due to wrong nbits

bagustris
Dear all,

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.

--
Bagus Tris Atmaja
VibrasticLab - ITS
Phone: +6285607000761

_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Noisy sound function output due to wrong nbits

Mike Miller-4
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");
    disp (info.BitsPerSample)

--
mike

_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave

signature.asc (849 bytes) Download Attachment
Loading...