Tuesday, November 17, 2015

24 Parallel PIC chips


The new "Tocante Karper" uses 24 pic chips in parallel to synthesize karplus-strong string emulations, in the Tocante scale. That scale is initially based on a very analog thing- the capacitor values in an E6 preferred number set. For example: 10, 15, 22, 33, 47 and 68 are my starting numerology. Because they are integers, and also because the frequency varies as the reciprocal of the capacitance (bigger capacitor, lower frequency), it ported over seamlessly to sixteen bit string buffers of different lengths.

I chose the pic16f1704 because it is small, efficient, and it has a DAC and even some op-amps; it's like a micro PSOC. Initially I programmed the algorithm with ADC as input, but realized since karplus-strong wants noise on the input, a vanilla i/o port would suffice. Good, that knocked a few milliamperes off of each. The 24 microcontrollers use about 12 milliamperes total. They are arranged in banks that initially run at different octave sampling rates. I said initially because you can touch some inner pads and it will scroll each string around in pitch degree and octave, on the fly, circuit bending style.

Programming the chips in parallel presented a chain of challenges that I am phewing over. For starters, there is no commercial programmer such as pickit3 that can do it, because they are bi-directional and mandate code-checking and other communications. To gang-program, you need uni-directional, a simpler interface. So I went about programming my own programmer. The work may be reused because I want to eventually have a master chip stm32f103, controlling a sea of these little pics, dynamically reprogramming them like audio ants.

Read the datasheet for pic16f1704 memory programming- it's all there, the secret code to unlock the chip, the commands to burn and erase, and how to set the configuration. I did have two multi-week headbangs. The first had to do with the specific sequence  to burn, and the second was about configuration bytes and making sure to set them. Typical pic little-headbangs that have used much brainage and forum typing in previous lives...

Not that pics are bad. I used to think they were "boyscoutish" and now I think they are just "cute."  Try programming karplus-strong without floats and multiply, and I didn't even use signed math- you know karplus doesn't need signed math like a IIR filter does? Each string has a floating ground that is contingent on the decay of the noise that was inserted into it (the decay is not by a sub-unity feedback but by sample averaging). That noise is simply anything on your finger, but it can be bolstered by the "noise of computing:" two touchpads that yield the lowest, hairiest bytes of the karplus computation.

To make sure the strings didn't drift too far to a "char boundary," I set up a nice quick bit-if on the input that flipped it in this cute non-linear way. It's noise anyway!

The scale degree and octave computations have some PC displacement math to get to an array of eight-line code blocks that set the clock and string length, and a similar code-block-array responds to interrupts on the circuit-bending inputs.

Leave out all those floats, multiplication, and boil the chip down to eight bits- well actually that was too crunchy so I moved it up to sixteen bits per sample- the chips are low power and have that sound. Glad they're still around!

7 comments:

  1. I have just discovered the Ciat Lonbarde Tocante instruments and I'm very intrigued with your designs and musical innovations. Hope to acquire some of your units soon. Really love the Plumbutter and Zenert synth.

    ReplyDelete

  2. Nice article and thanks for sharing your knowledge. I really appropriate your views.
    raspberry pi training in chandigarh

    ReplyDelete
  3. Using high grade components to produce extremely durable and cost effective products to derive maximum utility, Miracle Electronics is a leading EI transformer manufacturer in India that tests its products before dispatch to ensure faultless operations.
    Power transformers in India | Toroidal transformer in India

    ReplyDelete
  4. Really very informative and creative contents. This concept is a good way to enhance the knowledge.
    thanks for sharing. please keep it up.

    Raspberry Pi training in gurgaon

    ReplyDelete
  5. I am reading your post from the beginning, it was so interesting to read & I feel thanks to you for posting such a good blog, keep updates regularly.This information is really useful to me.
    PHP Industrial Training Mohali
    SEO Training Mohali

    ReplyDelete
  6. Nice post with informative and good quality content. Thank you for sharing this information with us. This is really helpful. Also check lpbs in electrical

    ReplyDelete