Forums > MaxMSP

Waveform expressions?

November 22, 2013 | 5:12 am

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?


November 22, 2013 | 12:01 pm

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>


November 22, 2013 | 12:04 pm

That is fantastic! Thank you very much!!!


November 22, 2013 | 1:03 pm

any time – this was fun! :)


November 22, 2013 | 7:17 pm

(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).


November 23, 2013 | 8:55 am

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.


Viewing 6 posts - 1 through 6 (of 6 total)