Newbie question: writing a super fast VCO


#1

I'd like to create a really fast square/pulse VCO that's running at a higher frequency than the factory VCOs. Basically as fast as the Axoloti will let me (how much kHz would that be?). The object should have an inlet and a dial to set the frequency.

I'm not totally new to coding and tried to modify the cheap square factory object, but I don't really understand how loops work in Axoloti (k-rate/s-rate) and how to make the inlet/dial thing.

Can somebody help me with this?

EDIT: here is what I came up coming from the cheap square object, creating a fixed square wave OSC running at maximum speed (I guess):

int j;
int on = 0;

for(j=0;j<BUFSIZE;j++){

if (on == 0){
 outlet_outlet[j] = (1<<26);
on = 1;       
} else {
   outlet_outlet[j] = -(1<<26);
   on = 0;
}

}


#2

I would expect the maximum achievable under an S-Rate object, would be at 48khertz..
:thinking:
Not sure about your code though, If I was going for the max freq possible, I would probably do something like. Note sure if it is the best way though, others may have a very different approach.

int j;
if (j == 1) {
outlet_outlet = 0;
j = 0;
} else {
outlet_outlet = 1;
j = 1;
}


#3

Other version (although I don't have my axoloti here to try it out):
for(j=0;j<BUFSIZE;j=j+2){
outlet_outlet[j] = (1<<26);
outlet_outlet[j+1] = -(1<<26);
}


#4

Thanks! That worked. I had tried something similar but somehow got an error that the loading of the patch onto the Axoloti took too long and was cancelled.

Now I just need to figure out a way how to control the speed with an external control knob.


#5

Thanks! This one throws an error though regarding the [j] and outlet_outlet[j+1] after the outlet_outlet.


#6

24khz, a cycle takes 2 samples.

gpio input, then change the number of samples high/low, if your taking this over bufsize then you will obviously need to track across k-rate cycles.
(bare in mind the cheap versions will alias )


#7

@TB, thanks, forgot to consider that, still quite new to these concepts.
Understand when its mentioned, don't know how to remember it when needed.. oh well, wouldn't recognize it at all if it weren't for this forum..
:stuck_out_tongue_winking_eye: