Skip to content

Commit 41a9344

Browse files
committed
fixed vibrato stopping after some time
1 parent 768da35 commit 41a9344

File tree

8 files changed

+205
-23
lines changed

8 files changed

+205
-23
lines changed

.vscode/c_cpp_properties.json

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"configurations": [
3+
{
4+
"name": "Linux",
5+
"includePath": [
6+
"${workspaceFolder}/**",
7+
"/home/vega/Downloads/Rack-SDK/dep/**",
8+
"/home/vega/Downloads/Rack-SDK/include/**"
9+
],
10+
"defines": [
11+
"_DEBUG",
12+
"UNICODE",
13+
"_UNICODE"
14+
],
15+
"compilerPath": "/usr/bin/clang",
16+
"cStandard": "c17",
17+
"cppStandard": "c++14",
18+
"intelliSenseMode": "linux-clang-x64"
19+
}
20+
],
21+
"version": 4
22+
}

.vscode/launch.json

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"name": "Launch",
9+
"type": "cppdbg",
10+
"request": "launch",
11+
"program": "/opt/vcvrack/Rack",
12+
"args": [],
13+
"stopAtEntry": false,
14+
"cwd": "/opt/vcvrack/",
15+
"environment": [],
16+
"externalConsole": false
17+
},
18+
{
19+
"name": "Build and Launch",
20+
"type": "cppdbg",
21+
"request": "launch",
22+
"program": "/opt/vcvrack/Rack",
23+
"args": [],
24+
"stopAtEntry": false,
25+
"cwd": "/opt/vcvrack/",
26+
"environment": [],
27+
"externalConsole": false,
28+
"preLaunchTask": "Build application and add to plugin folder"
29+
},
30+
{
31+
"name": "Launch Debug",
32+
"type": "cppdbg",
33+
"request": "launch",
34+
"program": "/opt/vcvrack/Rack",
35+
"args": [],
36+
"stopAtEntry": false,
37+
"cwd": "/opt/vcvrack/",
38+
"environment": [],
39+
"externalConsole": false,
40+
"MIMode": "gdb",
41+
"miDebuggerPath": "/usr/bin/gdb",
42+
"preLaunchTask": "Build application and add to Rack plugin folder",
43+
"setupCommands": [
44+
{
45+
"description": "Enable pretty-printing for gdb",
46+
"text": "-enable-pretty-printing",
47+
"ignoreFailures": true
48+
}
49+
]
50+
}
51+
]
52+
}

.vscode/tasks.json

+92
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
{
2+
"version": "2.0.0",
3+
"tasks": [
4+
{
5+
"label": "Build application and add to Rack plugin folder",
6+
"type": "shell",
7+
"command": "make install",
8+
"options": {
9+
"cwd": "${workspaceRoot}",
10+
"env": {
11+
"RACK_DIR": "/home/vega/Downloads/Rack-SDK/"
12+
}
13+
},
14+
"group": "build",
15+
"presentation": {
16+
"echo": true,
17+
"reveal": "always",
18+
"focus": false,
19+
"panel": "shared"
20+
},
21+
"problemMatcher": {
22+
"owner": "cpp",
23+
"fileLocation": [
24+
"absolute"
25+
],
26+
"pattern": {
27+
"regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
28+
"file": 1,
29+
"line": 2,
30+
"column": 3,
31+
"severity": 4,
32+
"message": 5
33+
}
34+
}
35+
},
36+
{
37+
"label": "Clean project directories",
38+
"type": "shell",
39+
"command": "make clean",
40+
"options": {
41+
"cwd": "${workspaceRoot}",
42+
"env": {
43+
"RACK_DIR": "/home/vega/Downloads/Rack-SDK/"
44+
}
45+
},
46+
"group": "build",
47+
"presentation": {
48+
"echo": true,
49+
"reveal": "always",
50+
"focus": false,
51+
"panel": "shared"
52+
},
53+
"problemMatcher": {
54+
"owner": "cpp",
55+
"fileLocation": [
56+
"absolute"
57+
],
58+
"pattern": {
59+
"regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
60+
"file": 1,
61+
"line": 2,
62+
"column": 3,
63+
"severity": 4,
64+
"message": 5
65+
}
66+
}
67+
},
68+
{
69+
"type": "cppbuild",
70+
"label": "C/C++: clang++ build active file",
71+
"command": "/usr/bin/clang++",
72+
"args": [
73+
"-fdiagnostics-color=always",
74+
"-g",
75+
"${file}",
76+
"-o",
77+
"${fileDirname}/${fileBasenameNoExtension}"
78+
],
79+
"options": {
80+
"cwd": "${fileDirname}"
81+
},
82+
"problemMatcher": [
83+
"$gcc"
84+
],
85+
"group": {
86+
"kind": "build",
87+
"isDefault": true
88+
},
89+
"detail": "Task generated by Debugger."
90+
}
91+
]
92+
}

