3 from __future__
import print_function
8 amplitudes
= (32000, 0, 4000, 0, 4000)
13 for i
in range(samples
):
15 for harmonic
, amplitude
in enumerate(amplitudes
):
16 sample
+= math
.sin(math
.pi
* 2 * i
* (harmonic
+ 1) / samples
) * amplitude
/ 2
22 print("%d," % sample
, end
=' ')
27 print('Range is:', min, max)
29 if max > 32767 or min < -32768:
30 print("Invalid range!")