Skip to content

Commit 8460b4c

Browse files
committed
Made dependent on KissFFT, made Soundpipe included
1 parent c47438a commit 8460b4c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

141 files changed

+22005
-5
lines changed

Package.resolved

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Package.swift

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,33 @@ let package = Package(
1616
],
1717
dependencies: [
1818
// Dependencies declare other packages that this package depends on.
19-
.package(url: "https://github.com/AudioKit/Soundpipe", .branch("main")),
19+
.package(url: "https://github.com/AudioKit/KissFFT", .branch("main")),
2020
.package(url: "https://github.com/AudioKit/AudioKit", .branch("develop")),
2121
],
2222
targets: [
2323
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
2424
// Targets can depend on other targets in this package, and on products in packages this package depends on.
25+
.target(name: "Soundpipe",
26+
dependencies: ["KissFFT"],
27+
exclude: [
28+
"lib/kissfft/COPYING",
29+
"lib/kissfft/README",
30+
"lib/inih/LICENSE.txt",
31+
],
32+
publicHeadersPath: "include",
33+
cSettings: [
34+
.headerSearchPath("lib/kissfft"),
35+
.headerSearchPath("lib/inih"),
36+
.headerSearchPath("Sources/soundpipe/lib/inih"),
37+
.headerSearchPath("modules"),
38+
.headerSearchPath("external")
39+
]),
2540
.target(
2641
name: "SoundpipeAudioKit",
2742
dependencies: ["AudioKit", "CSoundpipeAudioKit"]),
2843
.target(
2944
name: "CSoundpipeAudioKit",
30-
dependencies: ["AudioKit", "Soundpipe"]),
45+
dependencies: ["AudioKit", "Soundpipe"]),
3146
.testTarget(
3247
name: "SoundpipeAudioKitTests",
3348
dependencies: ["SoundpipeAudioKit"],

Sources/Soundpipe/external/growl.c

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
#include <stdlib.h>
2+
#include "Soundpipe.h"
3+
#include "growl.h"
4+
5+
static const SPFLOAT formants[] = {
6+
/* ae: top right */
7+
844.0, 1656.0, 2437.0, 3704.0,
8+
/* a: top left */
9+
768.0, 1333.0, 2522.0, 3687.0,
10+
/* i: bottom left */
11+
324.0, 2985.0, 3329.0, 3807.0,
12+
/* u: bottom right */
13+
378.0, 997.0, 2343.0, 3357.0,
14+
};
15+
16+
void growl_create(growl_d **form)
17+
{
18+
int i;
19+
*form = malloc(sizeof(growl_d));
20+
growl_d *fp = *form;
21+
for(i = 0; i < 4; i++) {
22+
sp_reson_create(&fp->filt[i]);
23+
}
24+
25+
sp_bal_create(&fp->bal);
26+
sp_dcblock_create(&fp->dcblk);
27+
}
28+
29+
void growl_init(sp_data *sp, growl_d *form)
30+
{
31+
int i;
32+
for(i = 0; i < 4; i++) {
33+
sp_reson_init(sp, form->filt[i]);
34+
form->filt[i]->freq = formants[i];
35+
form->filt[i]->bw =
36+
(formants[i] * 0.02) + 50;
37+
}
38+
sp_bal_init(sp, form->bal);
39+
sp_dcblock_init(sp, form->dcblk);
40+
form->x = 0;
41+
form->y = 0;
42+
}
43+
44+
void growl_compute(sp_data *sp, growl_d *form, SPFLOAT *in, SPFLOAT *out)
45+
{
46+
int i;
47+
SPFLOAT tmp_in = *in;
48+
SPFLOAT tmp_out = *in;
49+
SPFLOAT tf = 0.0;
50+
SPFLOAT bf = 0.0;
51+
SPFLOAT freq = 0.0;
52+
SPFLOAT *x = &form->x;
53+
SPFLOAT *y = &form->y;
54+
// *out = 0.0;
55+
//
56+
for(i = 0; i < 4; i++) {
57+
tf = (*x) *
58+
(formants[i + 3] - formants[i]) +
59+
formants[i];
60+
bf = (*x) *
61+
(formants[i + 11] - formants[i + 7]) +
62+
formants[i + 7];
63+
freq = (*y) * (bf - tf) + tf;
64+
form->filt[i]->freq = freq;
65+
form->filt[i]->bw =
66+
((freq * 0.02) + 50);
67+
sp_reson_compute(sp, form->filt[i], &tmp_in, &tmp_out);
68+
tmp_in = tmp_out;
69+
}
70+
*out = *in;
71+
sp_bal_compute(sp, form->bal, &tmp_out, in, out);
72+
tmp_out = *out;
73+
sp_dcblock_compute(sp, form->dcblk, &tmp_out, out);
74+
}
75+
76+
void growl_destroy(growl_d **form)
77+
{
78+
int i;
79+
growl_d *fd = *form;
80+
for(i = 0; i < 4; i++) {
81+
sp_reson_destroy(&fd->filt[i]);
82+
}
83+
sp_bal_destroy(&fd->bal);
84+
sp_dcblock_destroy(&fd->dcblk);
85+
free(*form);
86+
}

Sources/Soundpipe/external/growl.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
typedef struct {
2+
SPFLOAT x;
3+
SPFLOAT y;
4+
sp_reson *filt[4];
5+
sp_bal *bal;
6+
sp_dcblock *dcblk;
7+
} growl_d;
8+
9+
void growl_create(growl_d **form);
10+
void growl_init(sp_data *sp, growl_d *form);
11+
void growl_compute(sp_data *sp, growl_d *form, SPFLOAT *in, SPFLOAT *out);
12+
void growl_destroy(growl_d **form);
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#include <stdlib.h>
2+
#include "Soundpipe.h"
3+
#include "vocwrapper.h"
4+
5+
int sp_vocwrapper_create(sp_vocwrapper **p)
6+
{
7+
sp_vocwrapper *pp;
8+
*p = malloc(sizeof(sp_vocwrapper));
9+
pp = *p;
10+
sp_voc_create(&pp->voc);
11+
return SP_OK;
12+
}
13+
14+
int sp_vocwrapper_destroy(sp_vocwrapper **p)
15+
{
16+
sp_vocwrapper *pp = *p;
17+
sp_voc_destroy(&pp->voc);
18+
free(*p);
19+
return SP_OK;
20+
}
21+
22+
int sp_vocwrapper_init(sp_data *sp, sp_vocwrapper *p)
23+
{
24+
p->freq = 160;
25+
p->pos = 0.5;
26+
p->pos = 1;
27+
p->nasal = 0.0;
28+
p->tenseness = 0.6;
29+
sp_voc_init(sp, p->voc);
30+
return SP_OK;
31+
}
32+
33+
int sp_vocwrapper_compute(sp_data *sp, sp_vocwrapper *p, SPFLOAT *in, SPFLOAT *out)
34+
{
35+
sp_voc *voc;
36+
37+
voc = p->voc;
38+
39+
if(sp_voc_get_counter(voc) == 0) {
40+
sp_voc_set_velum(voc, 0.01 + 0.8 * p->nasal);
41+
sp_voc_set_tongue_shape(voc, 12 + 16.0*p->pos, p->diam*3.5);
42+
}
43+
sp_voc_set_frequency(voc, p->freq);
44+
sp_voc_set_tenseness(voc, p->tenseness);
45+
46+
sp_voc_compute(sp, voc, out);
47+
return SP_OK;
48+
}

0 commit comments

Comments
 (0)