midi to control volume, change title in amarok

What other apps and distros do you use to round out your studio?

Moderators: MattKingUSA, khz

User avatar
spm_gl
Established Member
Posts: 358
Joined: Wed Apr 22, 2009 7:58 am
Location: Spreewald, Germany
Contact:

Re: midi to control volume, change title in amarok

Post by spm_gl »

raboof wrote: Why would you want to control jack?
Simple, my controller has a wonderful shuttle wheel, which doensn't work in ardour, but now I can smoothly scroll the timeline of all jack-transport enabled programs (especially xjadeo) together, which is perfect for video sync work.
--- Spreemusik ---
Jan Fuchsmann, Audio Engineer
Check our blog at http://www.spreemusik.com/blog
User avatar
raboof
Established Member
Posts: 1865
Joined: Tue Apr 08, 2008 11:58 am
Location: Deventer, NL
Has thanked: 52 times
Been thanked: 80 times
Contact:

Re: midi to control volume, change title in amarok

Post by raboof »

spm_gl wrote:
raboof wrote:Why would you want to control jack?
Simple, my controller has a wonderful shuttle wheel, which doensn't work in ardour, but now I can smoothly scroll the timeline of all jack-transport enabled programs (especially xjadeo) together, which is perfect for video sync work.
Oh yes, jack transport is definitely useful ;) - for a moment i thought you wanted to use it for controlling amarok.
User avatar
raboof
Established Member
Posts: 1865
Joined: Tue Apr 08, 2008 11:58 am
Location: Deventer, NL
Has thanked: 52 times
Been thanked: 80 times
Contact:

Re: midi to control volume, change title in amarok

Post by raboof »

raboof wrote:I found 'aseqdump' for dumping ALSA midi data to stdout. With that, it's quite easy to whip together a small script that translates midi events into qdbus calls
Hmm, I found out that on some systems, this would introduce some unwanted buffering. The following version solves this, and requires aseqdump and IO::Pty (packaged as libio-pty-perl on debian):

Code: Select all

#!/usr/bin/perl

use strict;

use IO::Pty;
use IPC::Open2;

my $pty = IO::Pty->new;
open2(">&" . fileno($pty), my $in, "aseqdump");
my $s = $pty->slave;

while (<$s>)
{
        print $_;
        if ($_ =~ /controller 7, value (\d+)/)
        {
                my $ccValue = $1;
                my $volume = int($ccValue * 100 / 127);
                print "Setting volume to $volume\n";
                `qdbus org.kde.amarok /Player VolumeSet $volume`
        }
}


.. then start it with:

Code: Select all

./scriptfilename.pl
Post Reply