Introduction to control signals and blocks
Oct 8, 2022 at 9:00 AM
Last updated
Oct 8, 2022 at 9:00 AM
Last updated
An audio signal in the FV-1 is something that you actually listen to (or could). A control signal is a number which affects some other part of the algorithm, usually changing at a rate much lower than audio signals. For example, a pot control delivers a value which can be multiplied with an audio signal to implement a volume control.
A voltage of 0 is interpreted numerically as 0, whereas a voltage of 3.3 volts (the supply voltage) is returned as 0.999-something (numerically very close to 1.0).
Virtually all control signals operate from 0 to 1. An exception is the SIN/COS LFO which naturally puts out a signal from -1.0 to 1.0, and another is the triangle/ramp LFO which I will describe in a future article.
Pot blocks
The most straightforward control blocks in SpinCAD, which you will use all the time, are the Pot blocks. You have Pot0, Pot1, and Pot2, which correspond to the voltages on the corresponding pins of the FV-1.
The Pot0 block has one output, which is the Pot value. When using the simulator, the Pot values can be adjusted using the 3 sliders located in the simulator bar as shown.
The Pot blocks also offer a control panel. There is a checkbox (oh and look the layout is squished, I'll have to fix that).
The checkbox says "Speed Up". When checked, this implements Don Stavely's pot speedup code, which is documented here at the Spin Forum. It's a great idea. Thanks Don!
The scale/offset instruction is used all over the place. A very common thing to use it for is to transform the 0 to 1 range of a Pot to a more limited range to control an audio circuit block. It is also possible to invert signals and/or add gain to them to make them move farther than the incoming control signal. Here's the description at the Spin Knowledge base.
If you've programmed Spin ASM directly, you know that the scale/offset instruction looks like:
SOF m, b
The reason I've used m and b is to give the result the same form I learned in 7th grade algebra 3,000 years ago. Assuming that the value in the accumulator is "x", then after executing
SOF m, b
The value in the accumulator will be:
mx + b
Where m is the slope and b is the "intercept", or point on the y-axis that the line crosses when x=0.
There are limits to how big you can make the values of m and b, and the ALU in the FV-1 clips to +/- 1, so that's the full range of values you can get out of this instruction.
The scale/offset block control panel does not let you enter m and b directly. Rather, it gives you some sliders showing what input range will be mapped to what output range, which is more often what I am thinking about. An example follows.
Example
Suppose you want to tune an auto-wah. I'll start with the "2P SVF Fixed Q" filter with the settings as shown.
Use a simulator source file which has some content like what you want to wah (e.g. some funky rhythm licks) and then run the simulator and listen while you slide the Pot0 slider back and forth. Note the places where you want the top and bottom of the sweep to wind up. Below, "low" is 0.25 while "hi" is 0.95.
To add a scale/offset block that maps the range 0 - 1 to 0.25 - 0.95, select "Scale/offset" from the "Instructions" menu, then set the control panel sliders as shown.
What this means is that input low (0.0) maps to output low (0.25) while input high (1.0) maps to output high (0.95). The calculated values for scale and offset are shown. So, if you have an expression pedal supplying the voltage to the Pot0 pin, it will now sweep over the reduced range of the filter. You can adjust this to get just the sweep you want.
If you replace the Pot with an LFO that goes from 0 to 1, then you will get an automatic sweep over the optimized range.
Most of the time, I set the controlled block (filter, LFO, delay) so that the highest value corresponds to what I want when the incoming control signal is at 1.0, but this is not absolutely necessary. In the wah filter example, if you want the high end to go higher, you will have to increase the frequency in the filter's control panel as there's no way to get more than that setting, only less.
The calculated value will turn red if you enter something that exceeds the valid ranges for the parameter, for example:
Some people who are familiar with writing Spin ASM by hand might prefer a more straightforward way to enter values for scale and offset directly into a SOF statement. If they do, nobody has ever mentioned it to me. I set up the controls for this block the way I did simply because that's how I always think about the SOF - mapping one range linearly to another. What do you think?
Tip for making fine adjustments
You may find it difficult to set an exact value when dragging the slider handle using the mouse. In such cases you can click on the slider handle to select it, then use the left and right arrow keys to increment the parameter by its smallest value.