@@ -20,6 +20,141 @@ class EnsembleTests: XCTestCase {
20
20
let audio = engine. startTest ( totalDuration: 5.0 )
21
21
input. play ( )
22
22
audio. append ( engine. render ( duration: 5.0 ) )
23
- audio . audition ( )
23
+ testMD5 ( audio )
24
24
}
25
+
26
+ func testAllVoicesActive( ) {
27
+ let engine = AudioEngine ( )
28
+ let url = Bundle . module. url ( forResource: " 12345 " , withExtension: " wav " , subdirectory: " TestResources " ) !
29
+ let input = AudioPlayer ( url: url) !
30
+ // Test with all 9 voices active in different pitch shifts
31
+ let ensemble = Ensemble ( input,
32
+ shifts: [ - 12 , - 9 , - 6 , - 3 , 0 , 3 , 6 , 9 , 12 ] ,
33
+ pans: [ - 1 , - 0.5 , - 0.25 , 0 , 0 , 0 , 0.25 , 0.5 , 1 ] ,
34
+ dryWetMix: 1.0 )
35
+ engine. output = ensemble
36
+ let audio = engine. startTest ( totalDuration: 5.0 )
37
+ input. play ( )
38
+ audio. append ( engine. render ( duration: 5.0 ) )
39
+ testMD5 ( audio)
40
+ }
41
+
42
+ func testArrayInitializer( ) {
43
+ let engine = AudioEngine ( )
44
+ let url = Bundle . module. url ( forResource: " 12345 " , withExtension: " wav " , subdirectory: " TestResources " ) !
45
+ let input = AudioPlayer ( url: url) !
46
+ // Test the array initializer with a C major chord
47
+ let ensemble = Ensemble ( input,
48
+ shifts: [ 0 , 4 , 7 ] ,
49
+ pans: [ - 1 , 0 , 1 ] ,
50
+ dryWetMix: 1.0 )
51
+ engine. output = ensemble
52
+ let audio = engine. startTest ( totalDuration: 5.0 )
53
+ input. play ( )
54
+ audio. append ( engine. render ( duration: 5.0 ) )
55
+ testMD5 ( audio)
56
+ }
57
+
58
+ func testEmptyArrays( ) {
59
+ let engine = AudioEngine ( )
60
+ let url = Bundle . module. url ( forResource: " 12345 " , withExtension: " wav " , subdirectory: " TestResources " ) !
61
+ let input = AudioPlayer ( url: url) !
62
+ // Test with empty arrays (should default to single voice at 0 shift)
63
+ let ensemble = Ensemble ( input,
64
+ shifts: [ ] ,
65
+ pans: [ ] ,
66
+ dryWetMix: 1.0 )
67
+ engine. output = ensemble
68
+ let audio = engine. startTest ( totalDuration: 5.0 )
69
+ input. play ( )
70
+ audio. append ( engine. render ( duration: 5.0 ) )
71
+ testMD5 ( audio)
72
+ }
73
+
74
+ func testSingleVoice( ) {
75
+ let engine = AudioEngine ( )
76
+ let url = Bundle . module. url ( forResource: " 12345 " , withExtension: " wav " , subdirectory: " TestResources " ) !
77
+ let input = AudioPlayer ( url: url) !
78
+ // Test with single voice
79
+ let ensemble = Ensemble ( input,
80
+ shifts: [ 5 ] ,
81
+ pans: [ 0.5 ] ,
82
+ dryWetMix: 1 )
83
+ engine. output = ensemble
84
+ let audio = engine. startTest ( totalDuration: 5.0 )
85
+ input. play ( )
86
+ audio. append ( engine. render ( duration: 5.0 ) )
87
+ testMD5 ( audio)
88
+ }
89
+
90
+ func testDominantSeventhChord( ) {
91
+ let engine = AudioEngine ( )
92
+ let url = Bundle . module. url ( forResource: " 12345 " , withExtension: " wav " , subdirectory: " TestResources " ) !
93
+ let input = AudioPlayer ( url: url) !
94
+ // Test a dominant 7th chord: C, E, G, Bb (0, 4, 7, 10 semitones)
95
+ let ensemble = Ensemble ( input,
96
+ shifts: [ 0 , 4 , 7 , 10 ] ,
97
+ pans: [ - 0.5 , - 0.25 , 0.25 , 0.5 ] ,
98
+ dryWetMix: 1.0 )
99
+ engine. output = ensemble
100
+ let audio = engine. startTest ( totalDuration: 5.0 )
101
+ input. play ( )
102
+ audio. append ( engine. render ( duration: 5.0 ) )
103
+ testMD5 ( audio)
104
+ }
105
+
106
+ func testMicrotones( ) {
107
+ let engine = AudioEngine ( )
108
+ let url = Bundle . module. url ( forResource: " 12345 " , withExtension: " wav " , subdirectory: " TestResources " ) !
109
+ let input = AudioPlayer ( url: url) !
110
+ // Test with microtonal intervals (quarter tones)
111
+ let ensemble = Ensemble ( input,
112
+ shifts: [ 0 , 0.5 , 1.0 , 1.5 , 2.0 ] ,
113
+ pans: [ - 1 , - 0.5 , 0 , 0.5 , 1 ] ,
114
+ dryWetMix: 1.0 )
115
+ engine. output = ensemble
116
+ let audio = engine. startTest ( totalDuration: 5.0 )
117
+ input. play ( )
118
+ audio. append ( engine. render ( duration: 5.0 ) )
119
+ testMD5 ( audio)
120
+ }
121
+
122
+
123
+ func testDrySignalOnly( ) {
124
+ let engine = AudioEngine ( )
125
+ let url = Bundle . module. url ( forResource: " 12345 " , withExtension: " wav " , subdirectory: " TestResources " ) !
126
+ let input = AudioPlayer ( url: url) !
127
+ // Test with completely dry signal
128
+ let ensemble = Ensemble ( input,
129
+ shifts: [ 0 , 12 , 24 ] ,
130
+ pans: [ - 1 , 0 , 1 ] ,
131
+ dryWetMix: 0.0 )
132
+ engine. output = ensemble
133
+ let audio = engine. startTest ( totalDuration: 5.0 )
134
+ input. play ( )
135
+ audio. append ( engine. render ( duration: 5.0 ) )
136
+ testMD5 ( audio)
137
+ }
138
+
139
+ func testParameterAutomation( ) {
140
+ let engine = AudioEngine ( )
141
+ let url = Bundle . module. url ( forResource: " 12345 " , withExtension: " wav " , subdirectory: " TestResources " ) !
142
+ let input = AudioPlayer ( url: url) !
143
+ let ensemble = Ensemble ( input,
144
+ shifts: [ 0 , 4 , 7 ] ,
145
+ pans: [ - 1 , 0 , 1 ] ,
146
+ dryWetMix: 0.5 )
147
+
148
+ // Test parameter automation
149
+ ensemble. $shift2. ramp ( to: 12 , duration: 2.0 )
150
+ ensemble. $pan2. ramp ( to: - 1 , duration: 2.0 )
151
+ ensemble. $dryWetMix. ramp ( to: 1.0 , duration: 2.0 )
152
+
153
+ engine. output = ensemble
154
+ let audio = engine. startTest ( totalDuration: 5.0 )
155
+ input. play ( )
156
+ audio. append ( engine. render ( duration: 5.0 ) )
157
+ testMD5 ( audio)
158
+ }
159
+
25
160
}
0 commit comments