White Noise Source – Electric Druid

White Noise Source

A pure white audio noise generator using an 8 pin PIC 12F675

This pages describes a simple digital noise source that produces pure white noise over the whole audio band – out to more than 40Khz, in fact. With filtering, you can derive pink noise and other colours. The circuit diagram included below was developed from the famous Polyfusion noise generator, and can produce white, pink and infra-red (low frequency) noise.

The noise generator 12F675 PIC microprocessor uses a dual LFSR algorithm which produces a pseudo-random stream of bits at over 90KHz. The bitstream shouldn’t repeat for 1428 years, but obviously I haven’t checked!

Replacement noise generator for Sequential Prophet 5 / Korg MonoPoly / Oberheim OB-X

I arranged the chip to be as close a replacement as I could for the notorious MM5837 digital noise generator which appears in early Korg MonoPolys, the Sequential Prophet 5, and the Oberheim OB-X. This chip has a very short LFSR (only 17-bit) which means that the noise it produces repeats every few seconds. This is audible, and has been described as sounding like a steam train puffing, rather than smooth white noise.

The only difference between the two chips (and one I couldn’t do anything about) is the supply voltage. This also means the new chip is quieter.

The datasheet includes some details about replacing the MM5837 in these synths.

Pinout Diagram

Pinout of MM5837 Noise Generator IC and modern replacement based on PIC 12F675

More details

A potential pitfall

The chip uses both the internal oscillator and the internal MCLR pullup. This combination causes problems with some PIC programmers. My own ICD2 clone complains that it doesn’t support it, and there are many reports online of problems with the JDM programmer. I programmed my chip successfully using the PICKit1 programmer, and it’s been reported to me that the P16pro programmer and Picallw software work too.

9 thoughts on “White Noise Source

  1. Hello Tom,

    in your 12F675 noise chip you use a 21-bit lfsr, here’s a 23-bit one with also 9 cycles:
    I took taps 23 and 14, same maximal length as 23+18 (18/14/9/5):

    rlf sr2,w; get bit 14
    movwf temp
    rlf temp,f
    rlf sr3,w; get bit 23
    xorwf temp,f
    rlf temp,f; into carry
    rlf sr1,f
    rlf sr2,f
    rlf sr3,f

    we could also shift first and take taps+1: (again, 9 cycles)

    bcf status,c
    rlf sr1,f
    rlf sr2,f
    rlf sr3,f
    rlf sr2,w; get bit 14 (15)
    xorwf sr3,w; xor witht bit 23 (24)
    movwf temp
    btfsc temp,7
    bsf sr1,0

    best, mike from switzerland

  2. Hey Tom! Great work, as always. Would the circuit diagram given in the datasheet work at lower voltage? For example, +9, +4.5, 0 instead of +15, 0, -15. Trying to integrate it with some existing stuff without re-engineering the power system.

    -John

  3. I’d like to share two even faster maximal length LFSR’s for PIC:

    31bit (taps 31,24):

    rlf sr4,w
    xorwf sr3,w
    movwf temp
    rlf temp,f
    rlf sr1,f
    rlf sr2,f
    rlf sr3,f
    rlf sr4,f

    15bit (taps 15,8):

    rlf sr2,w
    xorwf sr1,w
    movwf temp
    rlf temp,f
    rlf sr1,f
    rlf sr2,f

    Mike

  4. Hi,

    There’s a flaw in the logic of the algorithm. Alternating the output between two LFSRs doesn’t “couple” them but is instead equivalent to just (somewhat poorly) mixing two independent signals. Thus you have two pseudo noises mixed together, one with a period of 21 seconds and the other with a period of 6 hours. Audibly this probably still works ok as the brain can’t track 20+ second periodicity, but you’d probably get the same or better results using just the single 31 bit LFSR.

    1. Hi Antti,

      Given that the two LFSRs are alternated, the period of even the shorter one is around 45 seconds. Not only can the brain not follow even a 20 second period of white noise, but we also know that the very best source for masking other sounds is…white noise! So even if any apparent periodicity in the shorter LFSR were perceptible, it would be totally lost with the masking effect of the longer LFSR.
      Running two shorter LFSRs alternately like this enables us to increase the output sample rate. A longer 32-bit LFSR (for example) would take a few more instructions and give a lower sample rate. Another side effect of running two shorter LFSRs instead of one longer one is that we don’t hit the problem of long runs of identical samples, which starts to be significant as you get into longer LFSR lengths.

      1. Alternating between them is a red herring.

        It’s exactly equivalent to upsampling the two half-rate random streams by 2x (thus mirroring the spectrum of each separately), shifting one by one sample and then mixing them linearly together. Thus the effect as far as repetition goes is the same as just doubling the period of the shorter LFSR, not multiplying or even adding the periods. If there is an audible pattern in the 21-bit LFSR, it will be there even after you add other signal on top of that 21-bit LFSR noise.

        This is why switching to having just a single 31-bit LFSR, instead of having both 31-bit & 21-bit, would be beneficial (because 31 > 21*2). The code doesn’t seem to have a meaningful difference in cycle count between the 21 & 31-bit ones, so using just the 31-bit alone would have no practical effect on the samplerate but would remove the 21-bit repetition cycle entirely.

        1. Thanks Antti.

          I agree that alternating the two LFSRs doesn’t improve the length, which was my motivation for doing it when I wrote this code some ten or fifteen years ago. Maybe it does make sense to go simpler and just have the single 31-bit generator, but there’s certainly no audible cycle. I was still learning!

Leave a Reply

Your email address will not be published. Required fields are marked *