login

online now

We have 123 guests and no members online

search

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

TOPIC: Release Time???

Release Time??? 6 years 4 weeks ago #188

I can't seem to get the release time to behave properly. With the following code...

void callMEcrazy()
{

s->selectBank ( BANK_A );

s->setPatch ( OSC_1_TO_MIXER | OSC_2_TO_MIXER | OSC_3_TO_MIXER ) ;

s->setWaveform ( OSC_ALL , SAWTOOTH );
s->setNote ( OSC_1 , C_3 );
s->setNote ( OSC_2 , E_3 );
s->setNote ( OSC_3 , G_3 );
s->setEnvelope ( OSC_ALL , AT_8MS , 1.0f , DR_10MS , 0.3f , DR_4873MS , 0.0f );

delay ( 1000 );

s->trigger ( OSC_ALL );
delay ( 100 );
s->release ( OSC_ALL );
delay ( 20000 );

}


I've recorded the output and when analyzing the waveform the release time only lasts for 1.5 seconds despite the 4.873 second release setting. Is there another envelope that is affecting this or do I need to adjust the amplitude setting somewhere else? I can't figure it out. The attack and decay stages are accurate.

What am I missing?

thanks
john
The administrator has disabled public write access.

Re: Release Time??? 6 years 4 weeks ago #189

After a bit of testing I found out the problem.

In your setEnvelope() call you are setting the decay amplitude to 0.3, which starts the release cycle with that volume level. The release time is a ramp rate ( and not a fixed value as it might suggest ), so the actual time it takes to go to zero is about 0.3 times as long, which is 1.46 seconds.

If you need a longer time, you could enable slow clock, which scales the timing part of the system down:
  GS.getMaster()->enableSlowClock(true);

The exact amount that the clock slows down as a result of this change is undocumented, but in my quick test it seems to be about the amount that you are looking for. One caveat is that this will affect the timing for the other values by the same amount.

An alternative to slow clock is to set the time scalar itself. In the datasheet you can also set a register called "Internal Clock", which is used to divide the system clock into the time that is 1 millisecond. The default value is 113, but you can set this register to any value that works. You will still have the same caveat, but you have more control over the variation in timing. Here is an example that will double the timing unit in the system:
 
  // get the current clock scalar ( for testing )

  ubyte internalClockScalar = GS.readRegister ( InternalClock );

  // scale the divisor by two ( doubling time scale )
  
  internalClockScalar /= 2;


  // set the new value to the clock register
   
  GS.sendCommand ( WriteOneByte , InternalClock , internalClockScalar );

Since the ADSR values are selections and not specific values, you will need to figure out what the actual time values will be with the scalar you use, and then pick the ADSR values that best meet those times.
Last Edit: 6 years 4 weeks ago by administrator.
The administrator has disabled public write access.
  • Page:
  • 1
Time to create page: 0.347 seconds