git.haldean.org symrep / 9bd6f21
add stuff to the readme Will Haldean Brown 4 years ago
1 changed file(s) with 14 addition(s) and 57 deletion(s). Raw diff Collapse all Expand all
66 written to be parameter-space agnostic, allowing for it to be used for
77 everything from 5.1-channel audio to functional representation of 3D models.
88
9 For example, this source code for audio synthesis (using the `symrep.audio`
10 package):
11
12 from symrep import *
13 import sys
14
15 n = sum(
16 product(
17 const(0.3),
18 product(
19 audio.sine(const(440), name="tuner"),
20 audio.sine(const(0.5)),
21 )
22 ),
23 product(
24 const(0.2),
25 audio.sine(
26 product(
27 const(400),
28 piecewise(
29 audio.sawtooth(const(1)),
30 const(1),
31 const(1),
32 ),
33 ),
34 name="riser",
35 )
36 ),
37 product(
38 const(0.3),
39 audio.sine(const(220), name="thing"),
40 ),
41 product(
42 audio.sine(const(140), name="kick1"),
43 audio.square(const(2), const(0.05)),
44 ),
45 product(
46 const(0.5),
47 audio.sine(const(100), name="kick2"),
48 shift(
49 audio.square(const(2), const(0.05)),
50 const(0.25),
51 )
52 ),
53 product(
54 const(0.2),
55 audio.sine(const(523), name="duty"),
56 audio.square(
57 const(2),
58 audio.sawtooth(const(1. / 60.)),
59 ),
60 )
61 )
62 audio.stream_pcm(n, 44100, sys.stdout)
63
64 Gives the following graph:
9 For example, the source code for audio synthesis (using the `symrep.audio`
10 package) in [examples/sound.py](https://github.com/haldean/symrep/blob/master/examples/sound.py)
11 gives the following graph:
6512
6613 ![](examples/sound.png)
6714
68 [...and this sound file](examples/sound.wav)
15 [...and this sound file](examples/sound.wav).
16
17 The source code for solid modelling (using the `symrep.solids` package) in
18 [examples/solids.py](https://github.com/haldean/symrep/blob/master/examples/sphere.py)
19 gives the following graph:
20
21 ![](examples/solids.png)
22
23 and these solid bodies (rendered by MeshLab):
24
25 ![](https://raw.githubusercontent.com/haldean/symrep/master/examples/sphere.gif)