| 1 |
// Listing 7.17 Using ChucK's VoicForm formant voice UGen |
| 2 |
|
| 3 |
// Simple singing example using the VoicForm UG |
| 4 |
VoicForm singer => dac; |
| 5 |
0.05 => singer.vibratoGain; |
| 6 |
|
| 7 |
[40,42,44,45,47,45,44,42] @=> int scale[]; |
| 8 |
|
| 9 |
// Start singing our first note |
| 10 |
Std.mtof(scale[0]) => singer.freq; |
| 11 |
11 => singer.phonemeNum; // (1) Selects vowel by number |
| 12 |
1 => singer.noteOn; |
| 13 |
|
| 14 |
// sing through whole scale |
| 15 |
0 => int note; |
| 16 |
while (note < scale.cap()){ |
| 17 |
dipth("lll","ahh",scale[note]); // (2) Sings a diphthong (transition between two vowels) |
| 18 |
1 +=> note; |
| 19 |
} |
| 20 |
|
| 21 |
// last note |
| 22 |
dipth("lll","ahh",scale[0]); |
| 23 |
0.15 => singer.vibratoGain; |
| 24 |
2.0 :: second => now; |
| 25 |
1 => singer.noteOff; |
| 26 |
0.2 :: second => now; |
| 27 |
|
| 28 |
fun void dipth(string phon0, string phon1, int note) { |
| 29 |
phon0 => singer.phoneme; |
| 30 |
0.1 :: second => now; |
| 31 |
phon1 => singer.phoneme; |
| 32 |
Std.mtof(note) => singer.freq; |
| 33 |
0.4 :: second => now; |
| 34 |
} |