«Star Trek transporter» by DSastre

on 15 Jul'12 17:50 in scififmspacestar trek

based on pure data code from the book "Designing Sound" by Andy Farnell. (Chapter 56, Practical 33, Transporter)

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
(
x = {
	var beam_envelope, phasor, beam, feedback, transporter, reverb, activateEnv, percEnv, activate, buffer; 
		
	buffer = LocalBuf(SampleRate.ir * 0.12);
		
	// feedback has to be 0 at the beginning, to avoid input 
	// nil before sound has been produced	
	feedback = 0;
	
	
	// Activate Sound (fig 56.3)

	activateEnv = EnvGen.ar(Env.new([0, 1, 1, 0], [0.01, 0.01, 5]));
	percEnv = EnvGen.ar(Env.new([1, 1, 0], [0.01, 0.12]));
		
	activate = (1 - activateEnv * 120 + 775) + (WhiteNoise.ar(0.1) + SinOsc.ar(30, mul:40));
	activate = OnePole.ar(activateEnv, exp(-2pi * (30 * SampleDur.ir))) * LFSaw.ar(activate, 1, 0.5, 0.5 );
	
	// adding a percussive shape at the beginning of the sound
	activate = (activate + (WhiteNoise.ar * percEnv)) * 3;
	
	activate = Clip.ar(activate, -1, 1);
	activate = BPF.ar(activate, [775,1550,2325], 13.reciprocal).sum * 0.5;

	
	
	// Beam Sound  
	
	beam = LFSaw.ar(467.1, 1, 0.5, 0.5 ) - 0.5;
	beam = beam - (Wrap.ar(beam) - 0.5);
	// two stage FM process
	phasor = LFSaw.ar( beam * 6500 + 277, 1, 0.5, 0.5) - 0.5;
	beam = beam * (phasor - (Wrap.ar(phasor) - 0.5));
	beam = DelTapWr.ar(buffer, beam + (feedback * 0.7));
	
	beam_envelope = Line.ar(0,1,12);
	
	feedback = DelTapRd.ar(buffer, beam, 
		(1 - beam_envelope * 12 + 1 
			// flanger effect w/ variable delays spaced 12ms apart [0,12,24]
			+ 12 * (0..2))
		// DelTapRd requires delaytime in seconds (the equivalence in pd [vd~] 
		// calculates with miliseconds, for it the division by 1000)
	 	/ 1000, 
		interp: 4).sum * 0.3;
	
	transporter = (beam_envelope * (-1) + 1).min(beam_envelope) * 4 * feedback;
	transporter = (transporter - OnePole.ar(transporter, exp(-2pi * (100 * SampleDur.ir))));
	transporter = BPF.ar(transporter, 
		// whole tone scale
		Array.geom(12, 466.164, 1.12247), 
		[1200, 1100, 930, 910, 880, 840, 800, 760, 720, 680, 640, 620].reciprocal).sum * 12;
	reverb = GVerb.ar(transporter + (activate * 0.1), 100, 8, 0.1, 0.9);
	reverb = reverb + (activate * 0.5)!2;

}.play
)
x.free;

// code also available here: 
// http://en.wikibooks.org/wiki/Designing_Sound_in_SuperCollider/Transporter
raw 2170 chars (focus & ctrl+a+c to copy)
comments
tommaisey user 19 Aug'12 20:20

Ha ha, that's cool, quite a faithful homage to the original sound!