Script to help parsing gdigi/x-edit SysEx messages

60 views
Skip to first unread message

Mauro Carvalho Chehab

unread,
Dec 2, 2012, 8:33:38 AM12/2/12
to gdigi ML
Hi,

I did a small perl script that helps to see what messages gdigi (or x-edit) are
sending to the pedal.

In order to use it, you need to download the following script, that captures USB
traffic from a usbmon interface:

http://git.linuxtv.org/v4l-utils.git/blob_plain/HEAD:/contrib/parse_tcpdump_log.pl

And use it like:

# ./parse_tcpdump_log.pl --device usbmon2 | ./parse_midi.pl

(assuming that the pedal is connected to USB port 2)

Regards,
Mauro

-

#!/usr/bin/perl

my $show_raw = 0;

#00 00 00 00 00 00 00 00 >>> 04 f0 00 00 04 10 00 5e 04 08 3b 00

my @pack_bytes = ();

my %cmd = (
0x01 => "REQUEST_WHO_AM_I",
0x02 => "RECEIVE_WHO_AM_I",
0x08 => "REQUEST_DEVICE_CONFIGURATION",
0x09 => "RECEIVE_DEVICE_CONFIGURATION",
0x10 => "REQUEST_GLOBAL_PARAMETERS",
0x11 => "RECEIVE_GLOBAL_PARAMETERS",
0x18 => "REQUEST_BULK_DUMP",
0x19 => "RECEIVE_BULK_DUMP_START",
0x1B => "RECEIVE_BULK_DUMP_END",
0x21 => "REQUEST_PRESET_NAMES",
0x22 => "RECEIVE_PRESET_NAMES",
0x28 => "REQUEST_PRESET_NAME",
0x29 => "RECEIVE_PRESET_NAME",
0x2A => "REQUEST_PRESET",
0x2B => "RECEIVE_PRESET_START",
0x2C => "RECEIVE_PRESET_END",
0x2D => "RECEIVE_PRESET_PARAMETERS",
0x38 => "LOAD_EDIT_BUFFER_PRESET",
0x39 => "MOVE_PRESET",
0x3A => "REQUEST_MODIFIER_LINKABLE_LIST",
0x3B => "RECEIVE_MODIFIER_LINKABLE_LIST",
0x40 => "REQUEST_PARAMETER_VALUE",
0x41 => "RECEIVE_PARAMETER_VALUE",
0x50 => "REQUEST_OBJECT_NAMES",
0x51 => "RECEIVE_OBJECT_NAMES",
0x52 => "REQUEST_OBJECT_NAME",
0x53 => "RECEIVE_OBJECT_NAME",
0x54 => "REQUEST_OBJECT",
0x55 => "RECEIVE_OBJECT",
0x56 => "MOVE_OBJECT",
0x57 => "DELETE_OBJECT",
0x5A => "REQUEST_TABLE",
0x5B => "RECEIVE_TABLE",
0x70 => "RECEIVE_DEVICE_NOTIFICATION",
0x7E => "ACK",
0x7F => "NACK",
);

