«Electric car» by Kosmas Giannoutakis

on 12 Jan'14 14:23 in motorcarengineharmonicrhythmiconsound design

In 2011 I took part in a competition for making sound design for the electric car in Germany. I didn't get any distinction but I think my sounding engine is interesting somehow. I use 8 rhythmicons out of face with 32 partials each. The speed maps the time periods of the rhythmicons and the rpm (revolutions per minute) maps the harmonic factor of the partials. You can add more rhythmicons or partials if you want but it is very cpu intensive! You may need to increase your numWireBufs of your server in order to load the synth.

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
//load the Synth

(
k = ControlSpec(5, -128, \lin);
e = ControlSpec(0.01, 0.5, \exp);
p = ControlSpec(65536, 0.25, \exp);
c = ControlSpec(-23, 0, \lin);
h = ControlSpec(1/2, 2/1, \exp);

SynthDef(\Motorklang, {arg speed=0.0, time=0.0, rpm=0.0, t_tr=1;
	var sig, speedch, rpmch;
		speedch = EnvGen.kr(Env([0, speed], [time]), t_tr);
		rpmch = EnvGen.kr(Env([0, h.map(rpm/6000);], [time]), t_tr);
		sig = Mix.fill(8, {arg i;
			var freq, aspeed, env, curve1, curve2, phase;
			curve1 = k.map(speedch).max(1);
			aspeed = p.map(speedch/75) * curve1;
			env = e.map(speedch/75);
			curve2 = c.map(speedch/75);
			freq = 300 + (i/4);
			phase = i/8;
			Mix.fill(32, {arg i;
				var freqsq;
				freqsq = ((((i+1)*freq).cpsmidi*rpmch) - (freq.cpsmidi*rpmch-freq.cpsmidi)).midicps.min(22050);
				SinOsc.ar(freqsq, 0, 0.1/(i+1))
				*
				EnvGen.ar(Env.perc(env, 1-env, 1, curve2),
					Impulse.ar(freq*(1+i)/aspeed, phase), timeScale: 1/(freq*(1+i)/aspeed));
				});
			});
		Out.ar(0, Mix.new(sig) ! 2);
	}).load(s);
)

//Test it
(
x = Synth(\Motorklang);
x.set(\speed, 40, \rpm, 3000, \time, 0, \t_tr, 1);
)
x.free

//A simple interface to check the sound limits of the engine

(
x = Synth.newPaused(\Motorklang);
w = Window.new("Motor", Rect(150, 266, 950, 300)).front;
q = StaticText(w, Rect(835, 20, 100, 100));
y = StaticText(w, Rect(838, 140, 100, 100));
q.string = "km/h";
y.string = "rpm";
c = NumberBox(w, Rect(830, 90, 40, 20));
n = NumberBox(w, Rect(830, 210, 40, 20));
b = ControlSpec(0, 75, \linear, 0.1);
m = ControlSpec(0, 6000, \linear, 1);
a = Slider(w, Rect(50, 75, 700, 50)).value_(0).action_({
		x.run.set(\speed, b.map(a.value), \t_tr, 1);
		c.string_(b.map(a.value).asString)});
d = Slider(w, Rect(50, 200, 700, 50)).value_(0).action_({
		x.run.set(\rpm, m.map(d.value), \t_tr, 1);
		n.string_(m.map(d.value).asString)});
c.value = 0;
n.value = 0;
)
raw 1927 chars (focus & ctrl+a+c to copy)
reception
comments
rukano user 14 Jan'14 10:37

very cool! I would dirve one of those! :)

julian.rohrhuber user 16 Mar'14 17:36

I needed this to run it: s.options.numWireBufs = 1024; s.reboot;