From: Jerry Avins on
aaronde wrote:
>>
>> aaronde wrote:
>>
>>> Hi
>>>
>>> I reading a Wav file in C++. I need to convert the PCM values to float
>>> values for further DSP manipulation (Filtering etc ...). Do I need to
> do
>>> this through a conversion from Hex to binary unsigned 2 complement
> values
>>> then to integers ? Thus anyone know of any available function in C/C++
> ? Am
>>> I missing something ?
>> Sometimes the idiocy of modern programmers is just unbelievable.
>>
>> VLV
>>
>
> Hi
>
> Thanks for calling me an idiot. Really nice of you I suppose you were born
> knowing everything and you never asked a simple and dumb question. No one
> forced you to reply or read the post if you think it so stupid. On the
> other hand I would appreciate any help as this is the first time I am doing
> such work.
>
> Okey I know that hex and binary are the representation of the same thing.
> My question was that you can't apply a dsp operation using the PCM values.

If course you can. It's called "integer". Often you need to scale it.
See especially http://www.digitalsignallabs.com/fp.pdf and also
http://cnx.org/content/m11054/latest/

> If I read the wav file and get a Hex value of 8A this has to be
> represented as an float type ie conveted and rescaled to a range between -1
> and 1 in order to apply further operations. My question was weather there
> is a built in fucntion in C/C++. Please excuse me if I am not clear with my
> question

I'll go put on a limb and claim that every language that supports both
integer and floating point has a way to convert between them. In C and
C++, the compiler will do it for you if you ask nicely.

Jerry
--
Engineering is the art of making what you want from things you can get.
�����������������������������������������������������������������������
From: Andrew Reilly on
On Thu, 12 Nov 2009 22:29:53 -0600, aaronde wrote:

> If I read the wav file and get a Hex value of 8A this has to be
> represented as an float type ie conveted and rescaled to a range between
> -1 and 1 in order to apply further operations.

I was going to try to be helpful, but then I noticed that your question
contained the entire answer (above). So now I'm just confused about what
it is that you don't understand. Could you have another go at asking the
question, please?

Cheers,

--
Andrew
From: Eric Jacobsen on
On 11/12/2009 9:29 PM, aaronde wrote:
>>
>> aaronde wrote:
>>
>>> Hi
>>>
>>> I reading a Wav file in C++. I need to convert the PCM values to float
>>> values for further DSP manipulation (Filtering etc ...). Do I need to
> do
>>> this through a conversion from Hex to binary unsigned 2 complement
> values
>>> then to integers ? Thus anyone know of any available function in C/C++
> ? Am
>>> I missing something ?
>> Sometimes the idiocy of modern programmers is just unbelievable.
>>
>> VLV
>>
>
> Hi
>
> Thanks for calling me an idiot. Really nice of you I suppose you were born
> knowing everything and you never asked a simple and dumb question. No one
> forced you to reply or read the post if you think it so stupid. On the
> other hand I would appreciate any help as this is the first time I am doing
> such work.
>
> Okey I know that hex and binary are the representation of the same thing.
> My question was that you can't apply a dsp operation using the PCM values.

First, that's not a question, and, second, it's not true.

Why can't you do a DSP operation on integers?

> If I read the wav file and get a Hex value of 8A this has to be
> represented as an float type ie conveted and rescaled to a range between -1
> and 1 in order to apply further operations.

I don't know why that would be. Lots of processing is done on arrays or
streams of integers without ever converting to floating point.

> My question was weather there
> is a built in fucntion in C/C++. Please excuse me if I am not clear with my
> question
>
> Thanks and Regards
> Aaron


--
Eric Jacobsen
Minister of Algorithms
Abineau Communications
http://www.abineau.com
From: Erik de Castro Lopo on
aaronde wrote:

> Hi
>
> I reading a Wav file in C++. I need to convert the PCM values to float
> values for further DSP manipulation (Filtering etc ...). Do I need to do
> this through a conversion from Hex to binary unsigned 2 complement values
> then to integers ? Thus anyone know of any available function in C/C++ ? Am
> I missing something ?

You're probably much more interesting in doing the DSP manipulation
than you are in reading WAV files. If thats the case, then why don't
you use libsndfile:

http://www.mega-nerd.com/libsndfile/

which reads WAV as well as many other formats. In addition, if you
can use the sf_read_float() function you can directly read normalized
floating point data

http://www.mega-nerd.com/libsndfile/api.html#read

Ie the library does the conversion to float for you, on the fly.

Erik
--
----------------------------------------------------------------------
Erik de Castro Lopo
http://www.mega-nerd.com/
From: Vladimir Vassilevsky on


aaronde wrote:
>>
>>aaronde wrote:
>>
>>
>>>I reading a Wav file in C++. I need to convert the PCM values to float
>>>values for further DSP manipulation

>>Sometimes the idiocy of modern programmers is just unbelievable.
>
> Thanks for calling me an idiot.

Sure. I can call you idiot once more, if you like.

> Really nice of you I suppose you were born
> knowing everything and you never asked a simple and dumb question.

You see, before I could do any programming, I had to build a computer
for myself. With soldering iron, breadboard and discrete parts from
black market. There wasn't anybody to ask questions to. Now, with the
computers widely available, with the miracles of Google and Wikipedia,
with the zillion of books and online guides, why do you have to ask
2+2=4 question?

VLV