zeroed-some/dougk / 50b0455

Browse files

asdd some tone to the gulp sound

Authored by espadonne
SHA
50b0455bab580de3754ef4c2117b4fb8b8417f54
Parents
ce1a9c2
Tree
62836de

1 changed file

StatusFile+-
M src/renderers/three/sounds.js 51 0
src/renderers/three/sounds.jsmodified
@@ -102,4 +102,55 @@ export function playMonch() {
102102
 
103103
   body.start(now)
104104
   body.stop(now + bodyLength)
105
+
106
+  // Tonal body - soft pitched "chomp" character
107
+  // Primary tone - warm mid frequency
108
+  const tone1 = ctx.createOscillator()
109
+  tone1.type = 'triangle'
110
+  tone1.frequency.setValueAtTime(280, now)
111
+  tone1.frequency.linearRampToValueAtTime(180, now + 0.08)
112
+
113
+  const tone1Env = ctx.createGain()
114
+  tone1Env.gain.setValueAtTime(0, now)
115
+  tone1Env.gain.linearRampToValueAtTime(0.12, now + 0.015) // Soft attack
116
+  tone1Env.gain.linearRampToValueAtTime(0.06, now + 0.05)
117
+  tone1Env.gain.linearRampToValueAtTime(0, now + 0.1)
118
+
119
+  tone1.connect(tone1Env)
120
+  tone1Env.connect(highPass)
121
+  tone1.start(now)
122
+  tone1.stop(now + 0.12)
123
+
124
+  // Secondary harmonic - adds richness
125
+  const tone2 = ctx.createOscillator()
126
+  tone2.type = 'sine'
127
+  tone2.frequency.setValueAtTime(420, now)
128
+  tone2.frequency.linearRampToValueAtTime(300, now + 0.06)
129
+
130
+  const tone2Env = ctx.createGain()
131
+  tone2Env.gain.setValueAtTime(0, now)
132
+  tone2Env.gain.linearRampToValueAtTime(0.06, now + 0.01)
133
+  tone2Env.gain.linearRampToValueAtTime(0, now + 0.07)
134
+
135
+  tone2.connect(tone2Env)
136
+  tone2Env.connect(highPass)
137
+  tone2.start(now)
138
+  tone2.stop(now + 0.1)
139
+
140
+  // Soft low "gulp" undertone - filtered to be safe
141
+  const gulp = ctx.createOscillator()
142
+  gulp.type = 'sine'
143
+  gulp.frequency.setValueAtTime(200, now + 0.02)
144
+  gulp.frequency.linearRampToValueAtTime(160, now + 0.1)
145
+
146
+  const gulpEnv = ctx.createGain()
147
+  gulpEnv.gain.setValueAtTime(0, now)
148
+  gulpEnv.gain.linearRampToValueAtTime(0, now + 0.02) // Delayed start
149
+  gulpEnv.gain.linearRampToValueAtTime(0.08, now + 0.04)
150
+  gulpEnv.gain.linearRampToValueAtTime(0, now + 0.12)
151
+
152
+  gulp.connect(gulpEnv)
153
+  gulpEnv.connect(highPass)
154
+  gulp.start(now)
155
+  gulp.stop(now + 0.15)
105156
 }