No announcement yet.


  • Filter
  • Time
  • Show
Clear All
new posts

  • Quantizer?

    Is there any existing code that will generate tuned pitch output on one of the CV outs? I'd like to program a quantizer, using 1v/8va CV in and out.

    I don't have a Euroshield yet -- I've been experimenting with the built-in DAC on a Teesny, but without any of the necessary circuitry to make the output stable (just some resistors and diodes for protection). Euroshield seems like a no-brainer to keep dabbling. I'm just curious if I'd have to figure this out from scratch, or if there's sample code for reading voltage in, and setting a specific voltage on the CV out.


  • #2
    I'm actually working on one right now! No ETA, but it should be soon that I upload a working model to GitHub and here.


    • #3
      Basically, you virtually wire the input you want to a Peak detector, using the Teensy Audio Library GUI thing, and then a DC module to the output you want. Input peak then determines the DC value at the output. "notezero" is basically what the serial monitor reads at 0V in, and "notespace" is the distance between semitones.

      Then, do something like this:

      #define notezero 0.02455
      #define notespace 0.01685
      #define notewidth 0.01685 * 0.5
      #define notewidthoffset 0.0001

      if (peak1.available())
      float peakValue1 =;
      if ((float (peakValue1)) >= notezero - notewidth && (float (peakValue1)) <= notezero + (notewidth - notewidthoffset))
      dc1.amplitude((float) notezero);
      else if ((float (peakValue1)) >= notezero + notewidth && (float (peakValue1)) <= (notezero + (notewidth * 2) - notewidthoffset))
      dc1.amplitude((float) notezero + notespace);

      etc etc


      • #4
        Here's the code for one octave of the major scale (I'm a newbie coder, so I'm working on incorporating more octaves and more scales, bear with me):