delphi - Why i get NAN value when storing mmioRead result in double? -


why nan value when trying read .wav file , directly store sample data in double? before thinking using store sample data in smallint , convert double dividing 32768.0 (there no nan value) later on got accuracy problem rounding off when converting wav file.

setlength(buf, ckidata.cksize); mmioread(hmmio, pansichar(buf), ckidata.cksize); 

where buf array of double. weren't allowed directly storing array of double?

if raw sample data 64-bit doubles (what audio format using that?), yes, can directly read array of doubles, eg:

var   buf: array of double;  setlength(buf, ckidata.cksize div sizeof(double)); mmioread(hmmio, pansichar(buf), length(buf) * sizeof(double)); 

however, audio formats not use doubles, have first read suitable buffer using correct data type (smallint 16-bit pcm, example), convert samples afterwards.


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -