• Dannmar

    @lacuna said:

    For me it is hard to know because information is missing:
    This part I don't understand:

    and also to trigger this sample as soon as there is something echoing the trigger at a distance inferior of 15cm using a Threshold~ object

    but this works already, doesn't it?
    In which condition you want the sample to stop?
    What kind of sensor?
    What is attached to pins 11 and 12?
    What data does [adc~ 12] output when moving hand?
    Is [print Distance (cm) : ] about correct?
    Which Bela tutorial are you referring to?

    [rzero~ 1] does some integration, I think. [dac~ 11] outputs ultrasonics? [line~] till 1000 and [adc~ 12] going into [samphold~] measures the time untill the reflected ultrasound is detected or sth like that?

    Generally speaking, when developing something it is important to understand what is going on instead of blind copy&paste. And when asking, to provide all information you have to make it easy / possible to answer.

    Hello, thanks for taking the time to answer my question, I really appreciate it; and sorry for having missed some important information.

    This patch works as it will start playback when I put my hand on the sensor, but it won't stop playback when I remove my hand from the sensor range, and I'm still figuring out how to work this out. When I remove my hand the distance keeps going up, and thus the volume, until it reaches 25cm which is the limit I've put with [min25]. Your fade out patch makes sense but I still need something to bang it when I remove the hand from the sensor, putting a Threshold at 24cm for example kind of works, but it's not completely natural; imagine you're at 5cm and remove your hand, so the volume goes up to 24cm and then stops playback...

    The sensor is the HC-SR04, pin 11 send triggers to ultrasonics every 60ms, echo receives feedback and sends it to pin 12, which with a time equation calculates distance. What [adc~ 12] outputs is a good question, I try to figure it out myself too, but it doesn't work with normal [print] command, not till it reaches [snapshot~] so then it outputs the distance in cm again. The distance is quite accurate, I think the real distance is a bit longer than the printed in console. The Bela tutorials are the official ones at https://learn.bela.io/tutorials/pure-data/sensors/distance-sensor/

    What I've done at the moment is sample holding and snapshotting the distance so it stays in place, so if I want to "stop" the sample I just bring the distance near 0 with my hand very close bringing the volume near 0 and nearly unnoticeable, but the playback starts from the beginning with a [loadbang] is just that at any distance you'll put your hand the volume will go up. This works well in this case as the samples are standing notes, but it would be cooler if it starts from the beginning. I know there is some way to use this sensor as a trigger but I can't find any information.

    posted in I/O hardware diyread more
  • Dannmar

    Hello,

    I'm making a sample based instrument using sensors. So far I'm able to control the volume of the sample, the longer the distance to the sensor the louder it will be, and also to trigger this sample as soon as there is something echoing the trigger at a distance inferior of 15cm using a Threshold~ object. Now I'm just looking for a way to stop the sample whenever I remove my hand from near the sensor, and if possible with a fade-out to make the stop less abrupt. Does anyone know any way to do this? In Bela's documentation they refer as the object [rzero~ 1] to detect activity, but how could I turn that into a non-activity detector? I leave here my patch, any help will be appreciated, thanks in advance!Screenshot 2024-05-23 at 13.11.34.png

    posted in I/O hardware diyread more

Internal error.

Oops! Looks like something went wrong!