How to asign AnalogOscillator() output to a jack?

Post Reply
jugwine1
Posts: 3
Joined: Mon May 15, 2023 11:24 pm

How to asign AnalogOscillator() output to a jack?

Post by jugwine1 »

Hi. I've entered the world of module development. I'm working my way through the documentation.. which is OK.. but I'm struggling to figure out how to connect the output of an AnalogOscillator to an outputJack.

Could someone provide a code snippet? Thanks
jugwine1
Posts: 3
Joined: Mon May 15, 2023 11:24 pm

Re: How to asign AnalogOscillator() output to a jack?

Post by jugwine1 »

I figured it out.

Put this inside

Code: Select all

ProcessSample()

Code: Select all

    outputJack1.SetValue(osc1.GetPulseValue());
    osc1.AdvanceSample();
Centripidity
Posts: 146
Joined: Sun Jan 22, 2023 5:18 am
Location: Melbourne
Contact:

Re: How to asign AnalogOscillator() output to a jack?

Post by Centripidity »

Have a look at the Sample Module LFO Demo that comes with the Voltage Developer Kit.

Code: Select all

   public void ProcessSample()
   {
      // add your own code here

      // If the rateValue variable has changed since the last sample,
      // set the oscillator to the new frequency.
      if (rateValue != lastRateValue)
      {
         osc.SetFrequency(rateValue);
         lastRateValue = rateValue;      
      }

      // Get the square wave output from the oscillator
      double squareValue = osc.GetSquareValue();
      
      // If the square wave is positive, turn the LED on.
      // If the square wave is negative, turn the LED off.
      if (LEDOn == false && squareValue > 0)
      {
         // This turns the LED on (by setting its value to 1.0)
         rateLED.SetValue(1.0, true);
         LEDOn = true;
      }
      else if (LEDOn == true && squareValue <= 0)
      {
         // This turns the LED off (by setting its value to 1.0)
         rateLED.SetValue(0, true);
         LEDOn = false;   
      }
      

      // This places the square wave signal onto any wires connected
      // to the Square Out output jack.
      squareOut.SetValue(squareValue);
      
      // This places the triangle wave signal onto any wires connected
      // to the Triangle Out output jack.
      triangleOut.SetValue(osc.GetTriangleValue());

      // Advance the oscillator to the next sample
      osc.AdvanceSample();               
   }
Centripidity
Posts: 146
Joined: Sun Jan 22, 2023 5:18 am
Location: Melbourne
Contact:

Re: How to asign AnalogOscillator() output to a jack?

Post by Centripidity »

You also might want to check out this VERY generous thread.

viewtopic.php?t=2354
jugwine1
Posts: 3
Joined: Mon May 15, 2023 11:24 pm

Re: How to asign AnalogOscillator() output to a jack?

Post by jugwine1 »

thank you
Post Reply

Return to “Module Designer”