[LAD] SysEx data-conversion woes: nibbles and complements (Microwave 2)
julien at mail.upb.de
Thu May 13 12:59:32 CEST 2021
May 13 2021, Fons Adriaensen has written:
> Mmmmm... I'll let you discover the errors (more than one)...
Thanks, I did. :) The indices were actually a typo, but the rest was
stupidity by design. :)
> Now if you want float samples (e.g. to do an FFT) you need
> for (...)
> int v;
> v = (16 * sysex_string [2*i] + sysex_string [2*i+1]) ^ 0x80;
> if (v & 0x80) v -= 256; // Sign extension
> float_sample [i] = v;
This is great! I'd never have gotten this bit about the sign extension.
Is the 0x80 type size specific or would it be the same for converting to
May I mention your name in the README of the finished tool? First FFT
and now this!
* Website: http://juliencoder.de - for summer is a state of sound
* Youtube: https://www.youtube.com/channel/UCMS4rfGrTwz8W7jhC1Jnv7g
* Audiobombs: https://www.audiobombs.com/users/jeanette_c
* GitHub: https://github.com/jeanette-c
And when you say those words
It's the sweetest thing I've ever heard <3
More information about the Linux-audio-dev