data conversion

lewis bradley-muir's icon

Hi everyone,

Im currently trying to convert a dB output into 0/1 to then be used with jitter objects as i know they prefer this type of data rather than floating point numbers.

as in the photo below this is where i am at the moment -

any help would be very much appreciated!

audio input - peakamp~ - expr 20. *log10($f1)

Mitch Turner's icon

You might try looking at [amptodb] or [amptodb~] and their help files.

Hope this helps,
Mitch

Mitch Turner's icon

Lewis,
I went back to my electronic music lecture notes and found that in M. Puckett's book (see Theory and Techniques of Electronic Music pp.4-5), he gives this formula for Amplitude:

d = 20 * log 10 (A/A0)

d is decibels (dB),
A is the amplitude of the digital signal (also called A1)
A0 is the reference amplitude (the threshold of hearing), which Puckett defines as 0.00001. Puckett says that in "digital audio a convenient choice of reference amplitude, assuming the hardward has a maximum amplitude of one" (Puckett p. 5).

So, I think that in your [expr] object, you should divide $f1 by 0.00001 (see my picture below).

In essence, this is the math to show how the max amplitude of "1" will be 100 dB:
given, Max. Amplitude = 1
and given, Min. Amplitude = 10^-5= 0.00001 (reference amplitude)

then, dB = 20 log10A1/A0

= 20 log10(1/.00001)

= 20 log10(99999.99999…)

= 20 (5)

= 100

Thus, 1 (Maximum Amplitude) is, here, equivalent to 100dB.

Here is some bibliography that might help:

•Dodge and Jerse. 1997. Computer Music: Synthesis, Composition, and Performance, 2nd Edition. New York: Schirmer. (see pp. 26-28)

•Moore, F. Richard. 1990. Elements of Computer Music. Upper Saddle River, NJ: Prentice-Hall.

•Puckette, Miller. 2004. Theory and Techniques of Electronic Music. New Jersey: World Scientific, 2007. (see pp. 4-5)
also online: http://msp.ucsd.edu/techniques.htm

•Roads, Curtis. 1996. The Computer Music Tutorial.Cambridge, MA: MIT Press. (see pp. 38-40)

•Smith, Steven W. 1997. The Scientist and Engineer’s Guide to Digital Signal Processing,2nd Edition. San Diego, CA: California Technical Publishing.

Hope this is helpful,
Mitch

Note that I've divided $f1 by the reference (minimum) amplitude.