Tag Archives: wave

Nov 12 2014

Wave CHOP tutorial.

The Wave CHOP. TouchDesigner 088. 2014.
The Wave CHOP can generate static or dynamic waveforms.

1
00:00:00,600 –> 00:00:04,033
Let’s examine the wave CHOP.

2
00:00:04,033 –> 00:00:05,833

3
00:00:05,833 –> 00:00:13,867
Here we have an example with
three wave CHOP operators.

4
00:00:13,867 –> 00:00:21,867
Remember we can hit the H key to
home our screen, which will
center all of operators.

5
00:00:21,867 –> 00:00:30,333
And we can hit the P key to
display the parameters for the
selected operator.

6
00:00:30,333 –> 00:00:31,567

7
00:00:31,567 –> 00:00:38,867
In the first example we will
examine the concept of time in
Touch Designer.

8
00:00:38,867 –> 00:00:40,633

9
00:00:40,633 –> 00:00:44,033
These are examples of Python
expressions,

10
00:00:44,033 –> 00:00:49,300
that reference the amount of
time a node has been cooking.

11
00:00:49,300 –> 00:00:56,967
We can use this constantly
updating value to create an
animation engine.

12
00:00:56,967 –> 00:00:59,867

13
00:00:59,867 –> 00:01:06,567
We are animating the phase
parameter of the wave CHOP,

14
00:01:06,567 –> 00:01:16,633
then using the generated value
to animate the alpha channel of
a constant TOP.

15
00:01:16,633 –> 00:01:22,333

16
00:01:22,333 –> 00:01:27,400
We can generate different types
of waves.

17
00:01:27,400 –> 00:01:31,567

18
00:01:31,567 –> 00:01:34,567
The different types of waves
will affect the different

19
00:01:34,567 –> 00:01:42,167
values generated along the
waveform, and in turn affect

20
00:01:42,167 –> 00:01:49,967
the animation of any node that
references the resulting wave-
form data.

21
00:01:49,967 –> 00:01:52,633

22
00:01:52,633 –> 00:01:58,000
Let’s adjust the speed of our
animation by reducing the value

23
00:01:58,000 –> 00:02:02,167
referenced by our Python
expression.

24
00:02:02,167 –> 00:02:08,967
We’ve created of pulse waveform
type with a range of 0 to 1.

25
00:02:08,967 –> 00:02:15,533
If I keep the same wave CHOP
parameters and switch the type
to square,

26
00:02:15,533 –> 00:02:21,467
you’ll see our waveform
amplitude now ranges from -1 to
1.

27
00:02:21,467 –> 00:02:27,700
In order to create the desired
output range of 0 to 1,

28
00:02:27,700 –> 00:02:32,600
we must adjust the waveform’s
amplitude and offset

29
00:02:32,600 –> 00:02:37,167
depending on the desired type of
waveform.

30
00:02:37,167 –> 00:02:45,000

31
00:02:45,000 –> 00:02:50,267
Now let’s examine the concept of
samples in Touch Designer.

32
00:02:50,267 –> 00:02:58,767
Wave CHOP 1 has channel settings
of a start of 0 seconds and end
of 10 seconds,

33
00:02:58,767 –> 00:03:04,867
and a sample rate of 60, giving
us a grand total of 600 samples.

34
00:03:04,867 –> 00:03:10,867
For every frame processed by
Touch Designer, at 60 frames per
second,

35
00:03:10,867 –> 00:03:15,867
this operator will generate 600
samples of data.

36
00:03:15,867 –> 00:03:20,100
Wave CHOP number 2 has channel
settings of

37
00:03:20,100 –> 00:03:27,000
a start of 0 seconds, an end of
1 second, and a sample rate of
1.

38
00:03:27,000 –> 00:03:35,667
This means this operator will
generate 1 sample of data for
every frame Touch Designer
processes.

39
00:03:35,667 –> 00:03:36,733

40
00:03:36,733 –> 00:03:41,533
We can use a Python expression
to access CHOP data.

41
00:03:41,533 –> 00:03:47,500
We can access the CHOP name, the
names and numbers of channels
within the CHOP,

42
00:03:47,500 –> 00:03:51,800
and the data generated by each
channel at each sample.

43
00:03:51,800 –> 00:03:56,533
The Python expression works by
referencing the operator name,

