# «Midterm Question 3» byMason McCormack

on 31 Oct'16 05:42 in
```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```
```// This note is made up of 5 freqs, all integer multiples of 100 Hz.
{ Mix.ar(SinOsc.ar(freq: 100 * [1, 2, 3, 4, 5], mul: 0.1)) }.play;

// This note is made up of 5 freqs that are NOT integer multiples of 100 Hz.
{ Mix.ar(SinOsc.ar(freq: 100 * [1.01, 1.9, 3, 4.2, 7.4], mul: 0.1)) }.play;

(
SynthDef("bell", {arg freq, amp;

var env, snd, partials, relativeAmps;
partials = [0.5, 1, 1.19, 1.56, 2, 2.51, 2.66, 3.01, 4.1];
relativeAmps = [0.25, 1, 0.8, 0.5, 0.9, 0.4, 0.3, 0.6, 0.1];

env = Env.perc(attackTime: 0.01, releaseTime: 5, amp: relativeAmps

).kr(2);

snd = SinOsc.ar(
freq: 440 ,
mul: 1
);

snd = Splay.ar(snd);

Out.ar(0, snd  * 0.1 ! 2);

)

(
Pbind(
\instrument, "bell",
\degree, Pseq([1,4,7,9], inf),
\dur, 0.132,

).play
)```
raw 861 chars (focus & ctrl+a+c to copy)
reception
Bruno Ruviaro user 03 Nov'16 23:21

// This note is made up of 5 freqs, all integer multiples of 100 Hz. { Mix.ar(SinOsc.ar(freq: 100 * [1, 2, 3, 4, 5], mul: 0.1)) }.play;

// This note is made up of 5 freqs that are NOT integer multiples of 100 Hz. { Mix.ar(SinOsc.ar(freq: 100 * [1.01, 1.9, 3, 4.2, 7.4], mul: 0.1)) }.play;

( SynthDef("bell", {arg freq, amp;

``````var env, snd, partials, relativeAmps;
partials = [0.5, 1, 1.19, 1.56, 2, 2.51, 2.66, 3.01, 4.1];
relativeAmps = [0.25, 1, 0.8, 0.5, 0.9, 0.4, 0.3, 0.6, 0.1];

env = Env.perc(attackTime: 0.01, releaseTime: 5, amp: relativeAmps

).kr(2);

snd = SinOsc.ar(
freq: 440 ,
mul: 1
);

snd = Splay.ar(snd);

Out.ar(0, snd  * 0.1 ! 2);
``````

( Pbind( \instrument, "bell", \degree, Pseq([1,4,7,9], inf), \dur, 0.132,

).play )

Bruno Ruviaro user 03 Nov'16 23:21

Bruno Ruviaro user 03 Nov'16 23:21

Does not work.

// Problems:

// Code does not works as expected (one error message, and it makes the wrong sound)

// SynthDef arguments are not used anywhere in the body of the SynthDef

// SinOsc.ar has been fed wrong arguments (lines 26-27). By using fixed numbers there, you are ignoring any value the Pbind will send. Your synth will always play a single note at the same amplitude. All the freqs that would make up a bell remain unused.

// Amplitude Envelope is not used correctly: you create it almost correctly, although the end of line 21 should be amp * relativeAmps to be 100% correct. However, even if that was correct, you do not use env later in the code. So the envelope is created, and remains unused.

// Multichannel expansion is not employed correctly. By not using relativeAmps and partials correctly, no multichannel expansion occurs.

// Example Pbind produces wrong sound.

Bruno Ruviaro user 03 Nov'16 23:22

0.5 pt