Changes
2 changed files (+18/-1)
-
-
@@ -10,7 +10,7 @@note = [] for i in range(0, 24): note.append([yue.tone(yue.freq(3, i), j / bitrate) / 4 for j in range(0, 3 * bitrate)]) note.append([yue.seething(yue.freq(4, i), j / bitrate) / 4 for j in range(0, 3 * bitrate)]) sd.default.samplerate = bitrate print("READY")
-
-
-
@@ -8,6 +8,13 @@ bitrate = 44100music = [] def saw(x): """ Sawtooth wave """ return x / 2 / math.pi % 1 def freq(octave, step): """ Returns the frequency of a note
-
@@ -42,6 +49,16 @@ Y += 0.2 * math.sin(2 * w * t) * math.exp(-0.0005 * w * t)Y += math.copysign(Y * Y, Y) Y *= 1 + 16 * t * math.exp(-6 * t) Y *= 0.5 * min(24 * t, 1) return Y def honk(f, t): """ Returns the intensity of the "honk" waveform of frequency f sampled at time t """ w = 2 * math.pi * f Y = sum([(saw(i * w * t) / 3 + math.sin(i * w * t)) * math.exp(-0.002 * w * t) for i in range(1, 6)]) / 2 Y = math.copysign(abs(Y) ** (1 / 2), Y) return Y
-