This version (02 Aug 2012 17:21) was approved by William Jahn.The Previously approved version (02 Aug 2012 17:20) is available.Diff

PushButton Volume

Click here to return to the GPIO Conditioning page

The PushButton Volume block can be used with the GPIO push buttons to control the volume of an input audio signal. This block has the functionality of the Push and Hold, Up/Down Control, Index lookup Table, and SW External Volume control all in one block. The user has the flexibility to define a custom volume curve that will be scrolled through by the pushbuttons.

This block has the same functionality as the PushButton Volume, Mute algorithm, without the mute feature when both GPIO buttons are pressed simultaneously.

Input Pins

[int/dec] - [control/audio]
Function Description
Pin 0: PushButton Upint - controlGPIO signal from Pushbutton that increases the volume
Pin 1: PushButton Downint - controlGPIO signal from Pushbutton that decreases the volume
Pin 2: Interface Readn/aInterface Read register to load previous constant data value to algorithm
Pin 3: Interface Readdecimal - 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
Invert GPIOunchecked[checked,
Clicking this button inverts the signal on the inputs for the GPIO push buttons. SigmaDSP GEN2 hardware has register features to invert the signal, however GEN3 hardware does not support this. Checking or un-checking this box requires a re-compilation since program code is added or removed to achieve this function.
Hold (ms)500[0, 10000]Determines how long the current volume level is held before the repeat pulses are generated to increase/decrease the volume while the button is held down.
Repeat (ms)250[0, 10000]Sets the time interval between repeated pulses during holding.
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
Hold (ms)PushButtonVolAlg1holdtimeThe hold time is written to the DSP as the number of samples representing the millisecond time: Samples =
HoldTime(ms)*10^-3 *Fs
Repeat (ms)PushButtonVolAlg1repeattimeThe release time is written to the DSP as the number of samples representing the millisecond time: Samples =
HoldTime(ms)*10^-3 *Fs
Volume Table PointsPushButtonVolAlg1maxindexThe number of points minus 1 is the max index into the table.
Volume Table ValuesPushButtonVolAlg1table_p0
All the points in the table are written to the DSP in their linear gain format.
SW Slew RatePushButtonVolAlg1stepThe value for the slew rate written to the DSP follows the formula:
2^(-SW Slew Rate)

Algorithm Information

The PushButton Volume control allows two GPIO inputs from push buttons 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 “Up” pushbutton is pressed the volume will increase, indexing up through table values. When the “Down” pushbutton is pressed the volume will decrease, indexing down through table values. When the limit index is reached on either end, the volume will just be held.

When a pushbutton is held up or down, the algorithm will scroll through the volume gain points at rates determined by the hold and repeat times. The hold time designates how long the pushbutton must be held until a new repeat pulse is triggered. The repeast pulse determines the interval between incrementing or decrementing through the volume points while the button is held.


The following image shows how two GPIO inputs are used to control the volume algorithm in the PushButton Volume block. The PushButton 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 - Push Button - PushButton Volume
Cores SupportedADAU170x
“Grow Algorithm” Supportedyes - see Algorithm Growth Information
“Add Algorithm” Supportedno
Subroutine/Loop Basedno
Program RAM102*
Program RAM (Invert GPIO)106*
Data RAM31*
Parameter RAM37* - 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 PUshButton 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 push button 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
Program RAM Repetition (Invert GPIO)2 per growth
Data RAM Repetition1 per growth
Parameter RAM Repetitionnone
resources/tools-software/sigmastudio/toolbox/gpioconditioning/pushbuttonvolume.txt · Last modified: 02 Aug 2012 17:21 by William Jahn