using clock_delay for polling object

Jun 6, 2007 at 3:03am

using clock_delay for polling object

Hi folks,

I have an MSP object which perform envelope extraction on its input.
All the necessary calculations are carried out in the perform loop at
the sampling rate. However I don’t really need the output of my object
to be at audio rate since the envelope of the signal can be
sampled at a much lower rate by the Max scheduler without significant
loss of information.

To achieve this goal, I have created a clock so that the object can be
polled at a specified scheduler interval.

Now what would be the best strategy ?

1 – create a ‘start’, ‘stop’ and ‘interval’ methods and
make my clock interval user controllable like many objects do

2 – call my clock_delay function (with an argument of 0) at the end of
the perform routine outside of the perform loop ?

Both methods seem to work, however I am not sure if the latter would be
a good strategy. I am thinking specifically about the case when many
objects are to be instantiated in a patch. In this case they will all
concurrently call the clock function, causing calculations to be
performed at the same time at the end of each audio vector.

Could that cause potential problems ?

What are the consideration for choosing one versus the other ?

Thanks for any insight.

Best.

- Luigi

————————————————————
THIS E-MAIL MESSAGE IS FOR THE SOLE USE OF THE INTENDED RECIPIENT AND MAY CONTAIN CONFIDENTIAL AND/OR PRIVILEGED INFORMATION. ANY UNAUTHORIZED REVIEW, USE, DISCLOSURE OR DISTRIBUTION IS PROHIBITED. IF YOU ARE NOT THE INTENDED RECIPIENT, CONTACT THE SENDER BY E-MAIL AT SUPERBIGIO@YAHOO.COM AND DESTROY ALL COPIES OF THE ORIGINAL MESSAGE. WITHOUT PREJUDICE UCC1-207.
————————————————————

Fussy? Opinionated? Impossible to please? Perfect. Join Yahoo!’s user panel and lay it on us. http://surveylink.yahoo.com/gmrs/yahoo_panel_invite.asp?a=7

#32284
Jun 21, 2007 at 5:17am

hi Luigi: i’m not that sure but maybe we have similar problems…
i’m trying to read samples from 8 channels of a usb-card (NI DAQmx 6008i), in a callback method.
Then i don’t make use at all of MSP, but i have the need of using a custom control rate… i receive the suggestion of use clock and the defer (or defer_low) mechanism (if you read http://www.cycling74.com/forums/index.php?t=msg&th=26931&start=0&rid=5771&S=1ee67e73279c30a011d05abe418d7784 my topic maybe could be useful for your task too)

i’m not that sure, but the second options could be fine, with the defer_low mechanism

#105904
Jun 21, 2007 at 6:21am

Well, I don’t really have a problem…

In my thread:

http://www.cycling74.com/forums/index.php?t=msg&goto=106947&rid=0&S=4d7093dabba3e3c0fa3041f57c8d7632&srch=polling+object#msg_106947

I was just asking the best strategy to poll an object. Both ways I
tried work and I have implemented one I chose arbitrarily. I wanted to
ask the gurus if one method might be preferred over the other, and my
question is still open since I haven’t received any replies to my
initial question.

In your case – from what I understand – you have a callback method that
reads samples from your card and you are trying to output those sample
values at a regular interval.
I am not familiar with the card you are using, however since we are
talking about sampling rate – 44100 Hz I assume – I would not mess with
the Max scheduler at all. There’s way too much information needing to
be output at a too fast of a rate.

I would find a way to synchronize the callback function with the DSP
method of the object, so that you’re using the sampling rate as your
clock source. In this case your object will be an MSP object and will
have 8 signal outlets. So, no need to defer anything or to use clocks
because your data will be processed in the audio thread.

Hope this helps.

- Luigi

P.S.
Sono italiano anch’io. Scrivimi pure al mio indirizzo privato se hai
bisogno di ulteriore aiuto. Ciao.

— seralf wrote:

>
> hi Luigi: i’m not that sure but maybe we have similar problems…
> i’m trying to read samples from 8 channels of a usb-card (NI DAQmx
> 6008i), in a callback method.
> Then i don’t make use at all of MSP, but i have the need of using a
> custom control rate… i receive the suggestion of use clock and the
> defer (or defer_low) mechanism (if you read
>
http://www.cycling74.com/forums/index.php?t=msg&th=26931&start=0&rid=5771&S=1ee67e73279c30a011d05abe418d7784
> my topic maybe could be useful for your task too)
>
> i’m not that sure, but the second options could be fine, with the
> defer_low mechanism
>

————————————————————
THIS E-MAIL MESSAGE IS FOR THE SOLE USE OF THE INTENDED RECIPIENT AND MAY CONTAIN CONFIDENTIAL AND/OR PRIVILEGED INFORMATION. ANY UNAUTHORIZED REVIEW, USE, DISCLOSURE OR DISTRIBUTION IS PROHIBITED. IF YOU ARE NOT THE INTENDED RECIPIENT, CONTACT THE SENDER BY E-MAIL AT SUPERBIGIO@YAHOO.COM AND DESTROY ALL COPIES OF THE ORIGINAL MESSAGE. WITHOUT PREJUDICE UCC1-207.
————————————————————

Be a better Heartthrob. Get better relationship answers from someone who knows. Yahoo! Answers – Check it out.

http://answers.yahoo.com/dir/?link=list&sid=396545433

#105905

You must be logged in to reply to this topic.