The Synthesis ToolKit in C++ (STK)

Home Information Classes Download Usage Mail List Requirements Links FAQ Tutorial

# stk::SingWave Class Reference

STK "singing" looped soundfile class. More...

`#include <SingWave.h>`

Inheritance diagram for stk::SingWave:

List of all members.

## Public Member Functions
| SingWave (std::string fileName, bool raw=false)
| Class constructor taking filename argument.
| ~SingWave (void)
| Class destructor.
void | reset (void)
| Reset file to beginning.
void | normalize (void)
| Normalize the file to a maximum of +-1.0.
void | normalize (StkFloat peak)
| Normalize the file to a maximum of +- peak.
void | setFrequency (StkFloat frequency)
| Set looping parameters for a particular frequency.
void | setVibratoRate (StkFloat rate)
| Set the vibrato frequency in Hz.
void | setVibratoGain (StkFloat gain)
| Set the vibrato gain.
void | setRandomGain (StkFloat gain)
| Set the random-ness amount.
void | setSweepRate (StkFloat rate)
| Set the sweep rate.
void | setGainRate (StkFloat rate)
| Set the gain rate.
void | setGainTarget (StkFloat target)
| Set the gain target value.
void | noteOn (void)
| Start a note.
void | noteOff (void)
| Stop a note.
StkFloat | lastOut (void) const
| Return the last computed output value.
StkFloat | tick (void)
| Compute and return one output sample.
StkFrames & | tick (StkFrames &frames, unsigned int channel=0)
| Fill a channel of the StkFrames object with computed outputs.

## Detailed Description

STK "singing" looped soundfile class.

This class loops a specified soundfile and modulates it both periodically and randomly to produce a pitched musical sound, like a simple voice or violin. In general, it is not be used alone because of "munchkinification" effects from pitch shifting. Within STK, it is used as an excitation source for other instruments.

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

## Constructor & Destructor Documentation

stk::SingWave::SingWave | ( | std::string | fileName,
|  | bool | raw = `false` |
| ) |  |  |

Class constructor taking filename argument.

An StkError will be thrown if the file is not found, its format is unknown, or a read error occurs. If the soundfile has no header, the second argument should be true and the file data will be assumed to consist of 16-bit signed integers in big-endian byte order at a sample rate of 22050 Hz.

## Member Function Documentation

StkFrames & stk::SingWave::tick | ( | StkFrames & | frames,
|  | unsigned int | channel = `0` |
| ) |  |  | `[inline, virtual]`

Fill a channel of the StkFrames object with computed outputs.

The `channel` argument must be less than the number of channels in 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.

Implements stk::Generator.

    00118 {
    00119 #if defined(_STK_DEBUG_)
    00120   if ( channel >= frames.channels() ) {
    00121     oStream_ << "SingWave::tick(): channel and StkFrames arguments are incompatible!";
    00122     handleError( StkError::FUNCTION_ARGUMENT );
    00123   }
    00124 #endif
    00125
    00126   StkFloat *samples = &frames[channel];
    00127   unsigned int hop = frames.channels();
    00128   for ( unsigned int i=0; i<frames.frames(); i++, samples += hop )
    00129     *samples = SingWave::tick();
    00130
    00131   return frames;
    00132 }

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

- SingWave.h

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