«Shepard-Risset glissando» by Andrew Brož

on 01 Nov'20 08:26 in rissetshepardshepard toneshepardrissetsound effectauditory illusion

A short SynthDef that produces a Shepard-Risset glissando and some code to demo it.

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
// A.Broz: Shepard-Risset glissando demo (2020-10-31)

(
/*
                 ,
                /
             `\_\
                 \
                /O\
               '   '
*/
SynthDef(\shepard, #{ |freq=440, dur=20, direction=1, amp=0.2|
	var partialCount = 4;
	var octRange = 2 ** (partialCount / 2);
	var cycle = 1 / (partialCount * dur);
	var width = if(direction >= 0, 1, 0);
	var sig = partialCount.collect { |n|
		var offset = n / partialCount;
		var phase = (3 * pi / 2) + (2 * pi * offset);
		var vol = SinOsc.kr(cycle, phase).range(0, 1);
		var ratio = VarSaw.kr(cycle, offset, width).exprange(1/octRange, octRange);
		SinOsc.ar(freq * ratio) * vol;
	}.sum;
	sig = sig!2 * (amp / partialCount) * Line.kr(0, 1, 5); // fade in
	sig = JPverb.ar(sig); // reverb
	Out.ar(0, sig);
}).add;

~playShep = #{ |fund=300, chord=([1, 5/4, 3/2]), dir=(-1), dur=40, amp=0.1|
	chord.collect { |r| (
		instrument: \shepard,
		freq: fund * r,
		dur: dur,
		direction: dir,
		amp: amp,
	).play };
};
)

// falling chord
~shep = ~playShep.value;

// rising chord
~shep = ~playShep.(200, [1, 4/3, 16/9], 1, 70, 0.03);

// free all
~shep do: _.free;
raw 1185 chars (focus & ctrl+a+c to copy)
reception
comments