Hey all! Tnx for the help. I’m working on a project which intends to use the printing in the log window in sync with the audio loop. So I have created 4 lists with the same content and made it in the way that it prints me every possible combination (1 comb each line). My idea is to control the printing frequency and add a sound to each time it prints.
So far, I could manage to make the function play the audio line BUT it prints all the lines at once and then starts the audio loop. While what I wanted is that every line gets printed at each cycle, in synch with the loop. The thing is that the printing function works in a sandbox while using time.sleep(1). like this
import time
def myFunction():
list1 =["blue", "red", "green", "yellow"]
list2 =["blue", "red", "green", "yellow"]
list3 =["blue", "red", "green", "yellow"]
list4 =["blue", "red", "green", "yellow"]
for i in list1:
for u in list2:
for t in list3:
for v in list4:
def printar():
print(i, u, t, v)
return
time.sleep(1)
printar()
myFunction()
it prints every line with a different combination result at each second. So the idea was to include the audio loop inside to be played at each iteration.
but when “translated” to FoxDot/Pulsardo (properly toggled, working and tested) it don’t.
def myFunction():
list1 =["blue", "red", "green", "yellow"]
list2 =["blue", "red", "green", "yellow"]
list3 =["blue", "red", "green", "yellow"]
list4 =["blue", "red", "green", "yellow"]
for i in list1:
for u in list2:
for t in list3:
for v in list4:
def printar():
print(i, u, t, v)
bd >> play ("xox-")
return
#Clock.future(0.1, printar)
#Clock.schedule(printar, 0.1)
printar()
myFunction()
Here (with both commented) it prints me everything at once and then starts to play the audio loop (indefinetelly). If I uncomment one of them, it behaves the same but it also “scrambles” the printing result.
I pretty much tried to put Clock.future and/or Clock.schedule everywhere and I can get nice glitchy results, but none of them print me each line at each beat (in synch with the audio loop).
Hope I made myself clear. If anyone have a light I’d appreciate it!