-
Notifications
You must be signed in to change notification settings - Fork 0
/
sound_make_FM01.py
85 lines (58 loc) · 1.94 KB
/
sound_make_FM01.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# FM SOUND #1 FM Electric Piano
import numpy as np
from aoki.wave_file import wave_write_16bit_mono
from sound_FM_envelope import set_FME_level
from sound_FM_envelope import set_FME_poly
from sound_FM_unit import FM_unitT
from sound_FM_unit import FM_MODULATE
from sound_FM_unit import FM_ADD
from sound_FM_unit import FM_MIX
from sound_FM_unit import FM_sound
sampling = 44100
sound_a = 440
octave = -1
duration = 60000
for tone in range(41,89) :
# note = ( octave + 1 ) * 12 - 3 + ( i - 8)
note = tone - 69
ratio1 = 1.000
ratio2 = 2.000
feedback1 = 0.1
set_FME_level(100,60,10,0)
set_FME_poly(0,60,30,5)
op6 = FM_unitT(sound_a,duration,note,ratio1,feedback1,sampling)
s6 = FM_sound(op6)
set_FME_level(100,60,10,0)
set_FME_poly(0,60,30,5)
op4 = FM_unitT(sound_a,duration,note,ratio1,0.0,sampling)
sc = FM_sound(op4)
m4 = FM_MODULATE(op4,s6,1.0,0.0)
s4 = FM_sound(m4)
set_FME_level(100,60,10,0)
set_FME_poly(0,60,30,5)
op5 = FM_unitT(sound_a,duration,note,ratio2,0.0,sampling)
m5 = FM_MODULATE(op5,s6,1.0,0.0)
s5 = FM_sound(m5)
mix = 0.7
sa = FM_ADD(s4,s5,mix)
ratio3 = 1.000
ratio4 = 7.000
ratio5 = 17.000
set_FME_level(100,60,5,0)
set_FME_poly(0,80,60,5)
op3 = FM_unitT(sound_a,duration,note,ratio5,0.0,sampling)
s3 = FM_sound(op3)
set_FME_level(100,60,5,0)
set_FME_poly(0,80,60,5)
op2 = FM_unitT(sound_a,duration,note,ratio4,0.0,sampling)
m2 = FM_MODULATE(op2,s3,1.0,0.0)
s2 = FM_sound(m2)
set_FME_level(100,60,5,0)
set_FME_poly(0,80,60,5)
op1 = FM_unitT(sound_a,duration,note,ratio3,0.0,sampling)
m1 = FM_MODULATE(op1,s2,1.0,0.0)
sb = FM_sound(op1)
mix = 0.7
s_master = FM_ADD(sa,sb,0.7)
if tone > 72 : s_master = sc
wave_write_16bit_mono(sampling, s_master.copy(), './fm/fp' + str(tone) + '.wav')