How to control equalizer within command line?Pulseaudio over network - change output on-the-flySwitching output sink/moving audio streams - but some apps still use the old sink!Pulseaudio issues - line out/headphones defaulting; connection to other programs (“not running as session daemon”)PulseAudio Remote Control on AndroidIs there a reliable system-wide equalizer with adjustable frequency bands for *buntu?How to get PulseAudio echo-cancel to work with Ofonopulseaudio-equalizer automatically switching output sink?PulseAudio RTP Multicast - how to synchronize audio on all receivers?Is there a way to set “permissions” on PulseAudio controls?
Is expanding the research of a group into machine learning as a PhD student risky?
Why is delta-v is the most useful quantity for planning space travel?
What's a natural way to say that someone works somewhere (for a job)?
Is there any reason not to eat food that's been dropped on the surface of the moon?
Irreducibility of a simple polynomial
Why does John Bercow say “unlock” after reading out the results of a vote?
Displaying the order of the columns of a table
What will be the benefits of Brexit?
Why "be dealt cards" rather than "be dealing cards"?
Efficiently merge handle parallel feature branches in SFDX
Do I need a multiple entry visa for a trip UK -> Sweden -> UK?
when is out of tune ok?
Trouble understanding overseas colleagues
Implement the Thanos sorting algorithm
How do I rename a LINUX host without needing to reboot for the rename to take effect?
How do I keep an essay about "feeling flat" from feeling flat?
Is there a problem with hiding "forgot password" until it's needed?
There is only s̶i̶x̶t̶y one place he can be
How was Earth single-handedly capable of creating 3 of the 4 gods of chaos?
How does residential electricity work?
Valid Badminton Score?
What would happen if the UK refused to take part in EU Parliamentary elections?
Applicability of Single Responsibility Principle
Is exact Kanji stroke length important?
How to control equalizer within command line?
Pulseaudio over network - change output on-the-flySwitching output sink/moving audio streams - but some apps still use the old sink!Pulseaudio issues - line out/headphones defaulting; connection to other programs (“not running as session daemon”)PulseAudio Remote Control on AndroidIs there a reliable system-wide equalizer with adjustable frequency bands for *buntu?How to get PulseAudio echo-cancel to work with Ofonopulseaudio-equalizer automatically switching output sink?PulseAudio RTP Multicast - how to synchronize audio on all receivers?Is there a way to set “permissions” on PulseAudio controls?
So Pulseaudio has a built-in equilizer loaded with
module-equalizer-sink
According to http://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/Equalizer, you can control it with the qpaeq GUI.
Is there a way to congfigure PA equilizer on a Xless system (running in session mode) ?
pulseaudio
add a comment |
So Pulseaudio has a built-in equilizer loaded with
module-equalizer-sink
According to http://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/Equalizer, you can control it with the qpaeq GUI.
Is there a way to congfigure PA equilizer on a Xless system (running in session mode) ?
pulseaudio
1
Since there's this python script that creates a GUI interface, it should be easy just to strip it down and using DBus directly.
– Braiam
Oct 27 '14 at 17:07
Unfortunately this is way above my knowledge.
– kursus
Oct 27 '14 at 17:50
add a comment |
So Pulseaudio has a built-in equilizer loaded with
module-equalizer-sink
According to http://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/Equalizer, you can control it with the qpaeq GUI.
Is there a way to congfigure PA equilizer on a Xless system (running in session mode) ?
pulseaudio
So Pulseaudio has a built-in equilizer loaded with
module-equalizer-sink
According to http://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/Equalizer, you can control it with the qpaeq GUI.
Is there a way to congfigure PA equilizer on a Xless system (running in session mode) ?
pulseaudio
pulseaudio
edited Oct 27 '14 at 16:49
Braiam
23.7k2077142
23.7k2077142
asked Oct 27 '14 at 16:02
kursuskursus
442516
442516
1
Since there's this python script that creates a GUI interface, it should be easy just to strip it down and using DBus directly.
– Braiam
Oct 27 '14 at 17:07
Unfortunately this is way above my knowledge.
– kursus
Oct 27 '14 at 17:50
add a comment |
1
Since there's this python script that creates a GUI interface, it should be easy just to strip it down and using DBus directly.
– Braiam
Oct 27 '14 at 17:07
Unfortunately this is way above my knowledge.
– kursus
Oct 27 '14 at 17:50
1
1
Since there's this python script that creates a GUI interface, it should be easy just to strip it down and using DBus directly.
– Braiam
Oct 27 '14 at 17:07
Since there's this python script that creates a GUI interface, it should be easy just to strip it down and using DBus directly.
– Braiam
Oct 27 '14 at 17:07
Unfortunately this is way above my knowledge.
– kursus
Oct 27 '14 at 17:50
Unfortunately this is way above my knowledge.
– kursus
Oct 27 '14 at 17:50
add a comment |
4 Answers
4
active
oldest
votes
The pulseaudio equalizer is reading his settings in the user file ~/.config/pulse/equalizerrc
To display it:
cat ~/.config/pulse/equalizerrc
So, as example, to give a value of 10DB on the 5th band of the eq, and directly ear the change:
sed -i '19s/.*/10.0/' ~/.config/pulse/equalizerrc | pulseaudio-equalizer toggle
To explain furthermore, sed will replace all line numbered 19, and will replace it by 10.0 on the config file, then the equalizer is restarted/toggled to get the result.
1
So this file doesn't seem to exist in my version of pulseaudio (9.0), on my machine you instead have a tdb file equalizer-state.tdb, this can be viewed withtdbtool
however the data seems to be in the wonderfully structured form of a 262180 byte array representing a data structure, which looks like it contains both strings and an array of numbers.
– Att Righ
Jan 28 '17 at 19:45
add a comment |
Here's a script called connect-one-eq
, adapteded from qpaeq
that comes with Pulseaudio:
#!/usr/bin/env python
import os,math,sys
import dbus
def connect(): # copied from qpaeq
try:
if 'PULSE_DBUS_SERVER' in os.environ:
address = os.environ['PULSE_DBUS_SERVER']
else:
bus = dbus.SessionBus() # Should be UserBus, but D-Bus doesn't implement that yet.
server_lookup = bus.get_object('org.PulseAudio1', '/org/pulseaudio/server_lookup1')
address = server_lookup.Get('org.PulseAudio.ServerLookup1', 'Address', dbus_interface='org.freedesktop.DBus.Properties')
return dbus.connection.Connection(address)
except Exception as e:
sys.stderr.write('There was an error connecting to pulseaudio, '
'please make sure you have the pulseaudio dbus '
'module loaded, exiting...n')
sys.exit(-1)
def get_sink(str):
connection=connect()
path='/org/pulseaudio/core1/sink%s'%str
sink=connection.get_object(object_path=path)
return sink
args = sys.argv[1:]
sinkname = args.pop(0);
sink = get_sink(sinkname);
sys.stderr.write(str(sink)+'n')
prop_iface='org.freedesktop.DBus.Properties'
eq_iface='org.PulseAudio.Ext.Equalizing1.Equalizer'
sink_props=dbus.Interface(sink,dbus_interface=prop_iface)
def get_eq_attr(attr):
return sink_props.Get(eq_iface,attr)
sample_rate=get_eq_attr('SampleRate')
filter_rate=get_eq_attr('FilterSampleRate')
nchannels=get_eq_attr('NChannels')
sys.stderr.write('channels %d, sample rate: %f, filter sample rate: %fn'%
(nchannels, sample_rate, filter_rate))
def translate_rates(dst,src,rates):
return list([x*dst/src for x in rates])
def translate_freqs(freqs):
translate_rates(filter_rate,sample_rate,
freqs)
channel = int(args.pop(0));
preamp = float(args.pop(0));
freqs = [];
coeffs = [];
while len(args) > 0:
sys.stderr.write('(%s, %s)n'%(args[0],args[1]))
freqs.append(float(args.pop(0)))
coeffs.append(float(args.pop(0)))
# for some reason this fixes the types of the arguments to SeedFilter
sink=dbus.Interface(sink,dbus_interface=eq_iface)
# set the filter coefficients
sink.SeedFilter(channel,freqs,coeffs,preamp)
First you want to load the equalizer module as well as the DBus protocol module:
pactl load-module module-dbus-protocol
pactl load-module module-equalizer-sink sink_name=... sink_master=...
pactl set-default-sink ...
Use pacmd list-sinks
to get the sink number.
Then make some noise, or music or whatever:
play -n synth pinknoise gain -10
Then call the script with the sink number, the channel index you want the equalizer to apply to, a preamp (scaling) factor, and a list of (frequency, coefficient) pairs. The frequency list doesn't have to be dense, since it is interpolated (see seed_filter
in pulseaudio/src/modules/module-equalizer-sink.c
). If you specify the total number of channels as the channel index then the update applies to all channels.
For example, if the sink number is 12 and it has 2 channels, then this resets the equalizer to all 1's, as you can verify by opening qpaeq
:
./connect-one-eq 12 2 1.0 0 1.0 32768 1.0
The frequencies are 0 and 32768 (the maximum), and the coefficients are 1.0 and 1.0, which are interpolated to give a gain 1.0 at all intermediate frequencies.
The following example (in Bash) makes a filter that goes up and down in frequency, a bit like a siren:
SINKNUM=12; NCHAN=2;
while true; do
for i in $(seq 500 10 1500) $(seq 1500 -10 500); do
./connect-one-eq $SINKNUM $NCHAN 1
0 1 $(( $i - 300 )) 1
$i 5 $(( $i + 300 )) 1
32768 1;
done;
done
add a comment |
I believe the command is pacmd
.
EDIT:
If you go to:
/usr/share/pulseaudio/alsa-mixer/profile-sets
You will find a number of configuration files. You may want to try editing default.conf
.
1
related:pactl
.
– HalosGhost
Oct 27 '14 at 17:11
2
Could you be more specific ? These are the commands to control the whole Pulseaudio system. It doesn't seem to have equalizer related options.
– kursus
Oct 27 '14 at 17:49
"Default profile definitions for the ALSA backend of PulseAudio. This is used as fallback for all cards that have no special mapping assigned". This has nothing to do with the question.
– kursus
Oct 30 '14 at 1:47
add a comment |
consider pulseaudio-mixer-cli
from here. it's a python based script providing text based individual stream volume controller:
[++] Jack sink (PulseAudio JACK Sink) M [ ########################## ]
[++] HDMI 0 (hdmi-stereo@snd_hda_intel) M [ ########################## ]
[81] ID 440 Analog (snd_hda_intel) - [ #####################----- ]
[35] mpv - Bax - Perceptions 206 on ETN.fm - [ #########----------------- ]
[38] VLC media player (fraggod@malediction) - [ ##########---------------- ]
[54] Skype (fraggod@malediction:24202) - [ ##############------------ ]
[27] ALSA plug-in [PillarsOfEternity] - [ #######------------------- ]
1
This is a mixer, not an equalizer. It doesn't meant for changing the bass or treble volumes. It is meant only for exchanging between sinks, sink-inputs, sources and sources-inputs.
– Doron Behar
Aug 1 '18 at 13:20
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f164476%2fhow-to-control-equalizer-within-command-line%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
4 Answers
4
active
oldest
votes
4 Answers
4
active
oldest
votes
active
oldest
votes
active
oldest
votes
The pulseaudio equalizer is reading his settings in the user file ~/.config/pulse/equalizerrc
To display it:
cat ~/.config/pulse/equalizerrc
So, as example, to give a value of 10DB on the 5th band of the eq, and directly ear the change:
sed -i '19s/.*/10.0/' ~/.config/pulse/equalizerrc | pulseaudio-equalizer toggle
To explain furthermore, sed will replace all line numbered 19, and will replace it by 10.0 on the config file, then the equalizer is restarted/toggled to get the result.
1
So this file doesn't seem to exist in my version of pulseaudio (9.0), on my machine you instead have a tdb file equalizer-state.tdb, this can be viewed withtdbtool
however the data seems to be in the wonderfully structured form of a 262180 byte array representing a data structure, which looks like it contains both strings and an array of numbers.
– Att Righ
Jan 28 '17 at 19:45
add a comment |
The pulseaudio equalizer is reading his settings in the user file ~/.config/pulse/equalizerrc
To display it:
cat ~/.config/pulse/equalizerrc
So, as example, to give a value of 10DB on the 5th band of the eq, and directly ear the change:
sed -i '19s/.*/10.0/' ~/.config/pulse/equalizerrc | pulseaudio-equalizer toggle
To explain furthermore, sed will replace all line numbered 19, and will replace it by 10.0 on the config file, then the equalizer is restarted/toggled to get the result.
1
So this file doesn't seem to exist in my version of pulseaudio (9.0), on my machine you instead have a tdb file equalizer-state.tdb, this can be viewed withtdbtool
however the data seems to be in the wonderfully structured form of a 262180 byte array representing a data structure, which looks like it contains both strings and an array of numbers.
– Att Righ
Jan 28 '17 at 19:45
add a comment |
The pulseaudio equalizer is reading his settings in the user file ~/.config/pulse/equalizerrc
To display it:
cat ~/.config/pulse/equalizerrc
So, as example, to give a value of 10DB on the 5th band of the eq, and directly ear the change:
sed -i '19s/.*/10.0/' ~/.config/pulse/equalizerrc | pulseaudio-equalizer toggle
To explain furthermore, sed will replace all line numbered 19, and will replace it by 10.0 on the config file, then the equalizer is restarted/toggled to get the result.
The pulseaudio equalizer is reading his settings in the user file ~/.config/pulse/equalizerrc
To display it:
cat ~/.config/pulse/equalizerrc
So, as example, to give a value of 10DB on the 5th band of the eq, and directly ear the change:
sed -i '19s/.*/10.0/' ~/.config/pulse/equalizerrc | pulseaudio-equalizer toggle
To explain furthermore, sed will replace all line numbered 19, and will replace it by 10.0 on the config file, then the equalizer is restarted/toggled to get the result.
edited Sep 9 '17 at 11:25
answered Jan 19 '17 at 20:47
CryptopatCryptopat
17517
17517
1
So this file doesn't seem to exist in my version of pulseaudio (9.0), on my machine you instead have a tdb file equalizer-state.tdb, this can be viewed withtdbtool
however the data seems to be in the wonderfully structured form of a 262180 byte array representing a data structure, which looks like it contains both strings and an array of numbers.
– Att Righ
Jan 28 '17 at 19:45
add a comment |
1
So this file doesn't seem to exist in my version of pulseaudio (9.0), on my machine you instead have a tdb file equalizer-state.tdb, this can be viewed withtdbtool
however the data seems to be in the wonderfully structured form of a 262180 byte array representing a data structure, which looks like it contains both strings and an array of numbers.
– Att Righ
Jan 28 '17 at 19:45
1
1
So this file doesn't seem to exist in my version of pulseaudio (9.0), on my machine you instead have a tdb file equalizer-state.tdb, this can be viewed with
tdbtool
however the data seems to be in the wonderfully structured form of a 262180 byte array representing a data structure, which looks like it contains both strings and an array of numbers.– Att Righ
Jan 28 '17 at 19:45
So this file doesn't seem to exist in my version of pulseaudio (9.0), on my machine you instead have a tdb file equalizer-state.tdb, this can be viewed with
tdbtool
however the data seems to be in the wonderfully structured form of a 262180 byte array representing a data structure, which looks like it contains both strings and an array of numbers.– Att Righ
Jan 28 '17 at 19:45
add a comment |
Here's a script called connect-one-eq
, adapteded from qpaeq
that comes with Pulseaudio:
#!/usr/bin/env python
import os,math,sys
import dbus
def connect(): # copied from qpaeq
try:
if 'PULSE_DBUS_SERVER' in os.environ:
address = os.environ['PULSE_DBUS_SERVER']
else:
bus = dbus.SessionBus() # Should be UserBus, but D-Bus doesn't implement that yet.
server_lookup = bus.get_object('org.PulseAudio1', '/org/pulseaudio/server_lookup1')
address = server_lookup.Get('org.PulseAudio.ServerLookup1', 'Address', dbus_interface='org.freedesktop.DBus.Properties')
return dbus.connection.Connection(address)
except Exception as e:
sys.stderr.write('There was an error connecting to pulseaudio, '
'please make sure you have the pulseaudio dbus '
'module loaded, exiting...n')
sys.exit(-1)
def get_sink(str):
connection=connect()
path='/org/pulseaudio/core1/sink%s'%str
sink=connection.get_object(object_path=path)
return sink
args = sys.argv[1:]
sinkname = args.pop(0);
sink = get_sink(sinkname);
sys.stderr.write(str(sink)+'n')
prop_iface='org.freedesktop.DBus.Properties'
eq_iface='org.PulseAudio.Ext.Equalizing1.Equalizer'
sink_props=dbus.Interface(sink,dbus_interface=prop_iface)
def get_eq_attr(attr):
return sink_props.Get(eq_iface,attr)
sample_rate=get_eq_attr('SampleRate')
filter_rate=get_eq_attr('FilterSampleRate')
nchannels=get_eq_attr('NChannels')
sys.stderr.write('channels %d, sample rate: %f, filter sample rate: %fn'%
(nchannels, sample_rate, filter_rate))
def translate_rates(dst,src,rates):
return list([x*dst/src for x in rates])
def translate_freqs(freqs):
translate_rates(filter_rate,sample_rate,
freqs)
channel = int(args.pop(0));
preamp = float(args.pop(0));
freqs = [];
coeffs = [];
while len(args) > 0:
sys.stderr.write('(%s, %s)n'%(args[0],args[1]))
freqs.append(float(args.pop(0)))
coeffs.append(float(args.pop(0)))
# for some reason this fixes the types of the arguments to SeedFilter
sink=dbus.Interface(sink,dbus_interface=eq_iface)
# set the filter coefficients
sink.SeedFilter(channel,freqs,coeffs,preamp)
First you want to load the equalizer module as well as the DBus protocol module:
pactl load-module module-dbus-protocol
pactl load-module module-equalizer-sink sink_name=... sink_master=...
pactl set-default-sink ...
Use pacmd list-sinks
to get the sink number.
Then make some noise, or music or whatever:
play -n synth pinknoise gain -10
Then call the script with the sink number, the channel index you want the equalizer to apply to, a preamp (scaling) factor, and a list of (frequency, coefficient) pairs. The frequency list doesn't have to be dense, since it is interpolated (see seed_filter
in pulseaudio/src/modules/module-equalizer-sink.c
). If you specify the total number of channels as the channel index then the update applies to all channels.
For example, if the sink number is 12 and it has 2 channels, then this resets the equalizer to all 1's, as you can verify by opening qpaeq
:
./connect-one-eq 12 2 1.0 0 1.0 32768 1.0
The frequencies are 0 and 32768 (the maximum), and the coefficients are 1.0 and 1.0, which are interpolated to give a gain 1.0 at all intermediate frequencies.
The following example (in Bash) makes a filter that goes up and down in frequency, a bit like a siren:
SINKNUM=12; NCHAN=2;
while true; do
for i in $(seq 500 10 1500) $(seq 1500 -10 500); do
./connect-one-eq $SINKNUM $NCHAN 1
0 1 $(( $i - 300 )) 1
$i 5 $(( $i + 300 )) 1
32768 1;
done;
done
add a comment |
Here's a script called connect-one-eq
, adapteded from qpaeq
that comes with Pulseaudio:
#!/usr/bin/env python
import os,math,sys
import dbus
def connect(): # copied from qpaeq
try:
if 'PULSE_DBUS_SERVER' in os.environ:
address = os.environ['PULSE_DBUS_SERVER']
else:
bus = dbus.SessionBus() # Should be UserBus, but D-Bus doesn't implement that yet.
server_lookup = bus.get_object('org.PulseAudio1', '/org/pulseaudio/server_lookup1')
address = server_lookup.Get('org.PulseAudio.ServerLookup1', 'Address', dbus_interface='org.freedesktop.DBus.Properties')
return dbus.connection.Connection(address)
except Exception as e:
sys.stderr.write('There was an error connecting to pulseaudio, '
'please make sure you have the pulseaudio dbus '
'module loaded, exiting...n')
sys.exit(-1)
def get_sink(str):
connection=connect()
path='/org/pulseaudio/core1/sink%s'%str
sink=connection.get_object(object_path=path)
return sink
args = sys.argv[1:]
sinkname = args.pop(0);
sink = get_sink(sinkname);
sys.stderr.write(str(sink)+'n')
prop_iface='org.freedesktop.DBus.Properties'
eq_iface='org.PulseAudio.Ext.Equalizing1.Equalizer'
sink_props=dbus.Interface(sink,dbus_interface=prop_iface)
def get_eq_attr(attr):
return sink_props.Get(eq_iface,attr)
sample_rate=get_eq_attr('SampleRate')
filter_rate=get_eq_attr('FilterSampleRate')
nchannels=get_eq_attr('NChannels')
sys.stderr.write('channels %d, sample rate: %f, filter sample rate: %fn'%
(nchannels, sample_rate, filter_rate))
def translate_rates(dst,src,rates):
return list([x*dst/src for x in rates])
def translate_freqs(freqs):
translate_rates(filter_rate,sample_rate,
freqs)
channel = int(args.pop(0));
preamp = float(args.pop(0));
freqs = [];
coeffs = [];
while len(args) > 0:
sys.stderr.write('(%s, %s)n'%(args[0],args[1]))
freqs.append(float(args.pop(0)))
coeffs.append(float(args.pop(0)))
# for some reason this fixes the types of the arguments to SeedFilter
sink=dbus.Interface(sink,dbus_interface=eq_iface)
# set the filter coefficients
sink.SeedFilter(channel,freqs,coeffs,preamp)
First you want to load the equalizer module as well as the DBus protocol module:
pactl load-module module-dbus-protocol
pactl load-module module-equalizer-sink sink_name=... sink_master=...
pactl set-default-sink ...
Use pacmd list-sinks
to get the sink number.
Then make some noise, or music or whatever:
play -n synth pinknoise gain -10
Then call the script with the sink number, the channel index you want the equalizer to apply to, a preamp (scaling) factor, and a list of (frequency, coefficient) pairs. The frequency list doesn't have to be dense, since it is interpolated (see seed_filter
in pulseaudio/src/modules/module-equalizer-sink.c
). If you specify the total number of channels as the channel index then the update applies to all channels.
For example, if the sink number is 12 and it has 2 channels, then this resets the equalizer to all 1's, as you can verify by opening qpaeq
:
./connect-one-eq 12 2 1.0 0 1.0 32768 1.0
The frequencies are 0 and 32768 (the maximum), and the coefficients are 1.0 and 1.0, which are interpolated to give a gain 1.0 at all intermediate frequencies.
The following example (in Bash) makes a filter that goes up and down in frequency, a bit like a siren:
SINKNUM=12; NCHAN=2;
while true; do
for i in $(seq 500 10 1500) $(seq 1500 -10 500); do
./connect-one-eq $SINKNUM $NCHAN 1
0 1 $(( $i - 300 )) 1
$i 5 $(( $i + 300 )) 1
32768 1;
done;
done
add a comment |
Here's a script called connect-one-eq
, adapteded from qpaeq
that comes with Pulseaudio:
#!/usr/bin/env python
import os,math,sys
import dbus
def connect(): # copied from qpaeq
try:
if 'PULSE_DBUS_SERVER' in os.environ:
address = os.environ['PULSE_DBUS_SERVER']
else:
bus = dbus.SessionBus() # Should be UserBus, but D-Bus doesn't implement that yet.
server_lookup = bus.get_object('org.PulseAudio1', '/org/pulseaudio/server_lookup1')
address = server_lookup.Get('org.PulseAudio.ServerLookup1', 'Address', dbus_interface='org.freedesktop.DBus.Properties')
return dbus.connection.Connection(address)
except Exception as e:
sys.stderr.write('There was an error connecting to pulseaudio, '
'please make sure you have the pulseaudio dbus '
'module loaded, exiting...n')
sys.exit(-1)
def get_sink(str):
connection=connect()
path='/org/pulseaudio/core1/sink%s'%str
sink=connection.get_object(object_path=path)
return sink
args = sys.argv[1:]
sinkname = args.pop(0);
sink = get_sink(sinkname);
sys.stderr.write(str(sink)+'n')
prop_iface='org.freedesktop.DBus.Properties'
eq_iface='org.PulseAudio.Ext.Equalizing1.Equalizer'
sink_props=dbus.Interface(sink,dbus_interface=prop_iface)
def get_eq_attr(attr):
return sink_props.Get(eq_iface,attr)
sample_rate=get_eq_attr('SampleRate')
filter_rate=get_eq_attr('FilterSampleRate')
nchannels=get_eq_attr('NChannels')
sys.stderr.write('channels %d, sample rate: %f, filter sample rate: %fn'%
(nchannels, sample_rate, filter_rate))
def translate_rates(dst,src,rates):
return list([x*dst/src for x in rates])
def translate_freqs(freqs):
translate_rates(filter_rate,sample_rate,
freqs)
channel = int(args.pop(0));
preamp = float(args.pop(0));
freqs = [];
coeffs = [];
while len(args) > 0:
sys.stderr.write('(%s, %s)n'%(args[0],args[1]))
freqs.append(float(args.pop(0)))
coeffs.append(float(args.pop(0)))
# for some reason this fixes the types of the arguments to SeedFilter
sink=dbus.Interface(sink,dbus_interface=eq_iface)
# set the filter coefficients
sink.SeedFilter(channel,freqs,coeffs,preamp)
First you want to load the equalizer module as well as the DBus protocol module:
pactl load-module module-dbus-protocol
pactl load-module module-equalizer-sink sink_name=... sink_master=...
pactl set-default-sink ...
Use pacmd list-sinks
to get the sink number.
Then make some noise, or music or whatever:
play -n synth pinknoise gain -10
Then call the script with the sink number, the channel index you want the equalizer to apply to, a preamp (scaling) factor, and a list of (frequency, coefficient) pairs. The frequency list doesn't have to be dense, since it is interpolated (see seed_filter
in pulseaudio/src/modules/module-equalizer-sink.c
). If you specify the total number of channels as the channel index then the update applies to all channels.
For example, if the sink number is 12 and it has 2 channels, then this resets the equalizer to all 1's, as you can verify by opening qpaeq
:
./connect-one-eq 12 2 1.0 0 1.0 32768 1.0
The frequencies are 0 and 32768 (the maximum), and the coefficients are 1.0 and 1.0, which are interpolated to give a gain 1.0 at all intermediate frequencies.
The following example (in Bash) makes a filter that goes up and down in frequency, a bit like a siren:
SINKNUM=12; NCHAN=2;
while true; do
for i in $(seq 500 10 1500) $(seq 1500 -10 500); do
./connect-one-eq $SINKNUM $NCHAN 1
0 1 $(( $i - 300 )) 1
$i 5 $(( $i + 300 )) 1
32768 1;
done;
done
Here's a script called connect-one-eq
, adapteded from qpaeq
that comes with Pulseaudio:
#!/usr/bin/env python
import os,math,sys
import dbus
def connect(): # copied from qpaeq
try:
if 'PULSE_DBUS_SERVER' in os.environ:
address = os.environ['PULSE_DBUS_SERVER']
else:
bus = dbus.SessionBus() # Should be UserBus, but D-Bus doesn't implement that yet.
server_lookup = bus.get_object('org.PulseAudio1', '/org/pulseaudio/server_lookup1')
address = server_lookup.Get('org.PulseAudio.ServerLookup1', 'Address', dbus_interface='org.freedesktop.DBus.Properties')
return dbus.connection.Connection(address)
except Exception as e:
sys.stderr.write('There was an error connecting to pulseaudio, '
'please make sure you have the pulseaudio dbus '
'module loaded, exiting...n')
sys.exit(-1)
def get_sink(str):
connection=connect()
path='/org/pulseaudio/core1/sink%s'%str
sink=connection.get_object(object_path=path)
return sink
args = sys.argv[1:]
sinkname = args.pop(0);
sink = get_sink(sinkname);
sys.stderr.write(str(sink)+'n')
prop_iface='org.freedesktop.DBus.Properties'
eq_iface='org.PulseAudio.Ext.Equalizing1.Equalizer'
sink_props=dbus.Interface(sink,dbus_interface=prop_iface)
def get_eq_attr(attr):
return sink_props.Get(eq_iface,attr)
sample_rate=get_eq_attr('SampleRate')
filter_rate=get_eq_attr('FilterSampleRate')
nchannels=get_eq_attr('NChannels')
sys.stderr.write('channels %d, sample rate: %f, filter sample rate: %fn'%
(nchannels, sample_rate, filter_rate))
def translate_rates(dst,src,rates):
return list([x*dst/src for x in rates])
def translate_freqs(freqs):
translate_rates(filter_rate,sample_rate,
freqs)
channel = int(args.pop(0));
preamp = float(args.pop(0));
freqs = [];
coeffs = [];
while len(args) > 0:
sys.stderr.write('(%s, %s)n'%(args[0],args[1]))
freqs.append(float(args.pop(0)))
coeffs.append(float(args.pop(0)))
# for some reason this fixes the types of the arguments to SeedFilter
sink=dbus.Interface(sink,dbus_interface=eq_iface)
# set the filter coefficients
sink.SeedFilter(channel,freqs,coeffs,preamp)
First you want to load the equalizer module as well as the DBus protocol module:
pactl load-module module-dbus-protocol
pactl load-module module-equalizer-sink sink_name=... sink_master=...
pactl set-default-sink ...
Use pacmd list-sinks
to get the sink number.
Then make some noise, or music or whatever:
play -n synth pinknoise gain -10
Then call the script with the sink number, the channel index you want the equalizer to apply to, a preamp (scaling) factor, and a list of (frequency, coefficient) pairs. The frequency list doesn't have to be dense, since it is interpolated (see seed_filter
in pulseaudio/src/modules/module-equalizer-sink.c
). If you specify the total number of channels as the channel index then the update applies to all channels.
For example, if the sink number is 12 and it has 2 channels, then this resets the equalizer to all 1's, as you can verify by opening qpaeq
:
./connect-one-eq 12 2 1.0 0 1.0 32768 1.0
The frequencies are 0 and 32768 (the maximum), and the coefficients are 1.0 and 1.0, which are interpolated to give a gain 1.0 at all intermediate frequencies.
The following example (in Bash) makes a filter that goes up and down in frequency, a bit like a siren:
SINKNUM=12; NCHAN=2;
while true; do
for i in $(seq 500 10 1500) $(seq 1500 -10 500); do
./connect-one-eq $SINKNUM $NCHAN 1
0 1 $(( $i - 300 )) 1
$i 5 $(( $i + 300 )) 1
32768 1;
done;
done
answered yesterday
MetamorphicMetamorphic
370113
370113
add a comment |
add a comment |
I believe the command is pacmd
.
EDIT:
If you go to:
/usr/share/pulseaudio/alsa-mixer/profile-sets
You will find a number of configuration files. You may want to try editing default.conf
.
1
related:pactl
.
– HalosGhost
Oct 27 '14 at 17:11
2
Could you be more specific ? These are the commands to control the whole Pulseaudio system. It doesn't seem to have equalizer related options.
– kursus
Oct 27 '14 at 17:49
"Default profile definitions for the ALSA backend of PulseAudio. This is used as fallback for all cards that have no special mapping assigned". This has nothing to do with the question.
– kursus
Oct 30 '14 at 1:47
add a comment |
I believe the command is pacmd
.
EDIT:
If you go to:
/usr/share/pulseaudio/alsa-mixer/profile-sets
You will find a number of configuration files. You may want to try editing default.conf
.
1
related:pactl
.
– HalosGhost
Oct 27 '14 at 17:11
2
Could you be more specific ? These are the commands to control the whole Pulseaudio system. It doesn't seem to have equalizer related options.
– kursus
Oct 27 '14 at 17:49
"Default profile definitions for the ALSA backend of PulseAudio. This is used as fallback for all cards that have no special mapping assigned". This has nothing to do with the question.
– kursus
Oct 30 '14 at 1:47
add a comment |
I believe the command is pacmd
.
EDIT:
If you go to:
/usr/share/pulseaudio/alsa-mixer/profile-sets
You will find a number of configuration files. You may want to try editing default.conf
.
I believe the command is pacmd
.
EDIT:
If you go to:
/usr/share/pulseaudio/alsa-mixer/profile-sets
You will find a number of configuration files. You may want to try editing default.conf
.
edited Oct 27 '14 at 20:28
answered Oct 27 '14 at 17:05
damianestebandamianesteban
1223
1223
1
related:pactl
.
– HalosGhost
Oct 27 '14 at 17:11
2
Could you be more specific ? These are the commands to control the whole Pulseaudio system. It doesn't seem to have equalizer related options.
– kursus
Oct 27 '14 at 17:49
"Default profile definitions for the ALSA backend of PulseAudio. This is used as fallback for all cards that have no special mapping assigned". This has nothing to do with the question.
– kursus
Oct 30 '14 at 1:47
add a comment |
1
related:pactl
.
– HalosGhost
Oct 27 '14 at 17:11
2
Could you be more specific ? These are the commands to control the whole Pulseaudio system. It doesn't seem to have equalizer related options.
– kursus
Oct 27 '14 at 17:49
"Default profile definitions for the ALSA backend of PulseAudio. This is used as fallback for all cards that have no special mapping assigned". This has nothing to do with the question.
– kursus
Oct 30 '14 at 1:47
1
1
related:
pactl
.– HalosGhost
Oct 27 '14 at 17:11
related:
pactl
.– HalosGhost
Oct 27 '14 at 17:11
2
2
Could you be more specific ? These are the commands to control the whole Pulseaudio system. It doesn't seem to have equalizer related options.
– kursus
Oct 27 '14 at 17:49
Could you be more specific ? These are the commands to control the whole Pulseaudio system. It doesn't seem to have equalizer related options.
– kursus
Oct 27 '14 at 17:49
"Default profile definitions for the ALSA backend of PulseAudio. This is used as fallback for all cards that have no special mapping assigned". This has nothing to do with the question.
– kursus
Oct 30 '14 at 1:47
"Default profile definitions for the ALSA backend of PulseAudio. This is used as fallback for all cards that have no special mapping assigned". This has nothing to do with the question.
– kursus
Oct 30 '14 at 1:47
add a comment |
consider pulseaudio-mixer-cli
from here. it's a python based script providing text based individual stream volume controller:
[++] Jack sink (PulseAudio JACK Sink) M [ ########################## ]
[++] HDMI 0 (hdmi-stereo@snd_hda_intel) M [ ########################## ]
[81] ID 440 Analog (snd_hda_intel) - [ #####################----- ]
[35] mpv - Bax - Perceptions 206 on ETN.fm - [ #########----------------- ]
[38] VLC media player (fraggod@malediction) - [ ##########---------------- ]
[54] Skype (fraggod@malediction:24202) - [ ##############------------ ]
[27] ALSA plug-in [PillarsOfEternity] - [ #######------------------- ]
1
This is a mixer, not an equalizer. It doesn't meant for changing the bass or treble volumes. It is meant only for exchanging between sinks, sink-inputs, sources and sources-inputs.
– Doron Behar
Aug 1 '18 at 13:20
add a comment |
consider pulseaudio-mixer-cli
from here. it's a python based script providing text based individual stream volume controller:
[++] Jack sink (PulseAudio JACK Sink) M [ ########################## ]
[++] HDMI 0 (hdmi-stereo@snd_hda_intel) M [ ########################## ]
[81] ID 440 Analog (snd_hda_intel) - [ #####################----- ]
[35] mpv - Bax - Perceptions 206 on ETN.fm - [ #########----------------- ]
[38] VLC media player (fraggod@malediction) - [ ##########---------------- ]
[54] Skype (fraggod@malediction:24202) - [ ##############------------ ]
[27] ALSA plug-in [PillarsOfEternity] - [ #######------------------- ]
1
This is a mixer, not an equalizer. It doesn't meant for changing the bass or treble volumes. It is meant only for exchanging between sinks, sink-inputs, sources and sources-inputs.
– Doron Behar
Aug 1 '18 at 13:20
add a comment |
consider pulseaudio-mixer-cli
from here. it's a python based script providing text based individual stream volume controller:
[++] Jack sink (PulseAudio JACK Sink) M [ ########################## ]
[++] HDMI 0 (hdmi-stereo@snd_hda_intel) M [ ########################## ]
[81] ID 440 Analog (snd_hda_intel) - [ #####################----- ]
[35] mpv - Bax - Perceptions 206 on ETN.fm - [ #########----------------- ]
[38] VLC media player (fraggod@malediction) - [ ##########---------------- ]
[54] Skype (fraggod@malediction:24202) - [ ##############------------ ]
[27] ALSA plug-in [PillarsOfEternity] - [ #######------------------- ]
consider pulseaudio-mixer-cli
from here. it's a python based script providing text based individual stream volume controller:
[++] Jack sink (PulseAudio JACK Sink) M [ ########################## ]
[++] HDMI 0 (hdmi-stereo@snd_hda_intel) M [ ########################## ]
[81] ID 440 Analog (snd_hda_intel) - [ #####################----- ]
[35] mpv - Bax - Perceptions 206 on ETN.fm - [ #########----------------- ]
[38] VLC media player (fraggod@malediction) - [ ##########---------------- ]
[54] Skype (fraggod@malediction:24202) - [ ##############------------ ]
[27] ALSA plug-in [PillarsOfEternity] - [ #######------------------- ]
answered Mar 20 '18 at 16:28
Oleg KokorinOleg Kokorin
26526
26526
1
This is a mixer, not an equalizer. It doesn't meant for changing the bass or treble volumes. It is meant only for exchanging between sinks, sink-inputs, sources and sources-inputs.
– Doron Behar
Aug 1 '18 at 13:20
add a comment |
1
This is a mixer, not an equalizer. It doesn't meant for changing the bass or treble volumes. It is meant only for exchanging between sinks, sink-inputs, sources and sources-inputs.
– Doron Behar
Aug 1 '18 at 13:20
1
1
This is a mixer, not an equalizer. It doesn't meant for changing the bass or treble volumes. It is meant only for exchanging between sinks, sink-inputs, sources and sources-inputs.
– Doron Behar
Aug 1 '18 at 13:20
This is a mixer, not an equalizer. It doesn't meant for changing the bass or treble volumes. It is meant only for exchanging between sinks, sink-inputs, sources and sources-inputs.
– Doron Behar
Aug 1 '18 at 13:20
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f164476%2fhow-to-control-equalizer-within-command-line%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
-pulseaudio
1
Since there's this python script that creates a GUI interface, it should be easy just to strip it down and using DBus directly.
– Braiam
Oct 27 '14 at 17:07
Unfortunately this is way above my knowledge.
– kursus
Oct 27 '14 at 17:50