• SoftwareC/C++
  • Ramp signals on analog outputs and asynchrony managment

Hi, I am currently trying to send 3 ramp signals (only single ramp patterns of amplitude 0 to 1 for each) on the first 3 analog outputs of the Bela.
1) I wanted to ask if someone could suggest a methodology or existing functions to achieve this.
2) My point is to easily be able to change the duration of the signals and starting time.
3) I need to set an asynchrony between the 3 signal ~100ms. I am not sure how to get info from the clock and to set such asynchrony.

Would very much appreciate your help on this ! Thanks in advance 🙂

    What programming language are you trying to do this in?

      you won't use a "timer" as such, you'll have to "count samples". This technique is used extensively in the C++ course. This class in particular deals with generating ramps.

      Once you generate one, you should be able to make 3 of them, making them start at a desired interval betwen them.

        19 days later

        giuliomoro , Thanks for your help. I have a small question about the ramp to adapt it to my example.
        Here the ramp is used with the audio output. Should I change the to const :

        const float kFilterFrequencyMin = 200.0;
        and
        const float kFilterFrequencyMax = 4000.0;

        to make them coherent with the analog outputs limit values I want to use (0V and 5V) ?

        Thanks again.

        changing those values would change the limits of the gFilterFrequency variable, but nothing is going to be output through the analog outputs. You'll need a line such as

        analogWrite(context, frame, channel, value);

        and value should be comprised between 0 (corresponding to 0V) and 1 (corresponding to 5V). Now, I could give you the answer to do what you are asking in your initial post, but my understanding is that you are here to learn, so I'll leave it to you as an exercise, unless you tell me otherwise.

        InesL 2) My point is to easily be able to change the duration of the signals and starting time.

        what do you mean "the starting time"? Do you want the ramps to start in reaction to an external trigger?