The Synthesis ToolKit in C++ (STK)

Home Information Classes Download Usage Mail List Requirements Links FAQ Tutorial

# stk::NRev Class Reference

CCRMA's NRev reverberator class. More...

`#include <NRev.h>`

Inheritance diagram for stk::NRev:

List of all members.

## Public Member Functions
| NRev (StkFloat T60=1.0)
| Class constructor taking a T60 decay time argument (one second default value).
void | clear (void)
| Reset and clear all internal state.
void | setT60 (StkFloat T60)
| Set the reverberation T60 decay time.
StkFloat | lastOut (unsigned int channel=0)
| Return the specified channel value of the last computed stereo frame.
StkFloat | tick (StkFloat input, unsigned int channel=0)
| Input one sample to the effect and return the specified `channel` value of the computed stereo frame.
StkFrames & | tick (StkFrames &frames, unsigned int channel=0)
| Take a channel of the StkFrames object as inputs to the effect and replace with stereo outputs.
StkFrames & | tick (StkFrames &iFrames, StkFrames &oFrames, unsigned int iChannel=0, unsigned int oChannel=0)
| Take a channel of the `iFrames` object as inputs to the effect and write stereo outputs to the `oFrames` object.

## Detailed Description

CCRMA's NRev reverberator class.

This class takes a monophonic input signal and produces a stereo output signal. It is derived from the CLM NRev function, which is based on the use of networks of simple allpass and comb delay filters. This particular arrangement consists of 6 comb filters in parallel, followed by 3 allpass filters, a lowpass filter, and another allpass in series, followed by two allpass filters in parallel with corresponding right and left outputs.

by Perry R. Cook and Gary P. Scavone, 1995-2012.

## Member Function Documentation

StkFloat stk::NRev::lastOut | ( | unsigned int | channel = `0` | ) | `[inline]`

Return the specified channel value of the last computed stereo frame.

Use the lastFrame() function to get both values of the last computed stereo frame. The `channel` argument must be 0 or 1 (the first channel is specified by 0). However, range checking is only performed if _STK_DEBUG_ is defined during compilation, in which case an out-of-range value will trigger an StkError exception.

    00093 {
    00094 #if defined(_STK_DEBUG_)
    00095   if ( channel > 1 ) {
    00096     oStream_ << "NRev::lastOut(): channel argument must be less than 2!";
    00097     handleError( StkError::FUNCTION_ARGUMENT );
    00098   }
    00099 #endif
    00100
    00101   return lastFrame_[channel];
    00102 }

StkFloat stk::NRev::tick | ( | StkFloat | input,
|  | unsigned int | channel = `0` |
| ) |  |  | `[inline]`

Input one sample to the effect and return the specified `channel` value of the computed stereo frame.

Use the lastFrame() function to get both values of the computed stereo output frame. The `channel` argument must be 0 or 1 (the first channel is specified by 0). However, range checking is only performed if _STK_DEBUG_ is defined during compilation, in which case an out-of-range value will trigger an StkError exception.

    00105 {
    00106 #if defined(_STK_DEBUG_)
    00107   if ( channel > 1 ) {
    00108     oStream_ << "NRev::tick(): channel argument must be less than 2!";
    00109     handleError( StkError::FUNCTION_ARGUMENT );
    00110   }
    00111 #endif
    00112
    00113   StkFloat temp, temp0, temp1, temp2, temp3;
    00114   int i;
    00115
    00116   temp0 = 0.0;
    00117   for ( i=0; i<6; i++ ) {
    00118     temp = input + (combCoefficient_[i] * combDelays_[i].lastOut());
    00119     temp0 += combDelays_[i].tick(temp);
    00120   }
    00121
    00122   for ( i=0; i<3; i++ )    {
    00123     temp = allpassDelays_[i].lastOut();
    00124     temp1 = allpassCoefficient_ * temp;
    00125     temp1 += temp0;
    00126     allpassDelays_[i].tick(temp1);
    00127     temp0 = -(allpassCoefficient_ * temp1) + temp;
    00128   }
    00129
    00130          // One-pole lowpass filter.
    00131   lowpassState_ = 0.7 * lowpassState_ + 0.3 * temp0;
    00132   temp = allpassDelays_[3].lastOut();
    00133   temp1 = allpassCoefficient_ * temp;
    00134   temp1 += lowpassState_;
    00135   allpassDelays_[3].tick( temp1 );
    00136   temp1 = -( allpassCoefficient_ * temp1 ) + temp;
    00137
    00138   temp = allpassDelays_[4].lastOut();
    00139   temp2 = allpassCoefficient_ * temp;
    00140   temp2 += temp1;
    00141   allpassDelays_[4].tick( temp2 );
    00142   lastFrame_[0] = effectMix_*( -( allpassCoefficient_ * temp2 ) + temp );
    00143
    00144   temp = allpassDelays_[5].lastOut();
    00145   temp3 = allpassCoefficient_ * temp;
    00146   temp3 += temp1;
    00147   allpassDelays_[5].tick( temp3 );
    00148   lastFrame_[1] = effectMix_*( - ( allpassCoefficient_ * temp3 ) + temp );
    00149
    00150   temp = ( 1.0 - effectMix_ ) * input;
    00151   lastFrame_[0] += temp;
    00152   lastFrame_[1] += temp;
    00153
    00154   return lastFrame_[channel];
    00155 }

StkFrames& stk::NRev::tick | ( | StkFrames & | frames,
|  | unsigned int | channel = `0` |
| ) |  |  |

Take a channel of the StkFrames object as inputs to the effect and replace with stereo outputs.

The StkFrames argument reference is returned. The stereo outputs are written to the StkFrames argument starting at the specified `channel`. Therefore, the `channel` argument must be less than ( channels() - 1 ) of the StkFrames argument (the first channel is specified by 0). However, range checking is only performed if _STK_DEBUG_ is defined during compilation, in which case an out-of-range value will trigger an StkError exception.

StkFrames& stk::NRev::tick | ( | StkFrames & | iFrames,
|  | StkFrames & | oFrames,
|  | unsigned int | iChannel = `0`,
|  | unsigned int | oChannel = `0` |
| ) |  |  |

Take a channel of the `iFrames` object as inputs to the effect and write stereo outputs to the `oFrames` object.

The `iFrames` object reference is returned. The `iChannel` argument must be less than the number of channels in the `iFrames` argument (the first channel is specified by 0). The `oChannel` argument must be less than ( channels() - 1 ) of the `oFrames` argument. However, range checking is only performed if _STK_DEBUG_ is defined during compilation, in which case an out-of-range value will trigger an StkError exception.

The documentation for this class was generated from the following file:

- NRev.h

The Synthesis ToolKit in C++ (STK)
©1995-2012 Perry R. Cook and Gary P. Scavone. All Rights Reserved.