my %effects = (
0x004002 => "EQ Type",
0x004102 => "Pickup Enable",
0x008003 => "Wah Type",
0x008103 => "Wah Enable",
0x008403 => "Wah Position",
0x008503 => "Wah Vol. Boost",
0x00c104 => "Compressor Enable",
0x00cf04 => "Comp Type",
0x00d004 => "Compressor Sustain",
0x00d104 => "Compressor Tone",
0x00d204 => "Compressor Level",
0x00d304 => "Compressor Attack",
0x00d404 => "Compressor Output",
0x00d504 => "Compressor Sensitivity",
0x010007 => "Amp Channel",
0x010908 => "Amp A Enable",
0x01090a => "Amp B Enable",
0x02c00c => "Gate Type",
0x02c10c => "Gate Enable",
0x02c60c => "Gate Threshold",
0x02c70c => "Gate Pluck Sens",
0x02c80c => "Gate Attack",
0x02c90c => "Gate Release",
0x02ca0c => "Gate Attenuation",
0x03000e => "Mod Type",
0x03010e => "Chorus/FX Enable",
0x03020e => "Mod Pre/Post",
0x03020e => "Mod Pre/Post",
0x03440e => "Chorus Level",
0x03450e => "Chorus Speed",
0x03460e => "Chorus Depth",
0x03480e => "Chorus Waveform",
0x03850e => "Flanger Level",
0x03860e => "Flanger Speed",
0x03870e => "Flanger Depth",
0x03880e => "Flanger Regen",
0x03890e => "Flanger Waveform",
0x03920e => "Flanger Width",
0x03950e => "Flanger Manual",
0x03c20e => "Phaser Speed",
0x03c30e => "Phaser Depth",
0x03c50e => "Phaser Level",
0x03c60e => "Phaser Regen",
0x03c70e => "Phaser Waveform",
0x04830e => "Tremolo Depth",
0x04840e => "Tremolo Speed",
0x04850e => "Tremolo Waveform",
0x04c30e => "Panner Depth",
0x04c40e => "Panner Speed",
0x04c50e => "Panner Waveform",
0x05040e => "Vibrato Speed",
0x05050e => "Vibrato Depth",
0x05220e => "VibroPan Speed",
0x05230e => "VibroPan Depth",
0x05240e => "VibroPan VibratoPan",
0x05250e => "VibroPan Waveform",
0x05420e => "Rotary Speed",
0x05440e => "Rotary Intensity",
0x05460e => "Rotary Doppler",
0x05470e => "Rotary Crossover",
0x05820e => "YaYa Pedal",
0x05890e => "YaYa Intensity",
0x058a0e => "YaYa Range",
0x05c60e => "AutoYa Speed",
0x05ca0e => "AutoYa Intensity",
0x05cb0e => "AutoYa Range",
0x06040e => "Synth Talk Vox",
0x06060e => "Synth Talk Attack",
0x06070e => "Synth Talk Release",
0x06080e => "Synth Talk Sens",
0x06090e => "Synth Talk Balance",
0x060b0e => "Synth Talk Release",
0x06450e => "Envelope Range",
0x06460e => "Envelope Sens.",
0x06830e => "Detune Level",
0x06840e => "Detune Amount",
0x06c20e => "Pitch Shift Amount",
0x06d10e => "Pitch Shift Mix",
0x07030e => "Whammy Pedal",
0x07040e => "Whammy Mix",
0x07050e => "Whammy Amount",
0x07060e => "Mod Pre/Post",
0x07400f => "Delay Type",
0x07410f => "Delay Enable",
0x07440f => "Delay Level",
0x07470f => "Delay Repeats",
0x07510f => "Delay Mod Depth",
0x07600f => "Delay Time",
0x07610f => "Delay Duck Thresh",
0x07620f => "Delay Duck Level",
0x07630f => "Delay Tape Wow",
0x07640f => "Delay Tape Flut",
0x078010 => "Reverb Type",
0x078110 => "Reverb Enable",
0x078210 => "Reverb Predelay",
0x078510 => "Reverb Level",
0x078710 => "Reverb Decay",
0x078d10 => "Reverb Liveliness",
0x098006 => "Dist Type",
0x098106 => "Dist Enable",
0x098206 => "Dist Drive",
0x098306 => "Dist Tone",
0x098406 => "Dist Level",
0x098506 => "Dist Distortion",
0x098606 => "Dist Filter",
0x098706 => "Dist Volume",
0x098806 => "Dist Distortion",
0x098906 => "Dist Tone",
0x098a06 => "Dist Level",
0x098b06 => "Dist Gain",
0x098c06 => "Dist Level",
0x098d06 => "Dist Sustain",
0x098e06 => "Dist Tone",
0x098f06 => "Dist Volume",
0x099006 => "Dist Drive",
0x099106 => "Dist Level",
0x099606 => "Dist Gain",
0x099706 => "Dist Butt",
0x099806 => "Dist Face",
0x099906 => "Dist Loud",
0x099a06 => "Dist Fuzz",
0x099b06 => "Dist Volume",
0x099c06 => "Dist Gain",
0x099d06 => "Dist Mid Freq",
0x099e06 => "Dist Mid Level",
0x099f06 => "Dist Low",
0x09a006 => "Dist High",
0x09a106 => "Dist Level",
0x09a406 => "Dist Distortion",
0x09a506 => "Dist Output",
0x09a606 => "Dist Suck",
0x09a706 => "Dist Smear",
0x09a806 => "Dist Heave",
0x09a906 => "Dist Overdrive",
0x09aa06 => "Dist Tone",
0x09ab06 => "Dist Level",
0x09ac06 => "Dist Mid",
0x09ad06 => "Dist Low",
0x09ae06 => "Dist Level",
0x09af06 => "Dist High",
0x09b006 => "Dist Gunk",
0x09c008 => "Amp A Type",
0x09c00a => "Amp B Type",
0x09c108 => "Amp A Gain",
0x09c10a => "Amp B Gain",
0x09c208 => "Amp A Level",
0x09c20a => "Amp B Level",
0x0a0009 => "Cab A Type",
0x0a000b => "Cab B Type",
0x0a420d => "Volume Pre FX",
0x0a4211 => "Volume Post FX",
0x0a4212 => "Preset Level",
0x0ac20e => "IPS Amount",
0x0ac30e => "IPS Scale",
0x0ac40e => "IPS Key",
0x0ac50e => "IPS Level",
0x0bc20e => "Step Filter Speed",
0x0bc30e => "Step Filter Intensity",
0x0c8218 => "EQ A Type",
0x0c8219 => "EQ B Type",
0x0c8318 => "EQ A Bass",
0x0c8319 => "EQ B Bass",
0x0c8418 => "EQ A Mid",
0x0c8419 => "EQ B Mid",
0x0c8518 => "EQ A Treb",
0x0c8519 => "EQ B Treb",
0x0c8618 => "EQ A Mid Freq",
0x0c8619 => "EQ B Mid Freq",
0x0c8718 => "EQ A Presence",
0x0c8719 => "EQ B Presence",
0x0c8b18 => "EQ A Treb Freq",
0x0c8b19 => "EQ B Treb Freq",
0x0c8c18 => "EQ A Enable",
0x0c8c19 => "EQ B Enable",
0x200213 => "Pedal Assign 1",
0x200214 => "V-Switch Pedal Assign",
0x200313 => "Pedal Min 1",
0x200314 => "Wah Min",
0x200413 => "Pedal Max 1",
0x200414 => "Wah Min",
0x204216 => "LFO1 Assign",
0x204217 => "LFO2 Assign",
0x204316 => "LFO1 Min",
0x204317 => "LFO2 Min",
0x204416 => "LFO1 Max",
0x204417 => "LFO2 Max",
0x204616 => "LFO1 Speed",
0x204617 => "LFO2 Speed",
0x204716 => "LFO1 Waveform",
0x204717 => "LFO2 Waveform",
0x20c015 => "V-Switch Assign",
0x20c115 => "V-Switch Min",
0x20c215 => "V-Switch Max",
0x20c915 => "V-Switch Type",
0x210115 => "V-Switch Enable",
0x22001a => "Tone Lib Type",
0x22011a => "FX Lib Type",
0x22021a => "FxLiblvl",
0x22041a => "FxLibLvlMax1",
0x22061a => "FxLibLvlMax2",
0x22081a => "FxLibLvlMax3",
0x220019 => "Tone Lib B Type",
0x220119 => "FX Lib B Type",
0x220219 => "FxLib B lvl",
0x220419 => "FxLib B LvlMax1",
0x220619 => "FxLib B LvlMax2",
0x220819 => "FxLib B LvlMax3",
0x300000 => "Tuning Reference",
0x300900 => "USB Audio Playback Mix",
0x300a00 => "GUI Mode",
0x300c00 => "EXP Pedal Level",
0x301300 => "USB Audio Level",
0x305200 => "Stomp Mode",
);

