-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy paththoughts.txt
83 lines (60 loc) · 3.86 KB
/
thoughts.txt
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
Notes on setup:
- *first* setup virtualenv
- then clone into the virtualenv: git clone [email protected]:eggsyntax/sonify.git
- pip install -r requirements.txt
- setup pydev with new interpreter inside virtualenv. See
http://stackoverflow.com/questions/6615629/eclipse-pydev-error-python-stdlib-not-found
sample_rate = 1.0/60 (1 sample per 20 seconds)
we want to map to:
'pitch'
sample_rate = 1.0/5 (1 sample per 5 seconds)
we want to say that:
Maybe we just want to say: 10 samples becomes 30 samples
Or: 20 seconds becomes 1 second
time_map(seconds(20),seconds(1),interpolate=True)
or in another style: time_map().from(seconds(20)).to(seconds(1)).with_interpolation()
aspects: interpolation, averaging
interpolation: if sample 17 in the representation falls between samples 2 and 3 in the data, we interpolate the values of samples 2 and 3.
To do that we need to convert a representation index value to a (float) data index.
pitch sample 0 represents time 0.0 (in seconds, because s0 / (1.0/5) aka s1 / pitch sample_rate, hence temp sample 0.00, ie t 0.0 * temp sample_rate
pitch sample 1 represents time 5.0 (in seconds, because s1 / (1.0/5) aka s1 / pitch sample_rate, hence temp sample 0.25, ie t 5.0 * temp sample_rate
pitch sample 2 represents time 10.0 (in seconds, because s2 / (1.0/5) aka s1 / pitch sample_rate, hence temp sample 0.50, ie t10.0 * temp sample_rate
pitch sample 3 represents time 15.0 (in seconds, because s3 / (1.0/5) aka s1 / pitch sample_rate, hence temp sample 0.75, ie t15.0 * temp sample_rate
pitch sample 4 represents time 20.0 (in seconds, because s4 / (1.0/5) aka s1 / pitch sample_rate, hence temp sample 1.00, ie t20.0 * temp sample_rate
pitch sample 5 represents time 25.0 (in seconds, because s5 / (1.0/5) aka s1 / pitch sample_rate, hence temp sample 1.25, ie t25.0 * temp sample_rate
pitch sample 6 represents time 30.0 (in seconds, because s6 / (1.0/5) aka s1 / pitch sample_rate, hence temp sample 1.50, ie t30.0 * temp sample_rate
So to convert pitch sample n to temp sample m, we use (n / pitch_s_r) * temp_s_r
Or maybe it's more like:
I want each hour of source material to be 1 second of output. Is that the same? I think so.
--------Hypothetical workflow---------
Problem: I have some buoy data that I want to turn into MIDI data.
Workflow:
I write a subclass of DataParser that takes a list of files and turns them into a
DataObjectCollection.
I create an instance of MidiDataRenderer and tell it what MIDI controller numbers I want it to
expose (and desired ranges if necessary)
I create a DataMapper that maps the keys I created in DataParser to the keys in the DataRenderer
and converts the values (range and time).
It should then be ready to hand data to the parser in just the way it likes. Maybe as
another DOC but with keys and vals appropriate to the renderer?
I call data_mapper.render().
------
Another possibility:
Sonification as a service -- both data classes and renderer classes expose their capabilities
and parameters (offered or desired respectively) via a consistent interface; provide services
in JSON (or an easily JSONifiable format, which argues for the use of simple data structures).
That way data sources and renderers can trivially be remote from each other.
-----
Resources:
psycops - create csound scores in python. http://sourceforge.net/projects/psycops/files/psycops/
--
resample([0,1,2,3], 2) -> [0.5,2.5]
resample([0,1,2,3], .5) ->[0.0, 0.5, 1.0, 1.5, 2.0, 2.5, 3.0]
4 to 8 means 1 sample to 2 samples. o[0] == n[0]; o[-1] == n[-1]
--
Think about stripping away structure, about saying more up front.
Let whole classes dissolve into collections of static functions.
Not everything aspires to be a factory.
Interactive, declarative descriptions can
lightly bind a source to its expression.
Don't get trapped in the object box.