<commit_before>/* 
 * Tukey Window Function Unit for Jamoma DSP
 * Copyright © 2011 by <NAME>
 * 
 * License: This code is licensed under the terms of the "New BSD License"
 * http://creativecommons.org/licenses/BSD/
 */

#ifndef __TUKEYWINDOW_H__
#define __TUKEYWINDOW_H__

#include "TTDSP.h"


/**	This implements the Tukey window function described here:
 http://en.wikipedia.org/wiki/File:Window_function_(Tukey;_alpha_%3D_0.5).png
 This is alternate implementation of what Roads (1996 p 170, 2001 p 88) typically refers to as the Gaussian window.
 It is easier to ensure that x and y values will scale properly with this formula as opposed to the one given by Roads.
 
 Where x is between 0. and 1.:
 y	= 0.5 * (1 + cos ( pi * (((2 / alpha) * x) - 1)))				: for the attack
	= 1																: for the sustain
	= 0.5 * (1 + cos ( pi * (((2 / alpha) * x) - (2 / alpha) + 1)))	: for the release
 */
class TukeyWindow : TTAudioObject {
	TTCLASS_SETUP(TukeyWindow)
	
	/** y = f(x) for a single value */
	inline TTErr calculateValue(const TTFloat64& x, TTFloat64& y, TTPtrSizedInt data);
	
	/**	A standard audio processing method as used by TTBlue objects.*/
	TTErr processAudio(TTAudioSignalArrayPtr inputs, TTAudioSignalArrayPtr outputs);
	
};
<commit_msg>clarified comments on alpha<commit_after>/* 
 * Tukey Window Function Unit for Jamoma DSP
 * Copyright © 2011 by <NAME>
 * 
 * License: This code is licensed under the terms of the "New BSD License"
 * http://creativecommons.org/licenses/BSD/
 */

#ifndef __TUKEYWINDOW_H__
#define __TUKEYWINDOW_H__

#include "TTDSP.h"


/**	This implements the Tukey window function described here:
 http://en.wikipedia.org/wiki/File:Window_function_(Tukey;_alpha_%3D_0.5).png
 This is alternate implementation of what Roads (1996 p 170, 2001 p 88) typically refers to as a Gaussian window.
 It is easier to ensure that x and y values will scale properly with this formula as opposed to the one given by Roads.
 
 Where 0. <= x <= 1. and 0. <= alpha <= 1:
 y	= 0.5 * (1 + cos ( pi * (((2 / alpha) * x) - 1)))				: for the attack
	= 1																: for the sustain
	= 0.5 * (1 + cos ( pi * (((2 / alpha) * x) - (2 / alpha) + 1)))	: for the release
 */
class TukeyWindow : TTAudioObject {
	TTCLASS_SETUP(TukeyWindow)
	
	/** y = f(x) for a single value */
	inline TTErr calculateValue(const TTFloat64& x, TTFloat64& y, TTPtrSizedInt data);
	
	/**	A standard audio processing method as used by TTBlue objects.*/
	TTErr processAudio(TTAudioSignalArrayPtr inputs, TTAudioSignalArrayPtr outputs);
	
};

{'fraction_non_alphanumeric': 0.1089693154996066, 'fraction_numerical': 0.03068450039339103, 'mean_word_length': 3.477112676056338, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4429391', 'n_tokens_mistral': 933, 'n_tokens_neox': 810, 'n_words': 316}