sub decode_super7()
{
my $msb;
my $param_id;
my $position;
my $i = 0;
my $len = @pack_bytes;

foreach my $b (@pack_bytes) {
print " " if ($i == 7);

if ($i < 7) {
# Header
printf "%02x", $b;
} elsif ($i == 7) {
if (defined($cmd{$b})) {
printf "%s ", $cmd{$b};
} else {
printf "%02x ", $b;
}
printf "(len=$len) ";
} elsif ($i == 8) {
$msb = $b;
} elsif ($i < $len - 2) {
my $order = 7 - (($i - 8) % 8);
my $byte = ($msb & (1 << $order)) ? 0x80 : 0;

$byte |= $b;

if ($i == 9) {
$param_id = $byte << 8;
} elsif ($i == 10) {
$param_id |= $byte;

} else {

if ($i == 11) {
$position = $param_id << 8 | $byte;
if (defined($effects{$position})) {
printf "%s ", $effects{$position};
}
printf "(%i, %i) ", $param_id, $byte;
} else {
printf "%02x ", $byte;
}
}
} else {
printf "(%02x) ", $b;
}


$i++;
}
print "\n";
}

sub parse_pack($)
{
my $data = $1;

while ($data =~ m/([0-9a-f].)/) {
my $len = 3;
my $type = hex($1);
$data =~ s/[0-9a-f].//;

print "($type) " if ($show_raw);

# Discards the cable number, keeping just the
# code index number

$type &= 0x0f;

# Fix the payload len size for SysEx messages
# discard any non SysEx messages.
if ($type == 5) {
$len = 1;
} elsif ($type == 6) {
$len = 2;
} elsif ($type != 7 && $type != 4) {
$len = 0;
}

for (my $i = 0; $i < 3; $i++) {
if ($data =~ m/([0-9a-f].)/) {
printf "%s ", $1 if ($show_raw);

push @pack_bytes, hex($1) if ($i < $len);

$data =~ s/[0-9a-f].//;
}
}

# 4 is start or continue
if ($type != 4) {
print "\n" if ($show_raw);
decode_super7;
@pack_bytes = ();
}
}
}

