«fm generated melody» by grirgz

on 11 Nov'15 13:02 in

I'm sure it's a well known technique, but I found this by accident and I'm amazed by the cool jazzy basslines generated from nowhere

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
64
65
66
67
68
// base concept

{ arg freq = 74; SinOsc.ar(freq * [1,1.000001] * ( 1 + ( SinOsc.ar(freq  * LFPulse.kr(2,0, 1/8).range(0,1) * 1.20 )))) * 0.2; }.play

{ arg freq = 90; SinOsc.ar(freq * [1,1.000001] * ( 1 + ( SinOsc.ar(freq  * LFPulse.kr(4,0, 0.5).range(0,1) * 1.50 )))) * 0.2; }.play

{ arg freq = 74; SinOsc.ar(freq * [1,1.000001] * ( 1 + ( SinOsc.ar(freq  * LFPulse.kr(2,0, 1/8).range(0,1) * 1.50 )))) * 0.2; }.play

{ arg freq = 77; SinOsc.ar(freq * [1,1.000001] * ( 1 + ( SinOsc.ar(freq  * LFPulse.kr(4,0, 1/3).range(0,1) * 1.60 )))) * 0.2; }.play

// play with it

(
Ndef(\eyes, { arg freq=483, pan=0, amp=0.1;
    var sig;
    var env1, env2, env3, env4, env5, env6, env7, env8;
    var fmfreq;
    env1 = Duty.kr(1/8, 0, Dseq([
        1,0,1,0,
        1,0,0,0,
        1,0,0,0,
        1,0,0,0,
    ],inf)).lag(0.01);
    fmfreq = freq * ( 1 + ( SinOsc.ar(freq * 4 * env1) * 1 ));
    sig = LFSaw.ar(fmfreq * [1,1.0001]);
    sig = RLPF.ar(sig, freq*2 * [1,2 * SinOsc.kr(1/8).range(2,1),1], 0.2 * SinOsc.kr(1/4).range(2,1));
    sig = Pan2.ar(sig, 0, amp).flop;
}).play
);

(
Ndef(\eyes, { arg freq=70, pan=0, amp=0.1;
    var sig;
    var env1, env2, env3, env4, env5, env6, env7, env8;
    var fmfreq;
    env1 = Duty.kr(1/8, 0, Dseq([
        1,0,0,0,
        1,0,1,1,
        1,0,0,1,
        1,0,0,0,
    ],inf)).lag(0.01);
    fmfreq = freq * ( 1 + ( SinOsc.ar(freq * 1 * env1) * 2.2 ));
    sig = LFSaw.ar(fmfreq * [1,1.0001]);
    sig = RLPF.ar(sig, freq*2 * [1,2 * SinOsc.kr(1/8).range(2,1),1], 0.2 * SinOsc.kr(1/4).range(2,1));
    sig = Pan2.ar(sig, 0, amp).flop;
}).play
);


(
Ndef(\eyes, { arg freq=80, pan=0, amp=0.1;
    var sig;
    var env1, env2, env3, env4, env5, env6, env7, env8;
    env1 = Duty.kr(1/8, 0, Dseq([
        1,0,0,0,
        1,0,0,0,
        0,0,0,0,
        0,0,0,0,
    ],inf)).lag(0.31);
    sig = LFSaw.ar(freq * [1,1.001]);
    sig = 0;
    sig = sig + LFSaw.ar(freq * ( 1 + ( SinOsc.ar(freq*2 * 1.0 * env1) * 1.91 )));
    //sig = sig + SinOsc.ar(freq * ( 1 + ( SinOsc.ar(freq*2 * 1.0 * LFPulse.kr(2)) * 0.91 )));
    sig = RLPF.ar(sig, ( [4000, 4001, 8000 ] * ( [1.07,1,1.0001 * SinOsc.kr(1/8).range(0.1,4)] * 1.1 * Amplitude.kr(sig)**1.8 ) ).clip(5,18000));
    sig = (sig * 40).tanh / 2;
    sig = Pan2.ar(sig, SinOsc.kr([1,2,3]/10).range(-1,1) * 0.3, amp).flop;
}).play
);
raw 2393 chars (focus & ctrl+a+c to copy)
reception
comments
rumush user 11 Nov'15 13:54

I get an error when I try to run any of the Ndefs Deleting ~t fixes it.

Sounds nice, especially the 2nd one :)

grirgz user 12 Nov'15 15:34

Oops! I use store the tempo in ~t so my Ndefs are always synced to the tempo but I often forget to remove it when sharing