/
Params.h
82 lines (71 loc) · 2.22 KB
/
Params.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
//
// Params.h
// SpectralHarp
//
// Created by Damien Quartz on 2/20/18
//
#pragma once
enum EParams
{
kVolume = 0,
kPitch,
kDecay,
kCrush,
// params for the xy pad that can be used to "strum"
kPluckX,
kPluckY,
// frequency of the first strummable string
kBandFirst,
// frequency of the last strummable string
kBandLast,
// how many strings available for strumming
kBandDensity,
// at 0 we space strings linearly between BandFirst and BandLast,
// at 1 we space strings logarithmically between BandFirst and BandLast,
// at values inbetween we lerp between the linear value and log value.
kBandLinLogLerp,
// spread is expressed in Hz and is how widely we excite the spectrum around a strings frequency.
// applied amplitudes fall of exponentially a we move away from the central frequency band.
// how much of an audible effect this will have depends on the sample rate,
// since higher sample rates means we get more resolution in the frequency spectrum.
kBandSpread,
// how "bright" we make the sound by exciting additional partials of a string.
// at 100% a single string will sound like a band-limited saw wave instead of a sine wave.
kBrightness,
kNumParams
};
enum ESettings
{
// settings for the SpectralGen UGen
kSpectralAmpMax = 1,
// settings for kPitch, expressed as percent
kPitchMin = 50,
kPitchMax = 100,
kPitchDefault = kPitchMax,
// settings for kDecay, expressed in milliseconds
kDecayMin = 150,
kDecayMax = 5000,
kDecayDefault = 500,
// settings for kCrush, expressed as percent
kCrushMin = 0,
kCrushMax = 100,
kCrushDefault = kCrushMin,
// settings for kBandFirst and kBandLast params
kBandMin = 64,
kBandMax = 13000,
kBandMinDistance = 64,
kBandFirstDefault = kBandMin,
kBandLastDefault = kBandMax,
// settings for kBandDensity
kBandDensityMinOrig = 16,
kBandDensityMaxOrig = 256,
kBandDensityMin = 12, // one string per semi-tone if low and high frequency are an octave apart
kBandDensityMax = 288, // 24 "octaves" of semi-tones
kBandDensityDefault = kBandDensityMax,
kBandSpreadMin = 0,
kBandSpreadMax = 13000,
};
static float Map(float value, float istart, float istop, float ostart, float ostop)
{
return ostart + (ostop - ostart) * ((value - istart) / (istop - istart));
}