Jamoma API  0.6.0.a19
TTRosenbergGlottalPulseWindow.cpp
Go to the documentation of this file.
1 /** @file
2  *
3  * @ingroup dspWindowFunctionLib
4  *
5  * @brief Rosenberg Glottal Pulse Window Function Unit for Jamoma DSP
6  *
7  * @details This implements a window function as described here: @n
8  * https://ccrma.stanford.edu/~jos/sasp/Kaiser_Window.html @n
9  * http://en.wikipedia.org/wiki/Window_function#Kaiser_windows @n
10  * @n
11  * This window can be used as a glottal pulse in voice and speech synthesis.
12  *
13  * @authors Trond Lossius
14  *
15  * @copyright Copyright © 2013 by Trond Lossius @n
16  * This code is licensed under the terms of the "New BSD License" @n
17  * http://creativecommons.org/licenses/BSD/
18  */
19 
21 
22 
23 #define thisTTClass RosenbergGlottalPulseWindow
24 #define thisTTClassName "rosenbergGlottalPulse"
25 #define thisTTClassTags "dspWindowFunctionLib, audio, processor, function, window, voice, speech"
26 
27 
28 TT_AUDIO_CONSTRUCTOR
29 {
30  addAttribute(Ratio, kTypeFloat64);
31  addAttributeProperty(Ratio, range, TTValue(kTTEpsilon, 1.0-kTTEpsilon)); // Avoid dividing by 0
32  addAttributeProperty(Ratio, rangeChecking, TT("clip"));
33 
34  // Set Defaults:
35  setAttributeValue(TT("ratio"), 0.6);
36 
37  setProcessMethod(processAudio);
38  setCalculateMethod(calculateValue);
39 }
40 
41 
42 RosenbergGlottalPulseWindow::~RosenbergGlottalPulseWindow()
43 {
44  ;
45 }
46 
47 
49 {
50  if ( (x>=0.) && (x<=mRatio) )
51  y = 0.5 * ( 1.0 - cos((kTTPi*x)/mRatio) );
52  else if ( (x>mRatio) && (x<=1.) )
53  y = cos(kTTPi*(x-mRatio)/(2*(1.0-mRatio)));
54  else
55  y = 0.;
56  return kTTErrNone;
57 }
58 
59 
61 {
62  TT_WRAP_CALCULATE_METHOD(calculateValue);
63 }
64 
#define addAttribute(name, type)
A convenience macro to be used by subclasses for registering attributes with a custom getter...
Definition: TTAttribute.h:29
#define setProcessMethod(methodName)
A convenience macro to be used by subclasses for setting the process method.
double TTFloat64
64 bit floating point number
Definition: TTBase.h:188
#define TT
This macro is defined as a shortcut for doing a lookup in the symbol table.
Definition: TTSymbol.h:155
#define setCalculateMethod(methodName)
A convenience macro to be used by subclasses for setting the calculate method.
64-bit floating point
Definition: TTBase.h:272
#define addAttributeProperty(attributeName, propertyName, initialValue)
A convenience macro to be used for registering properties of attributes.
Definition: TTAttribute.h:68
TTErr processAudio(TTAudioSignalArrayPtr inputs, TTAudioSignalArrayPtr outputs)
A standard audio processing method as used by Jamoma DSP objects.
A simple container for an array of TTAudioSignal pointers.
long TTPtrSizedInt
An integer that is the same size as a pointer.
Definition: TTBase.h:240
TTErr
Jamoma Error Codes Enumeration of error codes that might be returned by any of the TTBlue functions a...
Definition: TTBase.h:342
TTErr calculateValue(const TTFloat64 &x, TTFloat64 &y, TTPtrSizedInt data)
Calculate y = f(x) for a single value.
TTFloat64 mRatio
Thew ratio attribute controls how large part of the window is used for the initial increase (attack) ...
No Error.
Definition: TTBase.h:343
Rosenberg Glottal Pulse Window Function Unit for Jamoma DSP.
TTFOUNDATION_EXPORT const TTFloat64 kTTPi
[doxygenAppendixC_constExample]
Definition: TTBase.cpp:23
TTFOUNDATION_EXPORT const TTFloat64 kTTEpsilon
A very very small value, used for float equality comaprisments.
Definition: TTBase.cpp:31
[doxygenAppendixC_copyExample]
Definition: TTValue.h:34