This version (03 Aug 2012 22:48) was approved by William Jahn.The Previously approved version (03 Aug 2012 22:48) is available.Diff

Rotary Volume

Click here to return to the GPIO Conditioning page

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.

Input Pins

[int/dec] - [control/audio]
Function Description
Pin 0: Rotary Input Upint - controlControl signal from GPIO rotary encoder that increments the volume
Pin 1: Rotary Input Downint - controlControl signal from GPIO rotary encoder that decrements the volume
Pin 2: Interface Readn/aInterface Read register to load previous constant volume data value to algorithm
Pin 3: Input Audiodecimal - audioAudio Input to the volume control

Output Pins

[int/dec] - [control/audio]
Function Description
Pin 0: Interface Writen/aInterface Write register to store constant volume data for recall
Pin 1: Output Audiodecimal - audioVolume adjusted audio output

GUI Controls

GUI Control NameDefault ValueRangeFunction Description
Debounce20[0, 1000]Sample counter for the Debounce time on the Rotary Encoder
Volume Table Points33 pts[2, 800]Sets the table size: the  number of points used in the volume table curve.
Volume Table Values1[-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
SW Slew Rate12[1, 23]Controls the slew ramp speed for the volume transition between consecutive volume gain points

DSP Parameter Information

GUI Control NameCompiler NameFunction Description
DebounceRotaryVolAlg1countmaxThe integer number is directly written to the DSP.
Volume Table ValuesRotaryVolAlg1table_p0
All the points in the table are written to the DSP in their linear gain format.
SW Slew RateRotaryVolAlg1stepThe value for the slew rate written to the DSP follows the formula:
2^(-SW Slew Rate)

Algorithm Description

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.

Algorithm Details

Toolbox PathGPIO Conditioning - Volume Control - Rotary - Rotary Volume
Cores SupportedADAU170x
“Grow Algorithm” Supportedyes - see Algorithm Growth Information
“Add Algorithm” Supportedno
Subroutine/Loop Basedno
Program RAM88*
Data RAM41*
Parameter RAM36* - Based on 33 points in table: each point = 1 Parameter RAM

*Numbers are based on one instance of the algorithm with no additional “add” or “grow”

Algorithm Growth Information

DescriptionWhen the Rotary Volume algorithm is grown, an extra pair of input/output pins are added to the control. All the same processing occurs in terms of the rotary encoder volume processing, but the growth allows for new pairs of input/output audio signals, in order to apply the gain adjustment.
Program RAM Repetition2 per growth
Data RAM Repetition9 per growth
Parameter RAM Repetitionnone
resources/tools-software/sigmastudio/toolbox/gpioconditioning/rotaryvolume.txt · Last modified: 03 Aug 2012 22:48 by William Jahn