Description:
Hi all
The code run but I think some of the parts may be slightly out of sync…and once Thorny just closed. My PC specs are ok I think, Windows 11; 64GB DDR5 Ram; Processor is i7-10700K CPU @ 3.8GHz 8 cores 16 logical processors
I am only running Thorny and I did another version of the code where I save all the computations for the envelope in a list so nothing is computed as I go through the for loop…Any suggestions will be appreciated …thanks in advance
Error printout:
WARNING:root:Clock MASTER (beat=2.833333333333333) is running noticeably behind real time (0.06216 s) on a wait call of 0 s; probably processing is too heavy.
(Place the error printout here)
The full code that resulted in the error:
(Place code here)
staccato,staccatissimo,marcato,tenuto,accent ="staccato", "staccatissimo", "marcato" , "tenuto", "accent"
```def playInstrument(inst, interval, whenNotToPlay, listMelody,listRhythm ):
articulations = [staccato,staccatissimo,marcato,accent] #[staccato,staccatissimo,marcato,tenuto,accent]
for pitch, rhythm in zip(listMelody,listRhythm ):
if counter%whenNotToPlay==0 and counter >0:wait(rhythm)
else:
levels, curves = [],[]
for i in range(0,randint(2,6)):
levels.append(round((random()+0.1),2)) #round to 2 decimal places
curves.append(randint(-5,5))
avTime = rhythm/(len(levels)) #(len(levels)-1)
dur = [avTime]*(len(levels)-1)
fp_cres = Envelope.from_levels_and_durations(levels, dur, curves)
if random() <=0.75: articulation = articulations[2]
else : articulation = choice(articulations)
inst.play_note(pitch+interval , fp_cres,rhythm, articulation)
#wait(
cello_whenNotToPlay,oboe_whenNotToPlay, piano_whenNotToPlay, brass_whenNotToPlay = randint(2,6),randint(2,6) ,randint(2,6) ,randint(2,6)
cello_interval,oboe_interval,piano_interval,brass_interval = 0,31,16,-12
#playInstrument(cello, cello_interval, cello_whenNotToPlay, listMelody,listRhythm )
fork(playInstrument, args = [cello, cello_interval, cello_whenNotToPlay, listMelody,listRhythm ])
fork(playInstrument, args = [oboe, oboe_interval, oboe_whenNotToPlay, listMelody,listRhythm ])
fork(playInstrument, args = [piano, piano_interval, piano_whenNotToPlay, listMelody,listRhythm ])
fork(playInstrument, args = [brass, brass_interval, brass_whenNotToPlay, listMelody,listRhythm ])
s.wait_for_children_to_finish()
#**************************************************************************************************************
#i tried this version to store values calculated for the envelope(levels, durations, curves ) into a list so that as the play_note loops through the melody list there will not be much calculations i thought.... but with the same problem
# def playInstrument(inst, interval, whenNotToPlay, listMelody,listRhythm ):
# articulations = [staccato,staccatissimo,marcato,accent] #[staccato,staccatissimo,marcato,tenuto,accent]
# list_fp_cres, list_articulation = [],[] #[[]],[[]],[]
# for pitch, rhythm in zip(listMelody,listRhythm ):
# if counter%whenNotToPlay==0 and counter >0:wait(rhythm)
# else:
# levels, curves = [],[]
# for i in range(0,randint(2,6)):
# levels.append(round((uniform(0.05, 0.7)),2)) #round to 2 decimal places
# curves.append(randint(-5,5))
# avTime = rhythm/(len(levels)) #(len(levels)-1)
# dur = [avTime]*(len(levels)-1)
# fp_cres = Envelope.from_levels_and_durations(levels, dur, curves)
# if random() <=0.75: articulation = articulations[2]
# else : articulation = choice(articulations)
# list_fp_cres.append(fp_cres)
# list_articulation.append(articulation)
# for pitch, rhythm, fp, art in zip(listMelody,listRhythm, list_fp_cres,list_articulation): inst.play_note(pitch+interval , fp,rhythm, art)
#
# cello_whenNotToPlay,oboe_whenNotToPlay, piano_whenNotToPlay, brass_whenNotToPlay = randint(2,6),randint(2,6) ,randint(2,6) ,randint(2,6)
# cello_interval,oboe_interval,piano_interval,brass_interval = 0,31,16,-12
# #playInstrument(cello, cello_interval, cello_whenNotToPlay, listMelody,listRhythm )
# fork(playInstrument, args = [cello, cello_interval, cello_whenNotToPlay, listMelody,listRhythm ])
# fork(playInstrument, args = [oboe, oboe_interval, oboe_whenNotToPlay, listMelody,listRhythm ])
# fork(playInstrument, args = [piano, piano_interval, piano_whenNotToPlay, listMelody,listRhythm ])
# fork(playInstrument, args = [brass, brass_interval, brass_whenNotToPlay, listMelody,listRhythm ])
# s.wait_for_children_to_finish()