Roll Scanning - MIDI files from piano rolls

Roll Scanning Using An Ethernet Control Interface

Under Modern Windows Operating Systems

Introduction

Having scanned over 6,000 piano rolls using scanners that ran under the now obsolete DOS operating systems, the limitations of that method have become evident. I have been working for quite some time on a next-generation scanner that will allow for operation under modern Windows operating systems. While the old DOS based systems have served me (and other rollscanners) well in their time, there are several reasons that upgrading is desirable.

  • 1. System Portability - Scanner can be run from small laptop computer.
  • 2. Enhanced Capabilities - Can do more processing while roll is being scanned.
  • 3. Faster Scanning - Goal of Archival quality scans at real-time tempo scan speeds.
  • 4. Convenience - No longer have to switch between operating systems to access/process scan data.
  • 5. Maintainability - The old DOS machines are starting to die.


    Current Hardware Status

    As a halfway step towards the eventual goal of an ethernet interfaced, full 24-bit RGB color scanner, I have created an ethernet interfaced microcontroller that will run the old single-bit Black & White threshold scanners, known as the MK3 and MK4 scanner systems. The microcontroller replaces the old DOS PC machines along with their old Lava Printer Port cards, requiring no modifications to the current MK3 and MK4 scanners. The microcontroller interface has a standard female 25-pin D-sub connector, simulating the LPT port on the old DOS PC, to which the scanner can be connected.

    The interface also has an ethernet port that can be connected either directly or via network (wireless or wired) back to a PC on which the Windows-based scan control software runs.


    MK4 transport built by Larry Doe shown connected to microcontroller interface prototype with Win-XP laptop PC running scanner control program. The old DOS machine that is replaced by the interface and laptop is on the table in the background

    For the moment, the new ethernet interface software takes data synchronously under microprocessor control with the stepper motor using the full 404 lines/inch stepper positions of the Larry Doe MK4 scanner transport, rather than using an asynchronous sampling at a lower 300 lines/inch as was done under the old DOS system. This provides slightly better accuracy and fewer ambiguous data points for the punch matrix reconstruction software to resolve.

    The current (as of 2010-Apr-06) scanning speed using the Ethernet microcontroller interface is about 250 scan lines/sec. This is almost 50% faster than the speed I was getting using the old DOS PC, which was about 170 lines/sec. This new Ethernet Interface scan line speed is about the upper limit of what the currently used Dyna CIS units can achieve. They are only spec'ed at a 1MHz clock rate for the 3648 pixel wide array.

    Other CIS units have been identified that may be suitable for the next generation scanner which can be clocked at 3 to 5 MHz. Use of one of these different CIS units, instead of the Dyna-CIS, will be necessary to achieve real-time playback while scanning at archival quality line resolution.


    Microcontroller Hardware Used

    For the microcontroller interface, I have used the Make-Controller-Kit, from makingthings.com, which has a nice set of peripherals on the application board, including both USB and Ethernet interface connections. The Make-Controller-Kit uses an Atmel AT91SAM7X256 microcontroller as it's core processor.


    One reason for choosing this microcontroller kit over some others for the new scanner interface was the built-in A/D converter, which was planned to be used for grayscale and color scans. However, at this time it appears that the speed of the on-board A/D converter may not be adequate for the full-color scanner solution. One option is to run 3 microcontrollers in parallel (one for each RGB color output). Other options are still being explored.

    The application board required some modification in order to run the interface at adequate speeds. If additional copies are to be made of the interface unit, it might be preferable to start with the more recently available interface-board for the microcontroller, or create a custom application board.

    Software Developed

    Microcontroller Firmware

    Custom firmware was developed for the microcontroller to run the scanner data collection, transport control, and message exchange tasks. The microcontroller firmware was written mostly in "C", but some sections made use of assembler-level routines to maximize speed for the critical timing applications.
    The microcontroller handles the tasks of clocking the CIS, creating an ethernet message with data from each pixel in the scan line, sending the scan line data back to the PC, and moving the paper in the transport.

    PC Scanning Application Software

    A Windows application was written, in C#, to perform the scanner control and output file operations on the PC. The main features of the Scanner Application include:

  • 1. Graphical Display of roll as it is being scanned.

  • 2. Multiple output file formats for the scan data:
          a) Bitmap/Tiff
          b) AVI video
          c) CIS with ANN for legacy compatibility

  • 3. MIDI playback while scanning.
          a) Tempo/speed control while scanning for realtime listening.



    Screen capture of PC scanner software program running under Windows-7

    PC Scan Data Processing Software

    The existing suite of processing software takes the CIS file as its input and generates MIDI file outputs, including the Punch-Master MIDI, which has the reconstructed punch matrix spacing for exact reproduction recutting of rolls, and the Emulated Expression MIDI that simulates the dynamic behavior of the pneumatic systems to reproduce the playback performance dynamics encoded onto reproducing rolls.

    The next generation processing software will use the full two-dimensional graphic image, in bitmap or equivalent file format. This will enable the use of more sophisticated image processing routines to determine punch hole placement. The lyrics and other printed information will be captured in grayscale or full color, so the frequent threshhold adjustments required by the one-bit B/W MK3/MK4 systems will no longer be necessary.

    Existing CIS files will be supported via software that converts them to tiff/bitmap image files so they can be processed with the new software suite.