octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Audio playback and classes


From: Mike Miller
Subject: Re: Audio playback and classes
Date: Fri, 28 Jun 2013 09:03:50 -0400

On Fri, Jun 28, 2013 at 08:16:14 -0400, Michael Goffioul wrote:
> On Fri, Jun 28, 2013 at 3:51 AM, Vytautas Jancauskas <address@hidden>
> wrote:
>>
>> I am a bit confused how to handle variable bit depth audio data. Audio
>> files come in different variates, like 8 bit, 16 bit, 24 bit, etc.
>> These bit depths give different value ranges. From what I understand
>> from matlab documentation it takes in to account the type of values
>> the array to be played back contains (e.g. int8, int16, uint16, etc).
>> But in octave I cannot get that type or at least I don't know how (the
>> numeric arrays are all treated as if they were arrays of doubles
>> right?) I need this information for correct playback. There are two
>> options for dealing with this I can think of:
>>
>> a) Guess the type of array by seeing what values the array elements take.
>> b) Limit the values to real values in the range (-1.0, 1.0) and make
>> the user take care of conversion to that format themselves.
>>
>> Are there any suggestions about this?
>
>
> Maybe I misunderstood your question, but octave supports intXX and uintXX
> types and you can get that type through the "class" function, like the
> following:
>
> octave-cli:2> class(int8(rand(1,10)*256))
> ans = int8

That's exactly how I read the audioplayer online help. The class of
the data matrix that the user passes to the audioplayer determines the
depth and scaling of the signal. For some context, see wavread and
wavwrite, which can tie the class of the matrix to the bit depth in
the same way.

-- 
mike


reply via email to

[Prev in Thread] Current Thread [Next in Thread]