The most recent version of this page is a draft.DiffThis version (10 May 2021 14:50) was approved by Prasad Kamath.The Previously approved version (21 Mar 2021 08:44) is available.Diff

This is an old revision of the document!

Click here to return to the GPIO Conditioning page

Rotary Volume


The Rotary Volume block controls the volume level of an input audio signal, using the GPIO rotary encoder inputs. This block has the functionality of the Rotary Encoder, Up/Down Control, Index lookup Table, and SW External Volume control blocks all in one algorithm control. The user has the flexibility to define a custom volume curve that will be scrolled through by the rotary encoder.


The Rotary Volume control allows a GPIO inputs from a rotary encoder to control a custom volume curve. The volume curve can be any linear, logarithmic, or custom curve designed with any number of points. When the encoder is turned the volume will increase or decrease according to the volume curve in the table. The transition between points in the table has a smooth transition and the rate is determined by the Slew rate parameter. The Debounce time is used to smooth the actual physical input of the GPIO rotary encoder.

The following image shows how two GPIO inputs are used to control the volume algorithm in the Rotary Volume block. The Rotary Volume algorithm has been grown in order to support stereo audio. A mux switch allows comparison between the direct signal from the Inputs, and the volume adjusted signal, routed to the Outputs. The Interface Read and Write blocks allow the last volume level to be saved and recalled.

Targets Supported

Push and Hold Not supported Not supported Sample



Up VolumeControlControl Signal input for rotary volume increment
Down VolumeControlControl Signal input for rotary volume decrement
InterfaceInLogicInterface Read register to load previous constant volume data value to algorithm
Input0AudioAudio to the volume control


InterfaceOutLogicInterface Write register to store constant volume data for recall
Output0AudioVolume adjusted audio output

Configurable Parameters

GUI Parameter NameDefault ValueRangeFunction Description
—————————————- ———————- ————————————- —————————————-
CountMax20[0, 1000]Sample counter for the Debounce time on the Rotary Encoder
NoOfTableValues33 pts[2, 800]Sets the table size: the  number of points used in the volume table curve.
TableValues1[-16, 15.99]The table points are the actual gain values for the volume curve in linear representation. Although the range supports the full values of [-16, 15.99] the table values should generally be between [0, 1] for proper gain adjustments. The user has full control in this table to add a linear, logarithmic of custom gain volume curve
SWSlew12[1, 23]Controls the slew ramp speed for the volume transition between consecutive volume gain points

DSP Parameters

Parameter NameDescriptionADAU145x/ADAU146x
—————————-——————————————————————————————————- ———————————
countmaxThe integer number is directly written to the DSP Fixed Point 32.0
table_p0All the points in the table are written to the DSP in their linear gain formatFixed Point 8.24
stepRotaryVolAlg1stepThe value for the slew rateFixed Point 8.24

DSP Parameter Computation

step = 2^(-1*SWSlew)

/srv/ · Last modified: 12 May 2021 14:26 by Prasad Kamath