44
00:03:56,533 –> 00:04:00,367
the channel name, and the
desired sample.

45
00:04:00,367 –> 00:04:01,700

46
00:04:01,700 –> 00:04:10,800
Here we reference the operator
“wave1”, the channel named
“chan1”, and sample 0.

47
00:04:10,800 –> 00:04:20,833
Here we reference the operator
named “wave2”, the channel named
“green”, and sample 0.

48
00:04:20,833 –> 00:04:21,767

49
00:04:21,767 –> 00:04:27,167
Let’s examine these Python
expressions in greater detail.

50
00:04:27,167 –> 00:04:33,300
Again we are referencing the
operator, the channel, and the
sample.

51
00:04:33,300 –> 00:04:37,133
In this case the channel we’re
referencing by name.

52
00:04:37,133 –> 00:04:41,767
The wave CHOP must name the
channel it creates.

53
00:04:41,767 –> 00:04:50,433
If I change the channel name,
our Python expression will
break.

54
00:04:50,433 –> 00:04:55,100
This is because we are
referencing the channel by name.

55
00:04:55,100 –> 00:05:01,900
In order for our Python
expression to work, it must know
where to look for data.

56
00:05:01,900 –> 00:05:04,000

57
00:05:04,000 –> 00:05:09,033
We can also reference channels
by number.

58
00:05:09,033 –> 00:05:12,233
The wave CHOP creates a single
channel.

59
00:05:12,233 –> 00:05:20,867
Remember to think in base 0 for
most of your numbering systems
in Touch Designer.

60
00:05:20,867 –> 00:05:26,067
Channel 0 is the first channel,
not channel 1.

61
00:05:26,067 –> 00:05:33,733
Now that we are referencing our
channel by number, we can name
our channel anything we like.

62
00:05:33,733 –> 00:05:39,833

63
00:05:39,833 –> 00:05:44,800
We have many options when we
deal with time In Touch
Designer.

64
00:05:44,800 –> 00:05:54,933
A simple but powerful method is
by using a Python expression to
reference the amount of time a
node has been cooking.

65
00:05:54,933 –> 00:06:00,300
But, as Einstein showed us, time
is relative.

66
00:06:00,300 –> 00:06:13,700
When we use the Python
expression “me.time.seconds”, we
are referencing the amount of
time this node has been cooking
in reference to the Touch
Designer timeline.

67
00:06:13,700 –> 00:06:26,533
As we watch the playhead on the
timeline, we’ll see that after
10 seconds the value of our
“me.time.seconds” expression
will reset.

68
00:06:26,533 –> 00:06:27,333

69
00:06:27,333 –> 00:06:33,967
Wave CHOP number 2 uses absolute
time as it’s time reference.

70
00:06:33,967 –> 00:06:44,800
This value is independent of the
Touch Designer timeline, and
references the amount of time
that has elapsed since Touch
Designer was launched.

71
00:06:44,800 –> 00:06:48,200

72
00:06:48,200 –> 00:06:58,833
Let’s investigate in more detail
the concept of a sample range
contained in an operator’s
channel.

73
00:06:58,833 –> 00:07:07,000
Wave CHOP number 3 is not
animating, and it contains a
range of sixty samples.

74
00:07:07,000 –> 00:07:08,667

75
00:07:08,667 –> 00:07:18,333
We will use the range of samples
created by the wave CHOP to
offset the center of a circle
TOP.

76
00:07:18,333 –> 00:07:20,467

77
00:07:20,467 –> 00:07:33,100
We’ll use the 60 discrete values
created by the wave CHOP to
offset the Y, the up and down
position of the circle TOP.

78
00:07:33,100 –> 00:07:34,900

79
00:07:34,900 –> 00:07:40,533
We have a horizontal slider that
generates an initial range of 0
to 1.

80
00:07:40,533 –> 00:07:48,933
We then use a simple CHOP
network to re-range the slider
data to fit our needs.

81
00:07:48,933 –> 00:07:57,700
The offset position of the
circle TOP corresponds exactly
to the shape of the generated
waveform.

82
00:07:57,700 –> 00:08:01,600

83
00:08:01,600 –> 00:08:13,400
As you can see, the wave CHOP is
a simple but extremely powerful
method for generating animation
paths.

