-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnotes
More file actions
42 lines (25 loc) · 1.48 KB
/
Copy pathnotes
File metadata and controls
42 lines (25 loc) · 1.48 KB
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
requires numpy
basic structure of an instrument.
Instruments contain one or more samples
samples in turn contain one or more wavefunctions (WaveFormFunction)
A waveformfunction has a static frequency, a sin/square/sawtooth or
derivative function, and a volume function.
the basic idea is that we define a sample's 440hz shape.
the waveform functions the sample contains are fed modified information about the
frame they need to output. whereas normally they expect sequential calls with
incremented frames (eg, ......1200, 1201, 1202.....30003, 30004...etc), this
would produce 440hz no matter what. Instead the input frame is multiplied
by the sample's requested frequency over 440. so for example, if the sample wants
220hz, it will feed frames to it's waveform in the sequence 1201,1201.5,1202,1202.5,etc
If you want a sample that has 4 sin waveforms, one at the base 440, one at 660, one at 880
and one at 40, then instantiate each waveform with the given bases. eg:
func = new WaveFormFunction(660)
Waveformfunctions operate on 440.
samples operate on variable frequency.
instruments direct their samples' frequency.
Later on, a "note" will have an instrument, pitch function (returns frequency),
volume function (similar to the waveformfunction's), modulation function, and
may also have other special functions. idk. they'd be somewhat similar to plugins.
a note would be contained inside a track, which provides the instrument.
TODO:
enable WaveFormFunctions to use wav files as source.