   Author Ardcore sketch: NoiseCore random stepped + burst
studiokpg
 Hey, here's a new sketch I made, inspired by Grant Richter's Noise Ring. It uses an 8-bit rotating output "ring" with 1s and 0s being modified by using A2 and A3 as comparators on a random. A2 is similar to the Change knob and A3 is similar to the Chance knob. A0 is tempo, and A1 controls how much the randomness contributes to tempo (similar to ext. rate, except there is no ext. rate input .) When A0 is all the way counterclockwise, it follows external clock instead of the internal clock. D0 is a trigger out that goes with the random stepped voltage. The trigger burst at D1 is based on the random output. A3 doubles as a comparator level on the random; when the random goes below that level, burst is triggered. The number of triggers in the burst depends on how long since the last burst. A1 also doubles as the rate control of the burst triggers. Here is demo on Soundcloud. The main out is controlling a Z3000, the burst is triggering a brains sequence playing a DPO. https://soundcloud.com/studiokpg/noisecore-experiment // ============================================================ // // Program: ArdCore Random Stepped Voltage Generator // Inspired by my limited understanding of Grant Richter's fabulous Noise Ring // in turn inspired by Don Buchla's Source of Uncertainty // and other vaguely understood randomness. // // I/O Usage: // Knob 1 (A0): Tempo (0 = clocked only) // Knob 2 (A1): Amount of random to tempo (unless clocked) and rate of burst triggers // Analog In 1 (A2): Chance input // Analog In 2 (A3): Change input and comparator level for burst likelyhood // Digital Out 1: Clock out // Digital Out 2: Burst triggers out // Clock In: External clock input // Analog Out: Random stepped voltage // // // Created: 3 May 2014 by Karl Gruenewald (studiokpg@gmail.com) // Modified: 27 May 2014 by Karl Gruenewald working on clock input // Modified: 1 June 2014 by Karl Gruenewald adding burst mode // // ================= start of global section ================== // constants related to the Arduino Nano pin use const int clkIn = 2; // the digital (clock) input const int digPin = {3, 4}; // the digital output pins const int pinOffset = 5; // the first DAC pin (from 5-12) const int trigTime = 10; // 10 ms trigger time // variables for interrupt handling of the clock input volatile int clkState = LOW; unsigned int ring; //variable for holding the value unsigned int notring; //for flipping bits int temp; //variable for rotating bits unsigned long nextClock = 0; unsigned long prevClock = 0; unsigned long nextOffClock = 0; unsigned long bNext = 0; unsigned long bNextOff = 0; float clockAmt = 0; float modfactor = 0; int lastRead = 0; int bTrigs = 0; int bRate = 0; boolean burstSet = false; // ==================== start of setup() ====================== void setup() { Serial.begin(9600); // set up the digital (clock) input pinMode(clkIn, INPUT); // set up the digital outputs for (int i=0; i<2; i++) { pinMode(digPin[i], OUTPUT); digitalWrite(digPin[i], LOW); } // set up the 8-bit DAC output pins for (int i=0; i<8; i++) { pinMode(pinOffset+i, OUTPUT); digitalWrite(pinOffset+i, LOW); } // set up the interrupt attachInterrupt(0, isr, RISING); // generate a new random seed randomSeed(analogRead(12)); ring = random(255); } // ==================== start of loop() ======================= void loop() { if (analogRead(0) <= 1) { if (clkState == HIGH) { doRing(); clkState = LOW; prevClock = millis(); } } modfactor = ((ring / 255.0) + 0.5) * ((analogRead(1) + 1.0) / 1700.0); clockAmt = 1023 - analogRead(0) + 5; //5ms is minimum cycle nextClock = prevClock + clockAmt - (clockAmt * modfactor * .75); if (millis() >= nextClock) { if(analogRead(0) > 1) doRing(); } bRate = 200 - (analogRead(1) / 6) ; //burst rate if (burstSet == true && millis() >= bNext) { digitalWrite(digPin, HIGH); bNext = millis() + bRate; bNextOff = millis() + 10; //trig width 10ms for bursts if (bTrigs <= 0) burstSet = false; bTrigs --; } if (millis() >= nextOffClock) digitalWrite(digPin, LOW); if (millis() >= bNextOff) { digitalWrite(digPin, LOW); } } void doRing() { dacOutput(ring); digitalWrite(digPin, HIGH); if (clockAmt <= 20) { nextOffClock = millis() + (clockAmt / 2); //shorter triggers at very fast clocks } else nextOffClock = millis() + trigTime; notring = ~ring; temp = notring & 1; if (random(1023) < analogRead(3)) { if (random(1523) > analogRead(2)+250) { //make it less likely to have all min or max values temp = 0; } else temp = 1; } ring = ring >> 1; temp = temp << 7; ring = ring | temp; prevClock = millis(); if (ring <= (analogRead(3) - 25) / 4 && bTrigs > 0) { //comparator for ring and ar(3) burstSet = true; } else bTrigs ++; if (bTrigs > 10) bTrigs = 10; //limit number of triggers in burst Serial.println(bTrigs); } // =================== convenience routines =================== // dacOutput(byte) - deal with the DAC output // ----------------------------------------- void dacOutput(byte v) { PORTB = (PORTB & B11100000) | (v >> 3); PORTD = (PORTD & B00011111) | ((v & B00000111) << 5); } // isr() - quickly handle interrupts from the clock input // ------------------------------------------------------ void isr() { clkState = HIGH; } // ===================== end of program =======================
eclectics
 This is playing very nicely with my Turing Machine, thanks-- I'm using the burst to drive the TM clock, and the 2 random sources are cving oscillators, then ring modding the output.
studiokpg
 Glad you like it!
paperwork
 This is great - thanks! Playing around with it this afternoon: http://sourceofuncertainty.tumblr.com/post/88014482984/noisy-rhythms
paperwork
 Just finally picked up an Ardcore expander & this sketch is great with it! It exposes the 8 bits of the value on individual outputs. It's a bit like the behavior of the "pulses" expander for the Turing Machine, particularly when feeding a few bits into a logic module for AND/OR/XOR combinations.
onurkalaycioglu
 great sketch
 Page 1 of 1
Powered by phpBB © phpBB Group