@@ -320,56 +320,60 @@ def play(
320
320
return midi
321
321
322
322
def info (self ):
323
- print ("=" * len (repr (self )))
324
- print (repr (self ))
325
- print ("=" * len (repr (self )))
326
- print ()
327
- print ("Set Theory" )
328
- print ("==========" )
329
- print ("cardin. (d, c)\t :" , self .d , self .c )
330
- print ("pc vector\t :" , self .to_vector ())
331
- print ("complement\t :" , self .complement ())
332
- print ("transposed\t :" , self .transpose (2 ))
333
- print ("inverted\t :" , self .invert ())
334
- print ("T2I\t \t :" , self .invert (2 ))
335
- print ("normal form\t :" , self .normal_form ())
336
- print ("prime form\t :" , self .prime_form ())
337
- print ("interval vector\t :" , self .interval_vector ())
338
- print ()
339
- print ("Serialism" )
340
- print ("=========" )
341
- print ("original\t :" , self )
342
- print ("retrograde\t :" , self .retrograde ())
343
- print ("inversion\t :" , self .inversion ())
344
- print ("retro.-inv.\t :" , self .inversion ().retrograde ())
345
- print ("matrix\t \t :" , str (self .matrix ()).replace ("\n " , "\n \t \t " ))
323
+ """Returns all sorts of information on the PitchClassSet."""
324
+ tab = "\n \t \t "
325
+ s = "=" * len (repr (self )) + "\n "
326
+ s += repr (self ) + "\n "
327
+ s += "=" * len (repr (self )) + "\n \n "
328
+
329
+ s += "Set Theory" + "\n "
330
+ s += "==========" + "\n "
331
+ s += f"cardin. (d, c)\t : { self .d } , { self .c } " + "\n "
332
+ s += f"pc vector\t : { self .to_vector ()} " + "\n "
333
+ s += f"complement\t : { self .complement ()} " + "\n "
334
+ s += f"transposed\t : { self .transpose (2 )} " + "\n "
335
+ s += f"inverted\t : { self .invert ()} " + "\n "
336
+ s += f"T2I\t \t : { self .invert (2 )} " + "\n "
337
+ s += f"normal form\t : { self .normal_form ()} " + "\n "
338
+ s += f"prime form\t : { self .prime_form ()} " + "\n "
339
+ s += f"interval vector\t : { self .interval_vector ()} " + "\n \n "
340
+
341
+ s += "Serialism" + "\n "
342
+ s += "=========" + "\n "
343
+ s += f"original\t : { self } " + "\n "
344
+ s += f"retrograde\t : { self .retrograde ()} " + "\n "
345
+ s += f"inversion\t : { self .inversion ()} " + "\n "
346
+ s += f"retro.-inv.\t : { self .inversion ().retrograde ()} " + "\n "
347
+ s += f"matrix\t \t : { str (self .matrix ()).replace (chr (10 ), tab )} "
348
+
349
+ return s
346
350
347
351
348
352
if __name__ == "__main__" :
349
353
350
354
# test cases from https://musictheory.pugetsound.edu/mt21c/PrimeForm.html
351
355
s = {3 , 11 , 2 }
352
- s = {8 , 0 , 9 }
353
- s = "123E"
354
- s = "17TE"
355
- s = "941"
356
+ # s = {8, 0, 9}
357
+ # s = "123E"
358
+ # s = "17TE"
359
+ # s = "941"
356
360
# s = {11,2,3,7,2}
357
361
# s = {2,3,8,9}
358
362
# s = {0, 2, 4}
359
363
# s = {0, 1, 4, 6} # all-interval tetrachord
360
364
# s = {1,5,6,7} # from Straus, p. 58
361
365
# s = {0, 2, 4, 5, 7, 9, 11}
362
366
# s = {0,1,2}
363
- s = "147T"
364
- s = "02479"
365
- s = {6 , 9 , 2 }
367
+ # s = "147T"
368
+ # s = "02479"
369
+ # s = {6, 9, 2}
366
370
# s = {7, 10, 1, 5}
367
371
# s = [0, 1, 6, 7, 5, 2, 4, 3, 10, 9, 11, 8] # 12-tone row
368
372
369
373
pcset = PitchClassSet (s )
370
- pcset .info ()
374
+ print ( pcset .info () )
371
375
372
376
# ax = pcset.plot(kind="area")
373
377
# plt.show()
374
378
375
- pcset .play (save_as = "test.mid" , mode = "chord " )
379
+ # pcset.play(save_as="test.mid", mode="cloud ")
0 commit comments