README.md

+7-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ available at https://github.com/cutelabnyc/pink-trombone-cpp
2828
2929
- [ ] Pallete Close / Nasal Only (Gate)
3030

31-
>
31+
> I **think** this is just ToungeY going negative
3232
3333
- [x] Limit Pitch range to prevent loss of output - limit seems to be ~ 135hz
3434

@@ -38,7 +38,10 @@ available at https://github.com/cutelabnyc/pink-trombone-cpp
3838

3939
> They seem to have no effect?
4040
41-
- [ ] Figure out why pitch wobble occassionaly stops?
41+
- [x] Figure out why pitch wobble occassionaly stops?
42+
43+
> ~~This might have to do with `glottis->totalTime` and the size of timeStep, but I'm not sure yet. This really does ruin the vocal effect to not have this, so this NEEDS fixed~~
44+
time was limited to 512. The solution is hacky and probably in a bad place, but at least it's fixed.
4245

4346
- [ ] Determine if any other parameters should have controls
4447

@@ -59,6 +62,8 @@ available at https://github.com/cutelabnyc/pink-trombone-cpp
5962
- [ ] Nose len
6063

6164
> At least for now this doesn't appear to do anything, but I haven't yet figured out how to colse the pallete / use the nose, so that makes sense.
65+
>
66+
> ... Okay, obviously it does something. Set the nose length to 44 (the same as `n`, which I still don't know what is) and it seems to be closer to the web version now?
6267
6368
- [ ] Tip & Lip start
6469

src/PinkTrombone.cpp

+7-4
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,9 @@ struct PinkTrombone : Module {
9898
configParam(CAVITYXA_PARAM, 0.f, 1.f, 0.f, "Cavity X Attenuation");
9999
configParam(CAVITYYO_PARAM, 0.575, 0.69125, 0.69125, "Cavity Y Offset");
100100
configParam(CAVITYYA_PARAM, 0.f, 1.f, 0.f, "Cavity Y Attenuation");
101-
configParam(TONGUEXO_PARAM, 0.f, 1.f, 0.f, "Tongue X Offset");
101+
configParam(TONGUEXO_PARAM, -1.f, 1.f, 0.f, "Tongue X Offset");
102102
configParam(TOUNGEXA_PARAM, 0.f, 1.f, 0.f, "Tounge X Attenuation");
103-
configParam(TONGUEYO_PARAM, 0.f, 1.f, 0.f, "Tounge Y Offset");
103+
configParam(TONGUEYO_PARAM, -1.f, 1.f, 0.f, "Tounge Y Offset");
104104
configParam(TOUNGEYA_PARAM, 0.f, 1.f, 0.f, "Tounge Y Attenuation");
105105
configParam(SOFTPALATE_PARAM, 0.f, 1.f, 0.f, "Soft Palate Toggle");
106106
configInput(PITCH_INPUT, "Pitch V/Oct");
@@ -160,8 +160,11 @@ struct PinkTrombone : Module {
160160

161161
if(destroying)
162162
return;
163-
164-
glottis->setIntensity(inputs[SOFTPALATE_INPUT].getVoltage() / 10.f); // This works, however, intensity needs to be clamped between 0 and 1, otherwise the the tenseness prameter has no effect.
163+
if (inputs[SOFTPALATE_INPUT].isConnected()){
164+
glottis->setIntensity(inputs[SOFTPALATE_INPUT].getVoltage() / 10.f); // This works, however, intensity needs to be clamped between 0 and 1, otherwise the the tenseness prameter has no effect.
165+
} else{
166+
glottis->setIntensity(.88);
167+
}
165168

166169
double purenoise = whiteNoise->runStep();
167170
double asp = aspirateFilter->runStep(purenoise);

src/PinkTrombone/Biquad.cpp

+20-16
Original file line numberDiff line numberDiff line change
@@ -8,52 +8,56 @@
88
#include "Biquad.hpp"
99
#include <math.h>
1010

11-
Biquad::Biquad(sample_t sampleRate) :
12-
frequency(200),
13-
q(0.5),
14-
gain(1.0),
15-
xm1(0.0),
16-
xm2(0.0),
17-
ym1(0.0),
18-
ym2(0.0)
11+
Biquad::Biquad(sample_t sampleRate) : frequency(200),
12+
q(0.5),
13+
gain(1.0),
14+
xm1(0.0),
15+
xm2(0.0),
16+
ym1(0.0),
17+
ym2(0.0)
1918
{
2019
this->sampleRate = sampleRate;
2120
this->twopiOverSampleRate = M_PI * 2.0 / this->sampleRate;
2221
this->updateCoefficients();
2322
}
2423

25-
void Biquad::updateCoefficients() {
24+
void Biquad::updateCoefficients()
25+
{
2626
sample_t omega = this->frequency * this->twopiOverSampleRate;
2727
sample_t sn = sin(omega);
2828
sample_t cs = cos(omega);
29-
sample_t one_over_Q = 1./this->q;
29+
sample_t one_over_Q = 1. / this->q;
3030
sample_t alpha = sn * 0.5 * one_over_Q;
31-
31+
3232
// Bandpass only, for now
33-
sample_t b0 = 1./(1. + alpha);
33+
sample_t b0 = 1. / (1. + alpha);
3434
this->a0 = alpha * b0;
3535
this->a1 = 0.;
3636
this->a2 = -alpha * b0;
3737
this->b1 = -2. * cs * b0;
3838
this->b2 = (1. - alpha) * b0;
3939
}
4040

41-
void Biquad::setFrequency(sample_t f) {
41+
void Biquad::setFrequency(sample_t f)
42+
{
4243
this->frequency = f;
4344
this->updateCoefficients();
4445
}
4546

46-
void Biquad::setGain(sample_t g) {
47+
void Biquad::setGain(sample_t g)
48+
{
4749
this->gain = g;
4850
this->updateCoefficients();
4951
}
5052

51-
void Biquad::setQ(sample_t q) {
53+
void Biquad::setQ(sample_t q)
54+
{
5255
this->q = q;
5356
this->updateCoefficients();
5457
}
5558

56-
sample_t Biquad::runStep(sample_t xn) {
59+
sample_t Biquad::runStep(sample_t xn)
60+
{
5761
sample_t yn = (this->a0 * xn) + (this->a1 * this->xm1) + (this->a2 * this->xm2) - (this->b1 * this->ym1) - (this->b2 * this->ym2);
5862
this->ym2 = this->ym1;
5963
this->ym1 = yn;

src/PinkTrombone/Glottis.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,11 @@ void Glottis::finishBlock(float vibratodepth)
112112
sample_t vibrato = 0;
113113
//vibrato += this->vibratoAmount * sin(2 * M_PI * this->totalTime * this->vibratoFrequency);
114114
//Vibrato has a base amount defined here. The depth of this should probably be an accessible prameter.
115+
if (this->totalTime == 512)
116+
{
117+
this->totalTime = 0;
118+
}
119+
115120
vibrato += 0.02 * simplex1(this->totalTime * 4.07);
116121
vibrato += 0.04 * simplex1(this->totalTime * 2.15);
117122
vibrato = vibrato * vibratodepth;

src/PinkTrombone/config.h

-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ typedef float sample_t;
1717
#define NUM_CONSTRICTIONS (44.0)
1818
#define BLADE_START (10)
1919
#define NOSE_LENGTH (28)
20-
//#define NOSE_LENGTH (14)
2120
#define TIP_START (32)
2221
//#define TIP_START (12)
2322
#define LIP_START (39)

0 commit comments

Comments
 (0)