Page 1 of 1

Oscillator troubles

Posted: Mon Jun 08, 2020 9:54 pm
by PnkMyo
Sorry if this is a dumb question, but I have been trying for days to get this to work.

So, I'm trying to make a simple oscillator module, right ? WELL, I've been having some trouble. The oscillator is way out of tune. I've tried so many methods, so many numbers, so much stuff... I can't get it to sound right now matter what I do. And I've looked a lot of places for answers, even here on the forums, but... Nothing. This stuff doesn't feel very well documented, but, eh, it's fine. Most of it is self-explanatory... EXCEPT for this.

Code: Select all

   if (cvJack.IsConnected()){
      cvValue = cvJack.GetValue() * 131;
   } 
Here's what I have now ^
A friend suggested 131. It didn't work.

Is anyone able to help me with this ? >:

Re: Oscillator troubles

Posted: Mon Jun 08, 2020 10:57 pm
by terrymcg
PnkMyo wrote: Mon Jun 08, 2020 9:54 pm

Code: Select all

   if (cvJack.IsConnected()){
      cvValue = cvJack.GetValue() * 131;
   } 
I think this thread might help: viewtopic.php?f=8&t=974&hilit=volts

You'll find good volts to frequency math in there.

Cheers,
--
Terry McG

Re: Oscillator troubles

Posted: Mon Jun 08, 2020 11:41 pm
by PnkMyo
Okay, so I've looked through there... And this is what I've got now.
Maybe I'm blind, but it's not working too well.

Code: Select all

   if (cvJack.IsConnected()){
      cvValue = cvJack.GetValue();
   } 
   
   double x = cvJack.GetValue();
   
   if (outputJack.IsConnected()){   
      osc.SetFrequency((55.0*2*(x+0.25))  + coarseValue + fineValue);
      if (sawsineBool == 0){
      outputJack.SetValue(osc.GetSineValue());
      }
      if (sawsineBool == 1){
      outputJack.SetValue(osc.GetTriangleValue());
      }
           osc.AdvanceSample(); 
      }
      

I've already tried ^ in the place of the * between 2 and (...
It just gave me an error.
I dunno, I'm very confused. I also barely slept, so brain no work good :L

Re: Oscillator troubles

Posted: Tue Jun 09, 2020 2:27 am
by PnkMyo
I'm getting closer... But I'm still not there yet.

Code: Select all

      osc.SetFrequency((Math.round(55.0 * Math.round(x * (x + .25))))  + coarseValue + fineValue);
^ This was after MANY different iterations... I'm still WAY off, though. It's overly complicated, too >:

By the way, I forgot to say this, but thank you so much for helping me ;-;

Re: Oscillator troubles

Posted: Tue Jun 09, 2020 3:54 am
by PnkMyo
SOLVED !!! IT WORKS !!!!!!
My friend helped me with this ! :D
I'm so happy ;u;

Code: Select all

   double x = cvJack.GetValue();
   
   if (outputJack.IsConnected()){   
       osc.SetFrequency(
     55 * Math.pow(2, x)
);
For those who may need it, who are dumb like me...
(It was so OBVIOUS ! I can't believe this ! ...Oh right, lack of sleep.)

Re: Oscillator troubles

Posted: Tue Jun 09, 2020 10:34 pm
by terrymcg
Congratulations, and happy freq-ing! ;)