Waveform expressions?

Nov 22, 2013 at 5:12am

Waveform expressions?

Hello, I am trying to create functions for generating waveforms outside of the signal domain using the expr object.
Sine was simple enough to achieve with:
expr sin (2 * 3.14159 * $f1 * 0.05)

I would like to make a square/pulse, triangle, and saw wave with the same method, but am having a difficult time doing so.

Can anyone help me?

#272036
Nov 22, 2013 at 12:01pm

Paging dr. Roman! Paging dr. Roman!

In the meantime, I think I can improve your code there.

Here’s something to get you started:
<code>

– Pasted Max Patch, click to expand. –

</code>

#272090
Nov 22, 2013 at 12:04pm

That is fantastic! Thank you very much!!!

#272091
Nov 22, 2013 at 1:03pm

any time – this was fun! :)

#272093
Nov 22, 2013 at 7:17pm

(damn, where is the post i just sent?)

@njosnari:
what is your aim? what are the input and output ranges you need?

@wetterberg:
expr 5%12 should work, it is just not officially supported.
otherwise use ($f1-int($f1/$f2)*$f2).

#273533
Nov 23, 2013 at 8:55am

I’m doing some modulation, and I’m trying to keep it out of the signal domain to conserve some cpu. The input and output ranges aren’t so important, mostly they’re being kept between 0 and 1 and then scaled to 0 – 4095 before leaving the patch via a DA convertor.

#273583

You must be logged in to reply to this topic.