As part of an audio peaking filter calculation, I need to implement hyperbolic sine ("sinh") function in a fixed-point arithmetic (fixed-point DSP processor).
What is the proper way to do this?
Signal Processing Stack Exchange is a question and answer site for practitioners of the art and science of signal, image and video processing. It only takes a minute to sign up.
Sign up to join this communityAs part of an audio peaking filter calculation, I need to implement hyperbolic sine ("sinh") function in a fixed-point arithmetic (fixed-point DSP processor).
What is the proper way to do this?
Be careful with that version of the Cookbook. I did not actually write it, although I gave permission to Doug to write it. He has a few typographic errors. The original has been moved. I think this is maybe where it lives now but there appears to be a CR/LF problem with the file.
Anyway, to do trancendentals with a fixed-point processor is difficult but possible. First you need a mathematical description of the transcendental function in terms of arithmetic operations that your fixed-point processor knows how to do. These are usually an infinite series that is truncated to a finite length. I have some expressions of these common transcendentals here.
The other thing you have to worry about is scaling of the coefficients to be integer values. Do you know how to do that in fixed point? That is fundamental.
Then finally the $\sinh(\cdot)$ is expressed in terms of the exponential function which is described in that Wikipedia article you cited.
Conceptually, doing fixed-point math is not too hard, but it is sorta a bitch. You must worry about both precision and about overflow.
(exp(x)-exp(-x))>>2
. I can probably live with that for now.
$\endgroup$
exp
lib takes q25 as input, and gives q15 at output, so my sinh
is q16 at best. but that's just start of a long journey...
$\endgroup$
If you have lots of memory, I would recommend that you use a look-up table. You could use Matlab/Octave/Python to generate the look-up table in C/C++. You can combine a look-up table with interpolation in order to reduce the memory requirements. You can exploit the symmetry of the sinh function in order to reduce the memory requirements by half.
Second option, use Cordic.