[sdiy] A new shade of pink (noise)

Brian Willoughby brianw at audiobanshee.com
Thu Nov 26 08:37:20 CET 2020


Tom,

One thing that I always keep in mind is that signed, twos-complement numbers always have one extra negative value (or one fewer positive value, depending upon how you want to look at it).

This is in contrast to ones-complement, where there are two zeros - and that's not very useful.

You and Richie have already discussed that this algorithm is using fixed-point fractions.

To give some examples (with binary, whole numbers, and fractions)

0b01 = 1 or 0.5
0b00 = 0 or 0.0
0b11 = -1 or -0.5
0b10 = -2 or -1.0

0b011 = 3 or 0.75
0b010 = 2 or 0.50
0b001 = 1 or 0.25
0b000 = 0 or 0.00
0b111 = -1 or -0.25
0b110 = -2 or -0.50
0b101 = -3 or -0.75
0b100 = -4 or -1.00

I basically always exclude the value that starts with a '1' bit followed by all '0's and what's left is symmetrical around zero. In 16-bit audio, that's 0x8000.  For 24-bit, it's 0x800000.

Brian


On Nov 25, 2020, at 04:28, Tom Wiltshire <tom at electricdruid.net> wrote:
> We start off with a simple white noise source at the full sample rate. This is a 1-bit signal, 0 or 1, no problem.
> 
> Then we add a second noise source, at half the sample rate, achieved by only picking a new noise sample every other sample. For the ‘missing’ samples in-between, we use a mid point value. Except I’m getting stuck again..what’s the mid point value? This would be a 2-bit signal, so the “noise high” value would be 0b11, and “noise low” would be 0b00, but then…what’s the midpoint value? 0b01 or 0b10 aren’t quite right. Are we rounding down here?
> 
> Or perhaps we use 0b10 as the high value, in which case the midpoint is 0b01 (0,1,2). This makes more sense. We’re dealing with binary, so our high value of one gets doubled to become a high value of two. Ok.
> 
> Third noise source, another octave down, same idea. We’ve got three samples between each noise sample, and presumably we’re now onto a 3-bit signal, so the high value is 0b100, the low is 0b000, and the steps would be 0b001, 0b010, 0b011. (0,1,2,3,4)
> 
> When we come to add everything up, we just need to make sure that everything is shifted correctly so that the most-siginifcant bits line up so that the higher-bit-depth signals don’t get given more weight than the higher-sample-rate/lower-bit-depth ones, but that is simply a question of shifting or of storing things in the right bit in the first place.
> 
> Is that about right?





More information about the Synth-diy mailing list