x

Francis Cardini's icon
Source Audio's icon

The patch as is makes no sense.
line~ does not do any "loop" like that.
speed 1 or 0 message would just start or stop playback,
so would behave same as pause and resume messages.
To the problem :

it is not visible what You exactly receive from arduino, I guess it is stream 0 - 1024.
And it is running continuously, so if object is outputing 1 or 0 all the time
as fast as serial objects receives data.
Thats why the delay objects does not output anything, it gets continuously retriggered.
Simple cure - insert change object between if and sel 1 0

And check stop message to delay when You want to surpress it's output
---------
Still ... one could do more usefulll stuff with LDR output ...

Francis Cardini's icon

Thank you for your help!!

Stopping/ starting playback is what I wanted to achieve I just wanted it to be able to fade in and out or continue for a few seconds when I remove my hand.

Not looking for the most useful use of LDRs I just need to do this for an assignment!

Source Audio's icon

You are welcome.
The difficult part here is to decide how to deal with
Ramp time.
I mean what to do if start or stop playback should be triggered
when fades are running.
You coud try to trigger just destination and ramp time,
instead of allways starting from 0 or 1.
so the message to line~ :

1 50 , or 0 5000 would just move it to desired value,
from the current value.
I guess You want to start fast, but fade slow, so 50 ms for fade in
and 2000 - 5000 for fadeout would be ok.
And if You are using fades You don't need to stop playback at all,
could let it run in loop all the time.