Three Beginner Questions

ComfortableInClouds's icon

Hi, so I am not a very experienced programmer, but have been learning to develop Max externals in a course I am taking. There's a few things I am trying to figure out in writing my own externals that I hoped the people on this forum could help me with:

1. In one object I am building, I have separate clocks for each outlet. When calling the clock_function, how can I specify which clock/outlet to call? I have tried putting that information into a variable in my object's struct, but prolems arise when multiple clock_functions are modifying that variable at the same time.

2. How do I create anti-aliased wavetables for saw, square and triangle waveforms? I have tried creating them by running each value in the wavetable through a two pole, two zero low pass filter at 20 kHz (coefficents determined through the [filtergraph~] object), with no luck. I also tried implementing the mathematic formulas found here:

only up to the kth partial (where k * f < Nyquist frequency). Also no luck.

3. How do I link an array of values to a [buffer~] object?

Thanks for any help. I look forward to your replies.

Mattijs's icon

Hi CiC,

It seems to me that your second question doesn't necessarily relate to max external development but to dsp programming in general, which usually takes a lot of time to get into. http://www.musicdsp.org/ might be of some help there.

Greets,
Mattijs

ComfortableInClouds's icon

thanks matt, that seems like a valuable resource.

i should elaborate on my first question: basically, i ahve X number of inlets, and X number of outlets. When a bang is received in an inlet, a variable number of bangs are output the corresponding outlet. However, when multiple bangs are received in multiple inlets at the same time, the variable in my main object's struct where i store the inlet number (my clock function then uses this to determine what outlet to output bangs from) gets overwritten so only the last value received gets output. what can i do to prevent this?

ComfortableInClouds's icon

i found out the answer to my first question: I needed to create a separate struct for a clock/outlet pair, then create an array of these structs within my main struct.