me.chanDigits how?

HI
how do I refer to a channel index or channel digits?
This must be so simple but I cant find out sorry. Can you please help.

none of these work

me.chan.digits
me.chanIndex
me.channel
me[‘chan1’]* me.chandigits
etc

If you’re looking to get the numeric suffix of a string, you can use:

tdu.digits

Works on any string.

To get the name (string) of a channel, use its .name member.

Both these give you:

python >>> tdu.digits(op(‘/project1/noise1’)[0].name)
1

Cheers

Thanks for getting back but I must be really dense as this still does not work for me
How do I refer to a channels own digit eg
me.channel.digits of [‘chan13’] should = 13
Or can channels not refer to themselves (their own name) ? Which would be very strange.

In regards to referencing another ops channel digits:

Is your noise1 CHOP inside project1?

Try changing it to
tdu.digits(op(’noise1’)[0].name)

And remove the tdu.digits from Chan2 as this expression makes no sense

Thanks Achim
My picture was in reply to rob. Im not trying to refer to another node.

I seem to not be making myself clear as usual

How to do refer to the name of the channel itself within the channel code. Exactly like how me.digits refers to the name of the CHOP within the CHOP.

For example in a constant I wish to get the channel name digit and use it in the channel code

[‘Chan3’]
me.chan.digits * 0.1

How do you write me.channel.digits ?

thanks

How re you creating these channels and expressions in the first place? Why don’t you just type .3 in there? Or follow it with an operator (like Math CHOP) that uses me.chanIndex * .1 ?

Ok guys thanks for trying to help
I see now that you cant refer to a channels digit or index within a constant. So its not surprising that I couldn’t work this out.
Seems very strange. This is the sort or random anomaly that puts me off learning programming.
Why have the me.digits feature if it only works in certain contexts?
me.channel.digits should just work.
I wanted to do something very simple. Just build a constant with a series of self generated channel values using the same code on each channel rather than hard set every channel.

Oh, I understand.
You were looking for an operator member in the Constant CHOP.

You can find them under the member section for each CHOP:

Unfortunately it doesn’t have any in this case, unlike some of the other CHOP operators.
Greg mentions Math CHOP me.chanIndex for what you’re trying to do.

In the attached image, I create 5 identical channels, then use the Math CHOP to individually assign their value based on their digits.

Hope that clears it up.
Cheers.

thanks rob
I can work with that.
Its frustrating when things work in one place but not another without any logic to them
Shouldn’t me.chanIndex work in any op that uses channels?

Generally yes, but its a case by case basis depending on how the specific CHOP creates it channels.

Constant CHOP could probably have some operator members, but even with me.chanIndex,
You’d still need to get to the current channel:

me[me.chanIndex] to get the current channel.

Would only make sense in the value parameter, as the name parameter is still creating that current channel.

The value expression would then be:

tdu.digits(me[me.chanIndex].name)

If we gave Channel a digits member it would simplify to:

me[me.chanIndex].digits