1
$\begingroup$

I have a sine tone, doing some math, and finally gets an harmonically accumulated sine tone in complex numbers. I do want to preserve the phase information of imaginary part on the other end, which will continue processing the complex signal. So,

Is there any way i can safely pack the complex number into any of standard file formats, such as wav ?

Note : Currently I am writing this signal's byte values to a .bin file

$\endgroup$
2
$\begingroup$

You could create a standard 2 channel wav file. 1 channel for the real part and 1 for the imag. Wav files supports both 16bit integer, 32bit integer and 32bit floats etc. The channel data will be interleaved (I believed it's called). Meaning that your data will be written: [REAL][IMAG][REAL][IMAGE]... Prolly just like your own bin file.

Standard programs like Audacity will be able to read the file and make calculations on each (or both) channels.

$\endgroup$
  • $\begingroup$ Thanks lllishar, Standard programs like Audacity will be able to read the file and make calculations on each (or both) channels is what i wanted. But my data is itself multi-channel. So any way to deal with source complex signal being multi-channel signal? $\endgroup$ – nmxprime Oct 14 '14 at 8:49
  • 1
    $\begingroup$ Wav files can contain more than 2 channels also: msdn.microsoft.com/en-us/library/windows/hardware/…. So just double the number of channels. Hopefully it's no more than 6 channels. Otherwise I'd create separate wav files for each "channel". (Eg. make each wav file contain a real/imag channel.) $\endgroup$ – Illishar Oct 14 '14 at 10:08
  • $\begingroup$ I've just checked, you prolly won't even need the extended format, to create a eg. 10 channel wav. It's a standard wav field feature. $\endgroup$ – Illishar Oct 14 '14 at 10:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.