Skip to main content

MIDI dump of Yamaha TX816

Abstract

I own two Yamaha TX816 and I need to dump and reorganize the patches. My computer runs on Ubuntu 24.04, the MIDI interface is E-MU XMIDI 1X1.

Part 1 - dumping

Using Bladesk Librarian

A fantastic librarian working directly in your browser: https://bladesk.github.io/DX7II-Librarian/.
It works well with my Yamaha DX7 MK1, but failed to receive dumps from the TX816.

Using ALSA command amidi

This simple command comes with ALSA and runs into a terminal (CTRL+ALT+T to open a terminal). QJackCtl must be installed first:

$ sudo apt install qjackctl
$ amidi -l
Dir Device    Name
IO  hw:2,0,0  E-MU XMidi1X1  Midi In   
$ amidi --port=hw:2,0,0 --receive=TX816B-module1.syx
cannot open port "hw:2,0,0": Device or resource busy
What's going on?

First, let's check the system calls:

$ sudo strace amidi --port=hw:2,0,0 --receive=TX816B-module1.syx
...
openat(AT_FDCWD, "/dev/snd/controlC2", O_RDWR|O_CLOEXEC) = 4
ioctl(4, SNDRV_CTL_IOCTL_PVERSION, 0x7ffec02944fc) = 0
ioctl(4, SNDRV_CTL_IOCTL_RAWMIDI_PREFER_SUBDEVICE, 0x7ffec029455c) = 0
openat(AT_FDCWD, "/dev/snd/midiC2D0", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 EBUSY (Device or resource busy)
openat(AT_FDCWD, "/dev/snd/controlC2", O_RDONLY|O_CLOEXEC) = 5
ioctl(5, SNDRV_CTL_IOCTL_CARD_INFO, 0x7ffec0294350) = 0
close(5)                                = 0
openat(AT_FDCWD, "/dev/snd/midiC2D0", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = -1 EBUSY (Device or resource busy)
close(4)                                = 0
...
The issue raises when amidi tries to open the device /dev/snd/midiC2D0.
$ ls -l /dev/snd
total 0
drwxr-xr-x  2 root root       80 Jan 11 15:01 by-id
drwxr-xr-x  2 root root      140 Jan 11 15:01 by-path
crw-rw----+ 1 root audio 116, 11 Jan 10 21:01 controlC0
crw-rw----+ 1 root audio 116,  4 Jan 10 21:01 controlC1
crw-rw----+ 1 root audio 116,  6 Jan 11 15:01 controlC2
crw-rw----+ 1 root audio 116, 10 Jan 10 21:01 hwC0D0
crw-rw----+ 1 root audio 116,  5 Jan 11 15:01 midiC2D0
crw-rw----+ 1 root audio 116,  8 Jan 11 14:47 pcmC0D0c
crw-rw----+ 1 root audio 116,  7 Jan 11 14:47 pcmC0D0p
crw-rw----+ 1 root audio 116,  9 Jan 11 14:47 pcmC0D2c
crw-rw----+ 1 root audio 116,  3 Jan 10 21:01 pcmC1D0c
crw-rw----+ 1 root audio 116,  2 Jan 11 14:46 pcmC1D0p
crw-rw----+ 1 root audio 116,  1 Jan 10 21:01 seq
crw-rw----+ 1 root audio 116, 33 Jan 10 21:01 timer
Is there any process using this device?
$ sudo lsof /dev/snd/midiC2D0
lsof: WARNING: can't stat() fuse.portal file system /run/user/1000/doc
      Output information may be incomplete.
lsof: WARNING: can't stat() fuse.gvfsd-fuse file system /run/user/1000/gvfs
      Output information may be incomplete.
What are these warnings? Well basically, lsof scans all filesystems and has no privilege on the fuse (Filesystem in Userspace) filesystem. Fuse and gvfs are used by Gnome. So we can safely ignore the warnings and deduce no process is currently using midiC2D0.

I spent hours tracing and digging in the sources without any success. I gave up on this.

Using ALSA command aseqdump

I had more success by slighly modifying the function dump_event in aseqdump.c to output binary instead of text:

286         case SND_SEQ_EVENT_SYSEX:
287                 {
288                         unsigned int i;
289 //                      printf("System exclusive          ");
290                         for (i = 0; i < ev->data.ext.len; ++i)
291 //                              printf(" %02X", ((unsigned char*)ev->data.ext.ptr)[i]);
292                                 printf("%c", ((unsigned char*)ev->data.ext.ptr)[i]);
293 //                      printf("\n");
294                 }
295                 break;
296         default:
297                 printf("Event type %d\n",  ev->type);
298         }

With this mod, I simply had to redirect the output of aseqdump to a file

$ ./aseqdump -p port > tx816A.module1.dump

Then, on each unit, select the module with Out slot and dump with UT(ILITY) → DU(MP) → Yes

Part 2 - Writing a librarian

Currenlty under development

I did a quick and dirty version in C, but I decided to write a better version in C++ based on RtMidi.

  • Install libasound2-dev
  • Download and extract RtMidi
I compiled the example provided in Getting started
#include "RtMidi.h"
 
int main() {
  try {
    RtMidiIn midiin;
  } catch (RtMidiError &error) {
    // Handle the exception here
    error.printMessage();
  }
  return 0;
}
g++ -Wall -D__LINUX_ALSA__ -o example example1.cpp rtmidi-6.0.0/RtMidi.cpp -lasound -lpthread

Comments

Popular posts from this blog

Drive replacement for Fostex DMT8-vl

The IDE hard drive on my Fostex DMT8-vl multitrack recorder shows signs of its imminent death; when getting hot, I could not record anymore. Must be said this drive comes from an old Sun Station, and has been replaced because I/O failures were detected by Solaris. It worked at least 5 years in my recorder: not so bad. However, time is now to replace it. The DMT8-vl is not able to handle drives bigger than 8.4 GB. Well, it is able to (the current drive is 15 GB), but only 8.4 GB will be usable. My tought was to use a 8 GB CompactFlash; having no moving parts means no noise, which is quite temptating for a music recording device. I purchased a CompactFlash-IDE adapter on the internet (8$) and I had to build a male-male IDE cable adapter (4$). Unfortunately, this doesn't work. The drive is correctly discovered by the operating system, which proposes to format it ("format IDE?"). After answering "yes", the formating runs pretty fast (faster than on a real drive), ...

Samba: Clients get "system error 1223" (or 123) after a server reboot

Facts: a Linux+Samba server shares anonymously a folder. After a reboot, Win clients could not attach the share drive anymore. C:\>net use \\mylinux\folder Enter the user name for 'mylinux': System error 1223 has occurred. The operation was canceled by the user. C:\>net view \\mylinux\ System error 123 has occurred. The filename, directory name, or volume label syntax is incorrect. The process are present, and tcpdump doesn't provide much information. What's going on? After hours of headscratching, the light came: the firewall was on and no rules for the Samba protocol! Grrr!

Issue with Soundpool MO4

I have a Atari STe with a Soundpool MO4 MIDI extension. It used to work very well, but unfortunatelly doesn't anymore: Cubase still detects it, and I can output MIDI to it but nothing is coming out from any MIDI Out. It took me a while to tackle it (lack of time, lack of tool, other items to play with), but I gave a glance last week-end. The parallel port on the Atari uses only the following signals: Pin 1 : Strobe (Atari -> MO4) Pin 2 : Data 0 (Atari -> MO4) Pin 3 : Data 1 (Atari -> MO4) Pin 4 : Data 2 (Atari -> MO4) Pin 5 : Data 3 (Atari -> MO4) Pin 6 : Data 4 (Atari -> MO4) Pin 7 : Data 5 (Atari -> MO4) Pin 8 : Data 6 (Atari -> MO4) Pin 9 : Data 7 (Atari -> MO4) Pin 11: Busy (MO4 -> Atari) The MO4 also decodes few other pins, but since the Atari doesn't, my guess is the MO4 was also targeted for PC. Inside the box, the MO4 is architectured around a CPLD (IspLSI1016 from Lattice) which contains the logi...