1.\" 2.\" Copyright (c) 2019 Google LLC, written by Richard Kralovic <riso@google.com> 3.\" 4.\" All rights reserved. 5.\" 6.\" Redistribution and use in source and binary forms, with or without 7.\" modification, are permitted provided that the following conditions 8.\" are met: 9.\" 1. Redistributions of source code must retain the above copyright 10.\" notice, this list of conditions and the following disclaimer. 11.\" 2. Redistributions in binary form must reproduce the above copyright 12.\" notice, this list of conditions and the following disclaimer in the 13.\" documentation and/or other materials provided with the distribution. 14.\" 15.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 16.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 19.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25.\" SUCH DAMAGE. 26.\" 27.\" 28.Dd February 12, 2025 29.Dt VIRTUAL_EQUALIZER 8 30.Os 31.Sh NAME 32.Nm virtual_equalizer 33.Nd audio equalizer 34.Sh SYNOPSIS 35.Nm 36.Op Fl h 37.Op Fl o 38.Op Fl q 39.Op Fl d Ar devname 40.Op Fl w Ar what 41.Op Fl p Ar part 42.Op Fl c Ar channels 43.Op Fl f Ar file 44.Sh DESCRIPTION 45.Nm 46sets the given frequency response for the given 47.Xr virtual_oss 8 48instance via the control character device given by the -d option. 49The design goal of this equalizer is to provide precise equalization 50for arbitrary requested frequency response at the expense of higher 51latency, utilizing a so-called finite impulse response, FIR, filter. 52.Pp 53The requested frequency response is configured via standard input or 54the file specified by the -f option. 55There is one control point in per line. 56Each line consists of two numbers, frequency in Hz and requested 57amplification. 58Amplification between two consecutive control points is a linear 59interpolation of the given control point values. 60.Pp 61To make the filter finite, it is windowed in time domain using a Hann 62window. 63The windowing actually modifies the frequency response - the actual 64response is a convolution of the requested response and spectrum of 65the window. 66This is, however, very close to the requested response. 67.Pp 68The following options are available: 69.Bl -tag -width indent 70.It Fl q 71Be quiet and don't print anything to standard output. 72.It Fl d Ar device 73The 74.Xr virtual_oss 8 75control character device. 76.It Fl w Ar what 77Select what part the FIR filter should apply to. 78Valid values are: rx_dev, tx_dev, rx_loop and tx_loop. 79The default value is tx_dev. 80.It Fl p Ar part 81Select the index of the part given by the -w option to apply the filter to. 82Default is zero. 83.It Fl c Ar channels 84Select number of channels to apply filter to, starting at channel zero. 85By default all channels of the given part are updated. 86.It Fl f Ar file 87Read filter coefficients from the given file instead of standard input. 88.It Fl o 89Turn equalizer off. 90.It Fl h 91Show usage. 92.El 93.Sh EXAMPLES 94To pass only frequencies between 200Hz and 400Hz: 95.Bd -literal -offset indent 96# Note that the -F and -G options enable FIR filtering. 97virtual_oss -B -C 2 -c 2 -S -Q 0 -b 32 -r 48000 -s 8ms -F 80ms -G 80ms \\ 98 -f /dev/dsp -d dsp.virtual -t vdsp.ctl 99 100# For simplex operation use this: 101virtual_oss -B -C 2 -c 2 -S -Q 0 -b 32 -r 48000 -s 8ms -F 80ms -G 80ms \\ 102 -R /dev/null -O /dev/dsp -d dsp.virtual -t vdsp.ctl 103 104# Load normalized filter points to avoid sample value overflow 105cat << EOF | virtual_equalizer -d /dev/vdsp.ctl -w tx_dev -p 0 -c 2 106NORMALIZE 107199 0.0 108200 1.0 109400 1.0 110401 0.0 111EOF 112 113# Load FIR filter based on sine frequency points 114cat << EOF | virtual_equalizer -d /dev/vdsp.ctl -w tx_dev -p 0 -c 2 115199 0.0 116200 1.0 117400 1.0 118401 0.0 119EOF 120 121.Ed 122.Sh SEE ALSO 123.Xr virtual_oss 8 124.Sh AUTHORS 125.Nm 126was written by 127.An Richard Kralovic riso@google.com . 128