ExoticA Forum

New Protracker packer format?

Discussion about Amiga / C64 / Demoscene music and the ExoticA music archive. Favourite music, new rips, musicians, demo sounds, audio software. It's all welcome here.

Moderators: XtC, BuZz

New Protracker packer format?

Postby kyz » Mon Sep 19, 2016 10:24 am

I was ripping the intro tune from "Scoopex Plays 2 Unlimited" (1993) and found what looks like a new protracker packed format -- it's exactly the protracker replayer with changes to accomodate the packed format.

However, it's not one recognized by ProWizard or NoiseConverter.

Does anyone recognize this as a variation of an existing packer format?

Here's a description of the format:
Code: Select all
#!/usr/bin/perl -w
# Usage: dd if=Disk.1 bs=1 skip=461892 count=146286 | ./convert_intro.pl >mod.scoopex-2unlimited
#
#   offset   length     what
#   $0        $F8       31 sample infos ( 0.w = sample length in words,
#                                         2.b = sample finetune,
#                                         3.b = sample volume,
#                                         4.w = sample repeat (0=no repeat)
#                                         6.w = sample repeat length)
#   $F8       1          maximum song position in this module (songlength)
#   $F9       1          maximum song position possible ($7F)
#   $FA       $80        song positions for audio channel 0
#   $17A      $80        song positions for audio channel 1
#   $1FA      $80        song positions for audio channel 2
#   $27A      $80        song positions for audio channel 3
#   $2FA      p          pattern data (each pattern = 64 words = 128 bytes,
#                        each word being an index into the packed pattern data,
#                        the number of patterns being determined by the max
#                        pattern number referenced in the song position data)
#   $2FA+p    4          packed pattern data length (l)
#   $2FE+p    l          packed pattern data (normal protracker pattern data,
#                        but each unique longword (note+effect) is only seen
#                        once in this section, and is referenced by an index
#                        from the pattern data section)
#   $2FE+p+l  ...        sample data for each sample, as per protracker

use strict;
use List::Util qw(max sum);

# read packed module from stdin
binmode STDIN;
sub readbin {
    my $data;
    die unless read STDIN, $data, $_[0];
    return unpack $_[1], $data;
}
my @sampleinfo = map { [readbin(8, 'nCCnn')] } 1 .. 31;
my @max_posns = readbin(2, 'CC');
my @posns = readbin(512, 'C*');
my @patterns = map { [readbin(128, 'n*')] } 0 .. max(@posns);
my $packed_len = (readbin(4, 'N'))[0];
my @packed = readbin($packed_len, 'N*');
my @samples = readbin(sum(map {$_->[0]} @sampleinfo) * 2, 'n*');

# unpack pattern data
my (@new_patterns, @new_posns, %seen);
for my $posn (0 .. $max_posns[0]) {
    my $pattern;
    for my $row (0 .. 63) {
        for my $ch (0 .. 3) {
            $pattern .= pack 'N', $packed[$patterns[$posns[$ch * 128 + $posn]]->[$row]];
        }
    }
    if (not exists $seen{$pattern}) {
        push @new_patterns, $pattern;
        $seen{$pattern} = $#new_patterns;
    }
    push @new_posns, $seen{$pattern};
}

# write module in protracker format
binmode STDOUT;
print pack 'a[20]', 'scoopex-2unlimited';             # module name
map {print pack 'a[22]nCCnn', '', @{$_}} @sampleinfo; # sample info
print pack 'CC', $#new_posns, 127;                    # song length
print pack 'C[128]', @new_posns, (0) x 128;           # song positions
print 'M.K.';                                         # identifier
print @new_patterns;                                  # patterns
print pack 'n*', @samples;                            # samples
kyz
 
Posts: 118
Joined: Thu Nov 14, 2002 1:58 am
Location: Edinburgh, Scotland

Return to Music

Who is online

Users browsing this forum: No registered users and 0 guests

cron