login

online now

We have 171 guests and no members online

search

 
Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC: Gong preset

Gong preset 6 years 3 months ago #105

I would like to start the gong preset and use a delay to have it once , twice or three times
But it seems that the gong cycle has his own timing and it's not started "exactly" when needed. Sometime you hear the end of the previous cycle.
Maybe I got the code wrong
Can you help me to precisely trigger the gong ?
thanks

preset->begin ();
preset->load ( 0 , (GSPreset) 3 ); // load the selected preset on bank 0
delay ( 1500 ); // waiting of the system to be ready ?? unnecessary ?
preset->trigger ( 0 ); // trigger the preset on bank 0
delay ( 1200 ); // listen to it for one cycle (+/ 1200 ms)
preset->release ( 0 );
The administrator has disabled public write access.

Re: Gong preset 6 years 3 months ago #110

The basic problem is the way that the Gong preset is configured to repeat, but have no fear - I have a different method that will work fine for you.

The preset utilizes DCO 2 to retrigger the gong on a fixed time interval, which would make it tricky to manually trigger because although it is periodic, it is not turned on or off, but runs continuously. Its easy to see how this effect is set up if you view it in the pc link:


Gong.jpg



The Gong effect utilizes all three of the oscillators. OSC_1 is a 21 Hz sinewave that is the base tone sent to the output. OSC_2 is an amplitude modulator for OSC_1 and runs a sawtooth, which is where the volume control is happening. OSC_3 ass the warble using frequency modulation on OSC_1. Taking the information from this page, I can recreate the sound effect directly in code as follows:
void playOrigGong()
{
  
  // this is the gong sound effect preset in synth format
  
  synth->selectBank ( BANK_A );
  synth->setPatch ( OSC_1_TO_MIXER | OSC_2_AMPMOD_OSC_1 | OSC_3_FRQMOD_OSC_1);
 
  synth->setAmplitude ( OSC_1 , 0.990f );
  synth->setFrequency ( OSC_1 , 21.698f );
  synth->setWaveform  ( OSC_1 , SINE   );
  
  synth->setAmplitude ( OSC_2 , 0.830f );
  synth->setFrequency ( OSC_2 , 0.477f );
  synth->setWaveform  ( OSC_2 , SAWTOOTH );
  synth->setWavemode  ( OSC_2 , POSITIVE );
  
  synth->setAmplitude ( OSC_3 , 0.540f );
  synth->setFrequency ( OSC_3 , 109.63f );
  synth->setWaveform  ( OSC_3 , SINE );
  synth->setWavemode  ( OSC_3 , POSITIVE );
    
  synth->trigger      ( OSC_1 );
  synth->trigger      ( OSC_2 );
  synth->trigger      ( OSC_3 );
  
}

So the basic problem is that trying to use OSC_2 to run the amplitude envelope is not convenient in this case since its actually looping constantly. To make this effect retriggerable, you can replace OSC_2 with the ADSR envelope on OSC_1 - this allows the volume to fall off in the same manner but with your own timing. You can also retrigger the effect without worrying about the specific timing. To do this, You can remove OSC_2 completely and instead set the envelope on OSC_1:
void playNewGong()
{
  GinSingMaster * master = GS.getMaster();
  
  synth->selectBank ( BANK_A );
  synth->setPatch ( OSC_1_TO_MIXER | OSC_3_FRQMOD_OSC_1);
 
  synth->setEnvelope   ( OSC_1 , AT_2MS , 0.990f , DR_2MS , 0.990f , DR_1500MS , 0.0f );

  synth->setFrequency ( OSC_1 , 21.698f );
  synth->setWaveform  ( OSC_1 , SINE   );
  
  synth->setAmplitude ( OSC_3 , 0.540f );
  synth->setFrequency ( OSC_3 , 109.63f );
  synth->setWaveform  ( OSC_3 , SINE );
  synth->setWavemode  ( OSC_3 , POSITIVE );
    
  synth->trigger      ( OSC_1 );
  synth->trigger      ( OSC_3 );
  synth->release      ( OSC_1 );
}

As you can see, this code sets the envelope on the oscillator. The triggering code at the bottom of this function can be used over and over to retrigger the sound as needed. Note that OSC_1 is triggered and then released immediately to invoke the envelope, although you could put a time delay between trigger and release if you wanted the gong sound to last longer.

Hopefully that answers your question. Let me know if you need any more help.
Last Edit: 6 years 3 months ago by administrator.
The administrator has disabled public write access.

Re: Gong preset 6 years 3 months ago #118

Thanks a lot for these - clear - explanations
I have also installed the Soungin console software : it helps to understand of the chip works
Finally I got this setting to simulate a bell - gong sound
void playNewGong()
{
 GinSingMaster * master = GS.getMaster();

 synth->selectBank ( BANK_A );
 synth->setPatch ( OSC_1_TO_MIXER | OSC_3_FRQMOD_OSC_1);

 synth->setEnvelope   ( OSC_1 , AT_2MS , 1.0f , DR_2MS , 0.990f , DR_2785MS , 0.0f );
 synth->setAmplitude ( OSC_1 , 0.5f );
 synth->setFrequency ( OSC_1 , 440.0f );
 synth->setWaveform  ( OSC_1 , SINE   );

 synth->setAmplitude ( OSC_3 , 0.4f );
 synth->setFrequency ( OSC_3 , 420.0f );
 synth->setWaveform  ( OSC_3 , SINE );
 synth->setWavemode  ( OSC_3 , SYMMETRIC );

  synth->trigger      ( OSC_3 );
  synth->trigger      ( OSC_1 );
  synth->release      ( OSC_1 );
}
The administrator has disabled public write access.
  • Page:
  • 1
Time to create page: 0.158 seconds