Difference between revisions of "CHOP Class"

From Derivative
Jump to navigation Jump to search
(CHOP Class Auto Create)
Line 8: Line 8:
 
     |class=CHOP
 
     |class=CHOP
 
     |name=end
 
     |name=end
     |returns=
+
     |type=
 
     |set=0
 
     |set=0
 
     |text=The end index of the channels.  This can be modified only when the CHOP is a scriptCHOP.
 
     |text=The end index of the channels.  This can be modified only when the CHOP is a scriptCHOP.
Line 15: Line 15:
 
     |class=CHOP
 
     |class=CHOP
 
     |name=export
 
     |name=export
     |returns=
+
     |type=
 
     |set=0
 
     |set=0
 
     |text=Get or set export flag.
 
     |text=Get or set export flag.
Line 22: Line 22:
 
     |class=CHOP
 
     |class=CHOP
 
     |name=exportChanges
 
     |name=exportChanges
     |returns=
+
     |type=
 
     |set=0
 
     |set=0
 
     |text=Number of times the export mapping information has changed.
 
     |text=Number of times the export mapping information has changed.
Line 29: Line 29:
 
     |class=CHOP
 
     |class=CHOP
 
     |name=isCHOP
 
     |name=isCHOP
     |returns=
+
     |type=
 
     |set=0
 
     |set=0
 
     |text=True if the operator is a CHOP.
 
     |text=True if the operator is a CHOP.
Line 36: Line 36:
 
     |class=CHOP
 
     |class=CHOP
 
     |name=isTimeSlice
 
     |name=isTimeSlice
     |returns=
+
     |type=
 
     |set=0
 
     |set=0
 
     |text=True if the CHOP last cooked as a time slice.
 
     |text=True if the CHOP last cooked as a time slice.
Line 43: Line 43:
 
     |class=CHOP
 
     |class=CHOP
 
     |name=numChans
 
     |name=numChans
     |returns=
+
     |type=
 
     |set=0
 
     |set=0
 
     |text=The number of channels.
 
     |text=The number of channels.
Line 50: Line 50:
 
     |class=CHOP
 
     |class=CHOP
 
     |name=numSamples
 
     |name=numSamples
     |returns=
+
     |type=
 
     |set=0
 
     |set=0
 
     |text=The number of samples (or indices) per channel.  You can change the number of samples by setting this value, only in a scriptCHOP.
 
     |text=The number of samples (or indices) per channel.  You can change the number of samples by setting this value, only in a scriptCHOP.
Line 57: Line 57:
 
     |class=CHOP
 
     |class=CHOP
 
     |name=rate
 
     |name=rate
     |returns=
+
     |type=
 
     |set=0
 
     |set=0
 
     |text=The sample rate of the CHOP.  This can be modified only when the CHOP is a scriptCHOP.
 
     |text=The sample rate of the CHOP.  This can be modified only when the CHOP is a scriptCHOP.
Line 64: Line 64:
 
     |class=CHOP
 
     |class=CHOP
 
     |name=start
 
     |name=start
     |returns=
+
     |type=
 
     |set=0
 
     |set=0
 
     |text=The start index of the channels.  This can be modified only when the CHOP is a scriptCHOP.
 
     |text=The start index of the channels.  This can be modified only when the CHOP is a scriptCHOP.
Line 72: Line 72:
 
|items=
 
|items=
 
 
{{ClassMethod
 
    |class=CHOP
 
    |name=chans
 
    |call=chans(nameOrIndex1, nameOrIndex2..., caseSensitive=True)
 
    |returns=
 
    |text=: -> list
 
Returns a (possibly empty) list of Channels that match that specified names or indices. Multiple names and indices may be provided.
 
nameOrIndex - (Optional) One or more string names, possibly using Pattern Matching, or numeric channel index. No arguments are passed, a list of all channels is returned.
 
caseSensitive - (Optional) Specifies whether or not case sensitivity is used.
 
newlist = n.chans() # get all channels in the CHOP
 
newlist = n.chans('a*', 3,4,5, 'd*')
 
}}
 
 
{{ClassMethod
 
{{ClassMethod
 
     |class=CHOP
 
     |class=CHOP
Line 96: Line 84:
 
n.save('output.chan')  #ascii readable tab delimited format
 
n.save('output.chan')  #ascii readable tab delimited format
 
n.save('output.aiff')  #supported audio format
 
n.save('output.aiff')  #supported audio format
}}
 
{{ClassMethod
 
    |class=CHOP
 
    |name=convertToKeyframes
 
    |call=convertToKeyframes(tolerance=0.1)
 
    |returns=
 
    |text=: -> animationCOMP
 
Create an Animation COMP that contains a keyframed approximation of the CHOP's channels.
 
The resultant animationCOMP is returned.
 
tolerance - (Keyword, Optional) If this is not given, the default value is 0.1. It may be overridden for higher accuracy match between the source channels and the resulting keyframed channels.
 
 
}}
 
}}
 
