«classical piano music in SC» by stewartmandell

on 17 Feb'22 12:37 in

Hello Everyone. This is my first post.

I'm trying to transcribe classical piano music to SuperCollider.

Here is my problem. In piano music, a chord is held down simultaneously. But then some voices can move while other notes are still held down. i.e the chord notes have different durations? Does anyone know an elegant way to deal with this?

thanks, Stewart

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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
////////////////  Chopin Prelude in Em OP.28,No.4   ///////////////// 

(
 SynthDef(\mdapiano, { |out=0, freq=440, gate=1,
	                        vel= 100, decay= 0.8, release= 0.8, hard= 0.8,
		                    velhard= 0.8, muffle= 0.8, velmuff= 0.8, velcurve= 0.8, stereo= 0.5,
		                    tune= 0.5, random= 0.1, stret= 0.1, sus= 0|

   var son = MdaPiano.ar(freq, gate, vel,  decay, release, hard,
		                        velhard, muffle, velmuff, velcurve, stereo,
		                        tune, random, stret, sus);
	FreeSelf(1-gate);
    Out.ar(out, son );
}).add;
)



(  //                 1      2      3     4      5      6      7         8
var tNotes = [ 59,71, 71,72, 71,72, 71,72, 71,70, 69,71, 69,71, 69,71,69, 69,68,
  //          9                     10     11        12
	          67,69,71,74,72,64,69, 66,69, 66,71,69, 67,66,60,59,63,66,74,72,71,
 //           13     14     15     16                             17
	          71,72, 71,72, 71,72, 71,70,70,71,70,69,70,79,78,76, 76,75,84,75,75,76,79,71,
 //	          18                    19        20     21     22     23
	          74,72,76,64,69,66,69, 66,71,69, 66,64, 64,66, 64,66, 64,\r,
 //           24                           25
	          [52,54,59,64],[51,54,59,63], [52,55,59,64],
             ];
 //                     1    2    3    4    5    6    7          8
var tDur   = [ 3/4,1/4, 3,1, 3,1, 3,1, 3,1, 3,1, 3,1, 3,3/4,1/4, 3,1,
 //            9                          10   11         12
               1,1/2,1/2,1/2,1/2,1/2,1/2, 3,1, 3,1/2,1/2, 1/2,1/2,1/2,1/2,1/2,1/2,1/3,1/3,1/3,
 //            13   14   15   16                                     17
	           3,1, 3,1, 3,1, 3/4,1/4,1/2,1/8,1/8,1/8,1/8,1,3/4,1/4,  1/2,1/2,1/2,1/2,1/2,1/2,1/2,1/2,
 //            18                           19         20        21   22   23
               1/2,1/2,1/3,1/3,1/3,3/2,1/2, 3,1/2,1/2, 15/4,1/4, 3,1, 3,1, 2,2,
//             24   25
	           2,2, 4,
	         ];

//                 1                     2
var bNotes = [ \r, Pseq([[55,59,64]],8), Pseq([[54,57,64]],4),Pseq([[54,57,63]],4),
//            3
	          Pseq([[53,57,63]],4),Pseq([[53,57,62]],2),Pseq([[53,56,62]],2),
//            4
	          Pseq([[52,56,62]],4),Pseq([[52,55,62]],2),Pseq([[52,55,61]],2),
//            5                                          6
	          Pseq([[52,55,60]],4),Pseq([[52,54,60]],4), Pseq([[52,54,60]],4),Pseq([[51,54,60]],4),
//            7                     8
	          Pseq([[50,54,60]],8), Pseq([[50,53,60]],4),Pseq([[50,53,59]],4), // bar 7,8
//            9                                          10
	          Pseq([[48,52,59]],2),Pseq([[48,52,57]],6), Pseq([[47,52,57]],2),Pseq([[47,51,57]],2),Pseq([[48,52,57]],4),
//            11                                         12
	          Pseq([[47,51,57]],4),Pseq([[48,52,57]],4), Pseq([[47,51,57]],2),Pseq( [\r], 6),
//            13                    14
	          Pseq([[55,59,64]],8), Pseq([[54,57,64]],4),Pseq([[53,57,63]],4),  // bar 13, 14
//            15
	          Pseq([[53,56,63]],2),Pseq([[53,56,62]],2),Pseq([[52,56,62]],4),
//            16
	          Pseq([[52,55,62]],2),Pseq([[52,55,61]],2),Pseq([[49,52,58]],2),Pseq([[48,52,57]],2),
//            17
		      [23,47],Pseq([[57,60,66,69]],3),[55,59,63,66],Pseq([[55,59,64]],3),
//            18
	          Pseq([[57,60,64]],2),45,[52,54,60],Pseq([[47,52,59]],2),Pseq([[48,52,57]],2),
//            19
	          Pseq([[47,52,59]],4),Pseq([[48,52,57]],4),
//            20
	          Pseq([[47,52,59]],4),Pseq([[47,51,59]],2),Pseq([[47,51,57]],2),
//            21
      	      Pseq([[48,55]],4), Pseq([[48,58]],2),Pseq([[48, 52, 57]],2),
//            22
              Pseq([[47,52,57]],2), Pseq([[47,52,56]],2),Pseq([[47,52,55]],4),
//            23             24                  25
	          [46,48,55],\r, [35,47],[35,42,47], [30,42]
             ];

//               1-22               23   24   25
var bDur   = [1, Pseq([1/2], 22*8), 2,2, 2,2, 4];

var instr = \mdapiano;

var bA = Pbind(\instrument, instr ,\midinote, Pseq(bNotes), \dur, Pseq(bDur),
	 \legato, 0.8, \vel, 60, \random, 0.0, \stret, 0.0);

var tA = Pbind(\instrument, instr ,\midinote, Pseq(tNotes), \dur, Pseq(tDur),
	\legato, 0.8, \vel, 90, \random, 0.0, \stret, 0.0);

~score = Ppar([bA,tA]);
~score.play(TempoClock(50/60));
)

//////////////////////////

Here is my problem. In piano music, 
a chord is held down simultaneously.  But then
some voices can move while other notes are still held down.
i.e the chord notes have different durations? Does anyone
know an elegant way to deal with this?

thanks, Stewart
raw 4740 chars (focus & ctrl+a+c to copy)
reception
comments
grirgz user 19 Feb'22 08:02

for questions, it is better to use the SC forum: https://scsynth.org/ this site is for sharing finished/demo/working code.

About your question it's not possible to have different \dur for a chord but you can have different \legato or \sustain, just put an array like you do for notes