while (<>) {
if (m/\>..\s+(.*)/) {
parse_pack($1);
}
}

Mauro Carvalho Chehab

unread,
Dec 2, 2012, 8:39:18 AM12/2/12
to Mauro Carvalho Chehab, gdigi ML
Em Sun, 2 Dec 2012 11:33:38 -0200
Mauro Carvalho Chehab <mauro...@gmail.com> escreveu:

> Hi,
>
> I did a small perl script that helps to see what messages gdigi (or x-edit) are
> sending to the pedal.
>
> In order to use it, you need to download the following script, that captures USB
> traffic from a usbmon interface:
>
> http://git.linuxtv.org/v4l-utils.git/blob_plain/HEAD:/contrib/parse_tcpdump_log.pl
>
> And use it like:
>
> # ./parse_tcpdump_log.pl --device usbmon2 | ./parse_midi.pl
>
> (assuming that the pedal is connected to USB port 2)

Btw, it is possible to use x-edit running under kvm, and monitors its traffic
with the above parsers. The VM needs to be configured for USB redirection,
and spicy client needs to be used. More details to configure it are available
at:
http://hansdegoede.livejournal.com/11084.html

However, due to a very bad USB implementation at RP255 stack, I had to
apply the following patch to usbredir, as, otherwise, RP255 would fail
due to the lack of support for USB reset config.



Atenciosamente,
Prof. Mauro Carvalho Chehab, MSc, CISSP
mauro...@gmail.com

diff --git a/usbredirhost/usbredirhost.c b/usbredirhost/usbredirhost.c
index 76554e3..19faa6e 100644
--- a/usbredirhost/usbredirhost.c
+++ b/usbredirhost/usbredirhost.c
@@ -702,7 +702,8 @@ int usbredirhost_set_device(struct usbredirhost *host,

/* The first thing almost any usb-guest does is a (slow) device-reset
so lets do that before hand */
- r = libusb_reset_device(host->handle);
+// r = libusb_reset_device(host->handle);
+ r = 0;
if (r != 0) {
ERROR("resetting device: %d", r);
usbredirhost_clear_device(host);
@@ -1434,7 +1435,8 @@ static void usbredirhost_reset(void *priv)
return;
}

- r = libusb_reset_device(host->handle);
+// r = libusb_reset_device(host->handle);
+ r = 0;
if (r == 0) {
host->reset = 1;
} else {

Tomasz Moń

unread,
Dec 2, 2012, 8:56:22 AM12/2/12
to gd...@googlegroups.com
On Sun, Dec 2, 2012 at 2:33 PM, Mauro Carvalho Chehab
<mauro...@gmail.com> wrote:
> I did a small perl script that helps to see what messages gdigi (or x-edit) are
> sending to the pedal.

As a side note, I would like to mention, that current wireshark trunk,
as of r45873, contains dissector for DigiTech protocol.

Tim LaBerge

unread,
Dec 21, 2012, 12:02:38 AM12/21/12
to gd...@googlegroups.com

--
You received this message because you are subscribed to the Google Groups "gdigi" group.
To post to this group, send email to gd...@googlegroups.com.
To unsubscribe from this group, send email to gdigi+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gdigi?hl=en.


gdigi -D a

will dump nicely formatted messages to the console.
Reply all
Reply to author
Forward
0 new messages