84
00:08:13,400 –> 00:08:19,900

85
00:08:19,900 –> 00:08:29,833
We treat the initial 0 to 1
value range created by the
slider using a series of CHOPs.

86
00:08:29,833 –> 00:08:39,033
First we rename the incoming
channel to “x” and “y”.

87
00:08:39,033 –> 00:08:49,033
We re-range the 0 to 1 incoming
values to -.5 to positive .5.

88
00:08:49,033 –> 00:08:54,400
these values equate to “X”
position of the circle TOP.

89
00:08:54,400 –> 00:09:04,800
.5 represents the extent of
screen right, and negative .5
represents the extent of screen
left.

90
00:09:04,800 –> 00:09:06,833

91
00:09:06,833 –> 00:09:16,133
Next we re-range the incoming
“y” value of 0 to 1, to a range
of 0 to 60.

92
00:09:16,133 –> 00:09:25,133
This is our sample range. The
wave CHOP creates a range of 60
discrete samples.

93
00:09:25,133 –> 00:09:36,767
As we move the slider from left
to right, we change the value of
the waveform shape we are
sampling from.

94
00:09:36,767 –> 00:09:48,533
Here the slider has generated a
value of 17, and we are sampling
the 17th value of the sample
range of the waveform shape.

95
00:09:48,533 –> 00:09:49,667

96
00:09:49,667 –> 00:09:57,267
.5 represent screen top, -.5
represents screen bottom.

97
00:09:57,267 –> 00:10:03,000

98
00:10:03,000 –> 00:10:07,667
Let’s take a closer look at our
Python expressions.

99
00:10:07,667 –> 00:10:09,100

100
00:10:09,100 –> 00:10:24,700
In order to generate our “x”
value, we reference first the
“math1” operator, then channel
“x” from the “math1” operator,
and finally evaluate the sample.

101
00:10:24,700 –> 00:10:37,433
In this case, the “math1”
operator creates only one
sample, therefore we don’t need
to reference it specifically by
number when we evaluate it.

102
00:10:37,433 –> 00:10:39,933

103
00:10:39,933 –> 00:10:47,167
To generate our “y” value, we
use a slightly more complicated
Python expression.

104
00:10:47,167 –> 00:10:53,267
I’ll demonstrate how we nest one
Python expression within
another.

105
00:10:53,267 –> 00:11:03,933
We use the familiar sequence-
operator, channel, then sample-
when we create our expression
string.

106
00:11:03,933 –> 00:11:05,267

107
00:11:05,267 –> 00:11:12,667
We need to reference the
operator named “wave3” and its’
first channel.

108
00:11:12,667 –> 00:11:16,900
BUT which sample do we wish to
evaluate?

109
00:11:16,900 –> 00:11:21,967
We can choose any sample from a
range of 60.

110
00:11:21,967 –> 00:11:24,667

111
00:11:24,667 –> 00:11:35,300
In order to dynamically change
the sample we wish to evaluate,
we need another Python
expression.

112
00:11:35,300 –> 00:11:48,933
The value created by the slider,
and re-ranged by the “math2”
operator, is the number of the
sample we wish to evaluate.

113
00:11:48,933 –> 00:11:51,100

114
00:11:51,100 –> 00:11:59,300
To access this value, we use our
familiar Python string-
operator, channel, sample.

115
00:11:59,300 –> 00:12:09,733
The operator is “math2”, the
channel is 0, and we evaluate
the first sample.

116
00:12:09,733 –> 00:12:15,100
We can also access the channel
by name, in this case “y”.

117
00:12:15,100 –> 00:12:17,800

118
00:12:17,800 –> 00:12:30,933
Now I will cut that entire
Python expression string, and
use it as the “.eval” argument
in my first Python string.

119
00:12:30,933 –> 00:12:31,900

120
00:12:31,900 –> 00:12:42,500
Now the value of the “math2”
operator is the value we use to
sample the waveform shape of the
“wave3” CHOP.

121
00:12:42,500 –> 00:12:43,533

122
00:12:43,533 –> 00:12:53,233
By nesting one Python expression
in another, we are able to
access two operators
simultaneously-

123
00:12:53,233 –> 00:12:55,233
and apply selected values from
them to another operator- in
this case the circle TOP.