{{ClassMethod
 
{{ClassMethod
Line 120: Line 98:
 
c = n.chan('chan*')
 
c = n.chan('chan*')
 
c = n.chan('chan3zall', caseSensitive=False)
 
c = n.chan('chan3zall', caseSensitive=False)
 +
}}
 +
{{ClassMethod
 +
    |class=CHOP
 +
    |name=chans
 +
    |call=chans(nameOrIndex1, nameOrIndex2..., caseSensitive=True)
 +
    |returns=
 +
    |text=: -> list
 +
Returns a (possibly empty) list of Channels that match that specified names or indices. Multiple names and indices may be provided.
 +
nameOrIndex - (Optional) One or more string names, possibly using Pattern Matching, or numeric channel index. No arguments are passed, a list of all channels is returned.
 +
caseSensitive - (Optional) Specifies whether or not case sensitivity is used.
 +
newlist = n.chans() # get all channels in the CHOP
 +
newlist = n.chans('a*', 3,4,5, 'd*')
 +
}}
 +
{{ClassMethod
 +
    |class=CHOP
 +
    |name=convertToKeyframes
 +
    |call=convertToKeyframes(tolerance=0.1)
 +
    |returns=
 +
    |text=: -> animationCOMP
 +
Create an Animation COMP that contains a keyframed approximation of the CHOP's channels.
 +
The resultant animationCOMP is returned.
 +
tolerance - (Keyword, Optional) If this is not given, the default value is 0.1. It may be overridden for higher accuracy match between the source channels and the resulting keyframed channels.
 
}}}}
 
}}}}
 
<section end=HELPBODY />
 
<section end=HELPBODY />
 
{{History}}
 
{{History}}
 
{{#invoke:Category|list|Python Reference}}
 
{{#invoke:Category|list|Python Reference}}

Revision as of 15:11, 15 September 2017

A CHOP describes a reference to a CHOP operator, containing a set of channels accessed with the Channel Class.


Members[edit]

end(Read Only):

The end index of the channels. This can be modified only when the CHOP is a scriptCHOP.

export(Read Only):

Get or set export flag.

exportChanges(Read Only):

Number of times the export mapping information has changed.

isCHOP(Read Only):

True if the operator is a CHOP.

isTimeSlice(Read Only):

True if the CHOP last cooked as a time slice.

numChans(Read Only):

The number of channels.

numSamples(Read Only):

The number of samples (or indices) per channel. You can change the number of samples by setting this value, only in a scriptCHOP.

rate(Read Only):

The sample rate of the CHOP. This can be modified only when the CHOP is a scriptCHOP.

start(Read Only):

The start index of the channels. This can be modified only when the CHOP is a scriptCHOP.

Methods[edit]

save(filepath):

: -> filepath

Saves the channel to the file system. Supported file formats are .clip, .bclip, .chan, .bchan and .aiff. Returns the file path used. filepath - (Optional) The path and filename to save to. name = n.save() #save in native format with default name n.save('output.chan') #ascii readable tab delimited format

n.save('output.aiff') #supported audio format

chan(nameOrIndex1, nameOrIndex2..., caseSensitive=True):

: -> Channel or None

Returns the first Channel that matches the given name or index or None if none are found. Multiple patterns may be specified which are all added to the search. nameOrIndex - May be a string name, possibly using Pattern Matching, or it may be a numeric channel index. caseSensitive - (Optional) Specifies whether or not case sensitivity is used. c = n.chan(4) c = n.chan('chan*')

c = n.chan('chan3zall', caseSensitive=False)

chans(nameOrIndex1, nameOrIndex2..., caseSensitive=True):

: -> list

Returns a (possibly empty) list of Channels that match that specified names or indices. Multiple names and indices may be provided. nameOrIndex - (Optional) One or more string names, possibly using Pattern Matching, or numeric channel index. No arguments are passed, a list of all channels is returned. caseSensitive - (Optional) Specifies whether or not case sensitivity is used. newlist = n.chans() # get all channels in the CHOP

newlist = n.chans('a*', 3,4,5, 'd*')

convertToKeyframes(tolerance=0.1):

: -> animationCOMP

Create an Animation COMP that contains a keyframed approximation of the CHOP's channels. The resultant animationCOMP is returned.

tolerance - (Keyword, Optional) If this is not given, the default value is 0.1. It may be overridden for higher accuracy match between the source channels and the resulting keyframed channels.

TouchDesigner Build: