MUFF WIGGLER Forum Index

 FAQ & Terms of UseFAQ & Terms Of Use   Wiggler RadioMW Radio   Muff Wiggler TwitterTwitter   Support the site @ PatreonPatreon 
 SearchSearch   RegisterSign up   Log inLog in 
WIGGLING 'LITE' IN GUEST MODE

infinite wave folder
MUFF WIGGLER Forum Index -> Music Tech DIY Goto page Previous  1, 2 [all]
Author infinite wave folder

smonkey

Just so ya's know.

You have redeemed my faith in the DIY section of the forum.

I was just lamenting that it mainly "available", "kit", "buy a pcb"
rather than interesting discussions of DIYness

(to be fair, I love kits, pcbs and I like 'em available, I just think there should be a separate for sale section for that shit)

and DIY should be talking about "doing stuff yerself". like discussions of "hw I built this kit" or

well...this beautiful thread here.

well done that man!


plugugly

Agreed.


elmegil

Very nice stuff. Wish I had time to experiment with it, I've just gotten interested in wavefolders what with the lockhart in Dustin's Dual Complex VCO.... Will watch closely smile


Phetus

guest wrote:
Phetus wrote:
I'm really interested in the infinite wavefolder. Is there any guinea-pigging to be done? I'd love to help, if I can.


if you have parts kicking around, you could breadboard it and start in on the main problem: slow comparators/switches. right now the whole thing is limited because it takes a few microseconds to slew. doing all the logic on a 5V rail and level shifting would help immensely.


I'm right in thinking I could use 4 TL074s right? I just need 11 Op amps dont I?

Edit: Nope. Ok to be honest i have no idea. I'll come back when I know a bit more.


guest

so i finally got a bit of free time and did an implentation of the analog circuit in digital. its actually just a few lines of code it turns out. the AGC isnt implemented, but its a proof of concept.



its done with an arduino and a codecshield. the codec is running at 44ksps, so top frequency is 20kHz, which is why the edges start rounding off sooner than the analog version (although this should be inaudible).

there is some aliasing from my camera, and there are clicks from the function generator changing ranges.

the 2 main differences between this and the analog: 1. it can easily obtain any frequency up to 20Khz, whereas the analog version needs some serious work to speed up enough. 2. it is much more stable - the analog version had no DC stability, and as such would sometimes lock into these chaotic modes, which had a great sound. sort of a low frequency modulation. perhaps that could be replicated as well.

and here is the code, if anyone is interested. im thinking there must be a better way of doing it that doesnt truncate the data so much. basically, the output is limited to the range set by the wavefolding boundaries. as these boundaries get smaller (and the frequency goes higher), the range of values you can have goes down. in this example, its down to 8 bits.

there werent any "code" insertion buttons, so hopefully this works.

Code:

// setup codec parameters
// must be done before #includes
// see readme file in libraries folder for explanations
#define SAMPLE_RATE 44 // 44.1Khz
#define ADCS 0 // no ADCs are being used

// include necessary libraries
#include <Wire.h>
#include <SPI.h>
#include <AudioCodec.h>

// create data variables for audio transfer
int left_in = 0x0000;
int left_out = 0x0000;
int right_in = 0x0000;
int right_out = 0x0000;

int last_value = 0x0000;
int pos_thresh = 0x0100;
int neg_thresh = -0x0100;
byte state = 0x00;

void setup() {
  AudioCodec_init(); // setup codec registers
  // call this last if setting up other parts
}

void loop() {
  while (1); // reduces clock jitter
}

// timer1 interrupt routine - all data processed here
ISR(TIMER1_COMPA_vect, ISR_NAKED) { // dont store any registers

  // &'s are necessary on data_in variables
  AudioCodec_data(&left_in, &right_in, left_out, right_out);
 
  int difference = left_in - last_value;
  last_value = left_in;
  if (state) {
    left_out -= difference;
  }
  else {
    left_out += difference;
  }
  if (left_out >= pos_thresh) {
    state ^= 0x01;
    left_out = pos_thresh - (left_out - pos_thresh);
  }
  else if (left_out <= neg_thresh) {
    state ^= 0x01;
    left_out = neg_thresh - (left_out - neg_thresh);
  }

  right_out = left_out << 6;

  // dont forget to return from interrupt
  reti();
}



notmiserlouagain

applause


Randy

Wow, that's cool!

Randy


smrl

Played around with this code a little bit with a friend. I suggested we forego the folded output, and try to emulate the CGS VCO staircase generator by incrementing a variable with a "pulse" every time state changes. It continues to increase until it reaches a threshold at which point you return the variable to 0. (discharge the integrator) Scale that signal, and you've got a staircase output which similarly loses bits of information the lower the divisor BUT you can get a very interesting harmonically-related set of pitches out of it. It becomes a ratio generator - input a VCO, a number of folds (the multiplier) and a staircase height (the divisor), and you can derive another output at a just intoned interval.

Probably my biggest interest in wavefolders to date has been to generate these rational-frequency child tones from a VCO. The beauty in this technique, when using an analog multiplier and staircase generator, is that you can get these resultant pitches which track along with the input frequency perfectly. And of course, with a stereo codec, you could generate two different intervals simultaneously! Also, sweeping one or the other parameter makes some very interesting scales and sequences.

I'd post code but we prototyped it in Pippi, his generative music platform built on top of python. I think he's going to port it to C - if not I will, but I just explained it's operation which is really straightforward. I was thinking this might even run on an arduino with its 10-bit ADC into a resistor ladder DAC. That could make a delightfully crude, cheap circuit! Probably it would have to get reduced to 3 or 4 bits at the output to do this. Once again we're trading bit depth for the function. Unless this gives someone any bright ideas.


guest

ha, i just posted about this in the microdec thread. it definitely would be good to have something like that, and the code is quite similar. the codecshield works well, but for a cheaper variant, the stompshield is pretty close. it used the onboard ADC, and a dual PWM output for 16b resolution. all the plans are online, all that would need changing is to make it DC coupled (get rid of blocking caps). i wish i had more time right now to bang out a demo. i thought of another way of doing the math that is more DC stable, and makes the scaling more tractable (no divides!).


hecanjog

Hey, I'm the friend smrl mentioned earlier -- this has been so much fun to play with -- thanks so much for sharing it!

I finally got around to moving this into a python C extension today (although I haven't added smrl's staircase variation yet)

Here's a usage example with my janky python computer music system, pippi: https://gist.github.com/hecanjog/58def5e6363f371766fe

(Pippi can be found here: https://github.com/hecanjog/pippi Be sure to explicitly checkout master after cloning, github seems to select the empty github-pages branch I no longer use by default...)

And a little jamming with a buncha them at once: https://soundcloud.com/hecanjog/wave-folding (whoops also just noticed the silence at the end of the recording after uploading...)

The input for most of it is just a sinewave, but at the end I started throwing arbitrary wavetables at it and increasing the multiplication factor a lot.


guest

that sounded awesome. i love how it shimmers, and noisey bit at the end was great.


Neutron7

I will try your code in my teensy 3.1 oscillator, its going at 84khz.


hecanjog

guest wrote:
that sounded awesome. i love how it shimmers, and noisey bit at the end was great.


thanks! i'm looking forward to playing around with it more.

MUFF WIGGLER Forum Index -> Music Tech DIY Goto page Previous  1, 2 [all]
Page 2 of 2
Powered by phpBB © phpBB Group