Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

control Audio Volume in Linux

by MichaelMeyer (Novice)
on Oct 11, 2013 at 03:10 UTC ( #1057801=perlquestion: print w/replies, xml ) Need Help??

MichaelMeyer has asked for the wisdom of the Perl Monks concerning the following question:

Hi there,

How would one nowadays control the sound volume on a Linux system (using ALSA) from Perl? All that I've found is Audio::Mixer, which seems to be designed for OSS, only....

I would need to mute+unmute at least the Master channel, as well as control it's actual volume value?

Is there a Module for this?

Replies are listed 'Best First'.
Re: control Audio Volume in Linux
by kcott (Bishop) on Oct 11, 2013 at 04:12 UTC
Re: control Audio Volume in Linux
by dasgar (Priest) on Oct 11, 2013 at 04:48 UTC

    A quick Google search found the this link with some information that might help.

Re: control Audio Volume in Linux
by stefbv (Curate) on Oct 11, 2013 at 08:14 UTC

    If you use KDE4, DBus can be used like this:

    #!/bin/env perl use strict; use warnings; use Net::DBus; #use Net::DBus::Dumper; my $bus = Net::DBus->session; my $mixer = eval { $bus->get_service('org.kde.kmix')->get_object('/Mixers/0/Master_0' +); }; if ( $@ ) { die "Error: $@.\n"; } #print dbus_dump($mixer); $mixer->toggleMute; #$mixer->decreaseVolume; #$mixer->increaseVolume;

    I suppose it can be adapted for other desktops also.

    Stefan

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1057801]
Approved by kcott
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (6)
As of 2021-12-05 05:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    R or B?



    Results (31 votes). Check out past polls.

    Notices?