@@ -6,51 +6,58 @@ import AudioKitEX
66import AVFoundation
77import CAudioKitEX
88
9- /// A digital effect of talk box. A talk box or talkbox is an effects unit that allows musicians to modify the sound
10- /// of a musical instrument by shaping the frequency content of the sound using their mouth. The effect can be used
11- /// to make a musical instrument sound as if it's speaking, or to create other vocal-like effects.
9+ /// A high quality talkbox emulation, similar to a vocoder.
10+ /// This is the talkbox plugin ported from the MDA plugin suite. In many ways,
11+ /// this Talkbox functions like a vocoder: it takes in a source signal (usually
12+ /// speech), which then excites an excitation signal
13+ /// (usually a harmonically rich signal like a saw wave). This particular algorithm
14+ /// uses linear-predictive coding (LPC), making speech intelligibility better
15+ /// than most vocoder implementations.
1216///
1317public class Talkbox : Node {
1418 let input : Node
19+ let excitation : Node
1520
1621 /// Connected nodes
17- public var connections : [ Node ] { [ input] }
22+ public var connections : [ Node ] { [ input, excitation ] }
1823
1924 /// Underlying AVAudioNode
2025 public var avAudioNode = instantiate ( effect: " tbox " )
2126
2227 // MARK: - Parameters
2328
24- /// Dry/wet mix.
25- public static let balanceDef = NodeParameterDef (
26- identifier: " balance " ,
27- name: " Balance " ,
28- address: akGetParameterAddress ( " TalkboxParameterBalance " ) ,
29+ /// Quality of the talkbox sound. 0=lowest fidelity. 1=highest fidelity
30+ public static let qualityDef = NodeParameterDef (
31+ identifier: " quality " ,
32+ name: " Quality " ,
33+ address: akGetParameterAddress ( " TalkboxParameterQuality " ) ,
2934 defaultValue: 1 ,
3035 range: 0 ... 1 ,
31- unit: . percent
36+ unit: . generic
3237 )
3338
34- /// Dry/wet mix. Should be a value between 0-1.
35- @Parameter ( balanceDef) public var balance : AUValue
36-
39+ /// Quality parameter, from 0 (lowest fidelity) to 1 (highest fidelity)
40+ @Parameter ( qualityDef) public var quality : AUValue
3741
3842 // MARK: - Initialization
3943
4044 /// Initialize this talkbox node
4145 ///
4246 /// - Parameters:
43- /// - input: Input node to process
44- /// - balance: dry wet mix
47+ /// - input: Source signal that shapes the excitation (modulator)
48+ /// - excitation: The signal to be excited (carrier)
49+ /// - quality: Quality of the talkbox sound (0=lowest fidelity, 1=highest fidelity)
4550 ///
4651 public init (
4752 _ input: Node ,
48- balance: AUValue = balanceDef. defaultValue
53+ excitation: Node ,
54+ quality: AUValue = qualityDef. defaultValue
4955 ) {
5056 self . input = input
57+ self . excitation = excitation
5158
5259 setupParameters ( )
5360
54- self . balance = balance
61+ self . quality = quality
5562 }
5663}
0 commit comments