login

online now

We have 48 guests and no members online

search

 

 

polymode_diag


 

Poly mode configures the system to work as a 6 voice polyphonic waveform generator. This mode is a simple configuration of synth mode that patches each available oscillator directly to the output mixer and initially configures envelopes and waveforms of each oscillator (or voice) to identical settings. This is a useful mode when you would like to create a simple polyphonic instrument for song composition and/or maximize all the oscillator output.

Each voice can be indivually programmed with a frequency or musical note, a waveform (with duty cycle on pulse), and an ADSR envelope. The interface provides the ability to configure the voices individually or all together. The output of the voices are patched to the main output that also has a configurable ADSR envelope that affects the output as a whole.

The code below illustrates how you would play a simple 3 part song with the default waveform (sine) and output envelope:

  
GinSingPoly * poly = GS.getPoly();                           // get the poly mode interface
poly->begin ();                                              // enter poly mode

#define BASSVOICE 0                                          // use voice 0 (of 6) for the bass line
#define LEADVOICE 1                                          // use voice 1 for the lead
#define TREBVOICE 2                                          // use voice 2 for the treble
 
#define NumNotes 10
GSNote bass[NumNotes] = { C_3 , E_3 , D_3 , F_3 , E_3 , G_3 , E_3 , F_3 , D_3 , E_3  };
GSNote lead[NumNotes] = { C_6 , D_6 , E_6 , F_6 , G_6 , G_6 , F_6 , E_6 , D_6 , C_6  };
GSNote treb[NumNotes] = { G_5 , E_5 , F_5 , D_5 , E_5 , C_5 , E_5 , D_5 , F_5 , E_5  };

for ( int loopCnt = 0; loopCnt < 8; loopCnt++ )               // run through our ditty this many times
{
  for ( int noteIdx = 0; noteIdx < NumNotes; noteIdx++ )      // cycle through the notes
  {
      poly->setNote ( BASSVOICE , bass [ noteIdx ] );         // set the current bassline note
      poly->trigger ( BASSVOICE );                            // trigger the envelope
        
      poly->setNote ( TREBVOICE , treb [ noteIdx ] );         // set the current treble note
      poly->trigger ( TREBVOICE );                            // trigger the envelope
        
      poly->setNote ( LEADVOICE , lead [ noteIdx ] );         // set the current leadline note
      poly->trigger ( LEADVOICE );                            // trigger the envelope
       
     delay ( 250 );                                           // wait 1/4 second before the next note
    }
}