[comp.sys.apple2] //gs graphics/music

taob@pnet91.cts.com (Brian Tao) (11/12/90)

From: awg0971@ritvax.isc.rit.edu (GOTTLOB, AW)

> I wanted to know how, on the GS to load a music file I've made on GS
> soundsmith or Music construction set or Music Studio ect.. so I can play it
> in a normal basic program I've made.
> Also, How can I load graphics made on deluxe paint ect..

    You posted this on comp.binaries instead of here, so I took the liberty of
moving my reply to comp.sys.a2...

    You can get the code to playback SoundSmith sequences from Huibert Aalbers
(the author of SoundSmith).  The G.A.T.E. demo is launched from the BASIC
prompt, and it plays a SS tune while it is running, so it IS possible.  Maybe
Parik can give you some hints.

     DeluxePaint II saves its graphics in a format called Apple Preferred
Format (APF).  It uses compression to shrink the size of the file, so you
would need the source code for the compression algorithm.  I'm pretty sure it
uses Huffman, but you better check the tech notes to make sure.

\/\/\/\/\/\/\/\/\/ | Brian T. Tao           | UUCP: torag!pnet91!taob      |
/                \ | University of Toronto  | INET: taob@pnet91.cts.com    |
\  The Apple II  / | Scarberia, ON          |       taob@pro-micol.cts.com |
/   Lives On!!   \ |:::::::::::::::::::::::::::::::::::::::::::::::::::::::|
\                / |   "Computer guru?  Someone who got their computer a   |
/\/\/\/\/\/\/\/\/\ |    couple of weeks before you did." (Alvin Toffler)   |

parkern@jacobs.CS.ORST.EDU (Neil Parker) (11/13/90)

In article <160@generic.UUCP> taob@pnet91.cts.com (Brian Tao) writes:
>[stuff deleted]
>     DeluxePaint II saves its graphics in a format called Apple Preferred
>Format (APF).  It uses compression to shrink the size of the file, so you
>would need the source code for the compression algorithm.  I'm pretty sure it
>uses Huffman, but you better check the tech notes to make sure.

Actually, Apple Preferred Format uses the Miscellaneous Tool Set routine
_PackBytes ($2603) to do the compression.  _PackBytes uses a form of run-
length coding for compression--a bit less sophisticated than Huffman.

If memory serves, each row of the image is compressed separately.

Recommended reading:  File Type Note for filetype $C0 (available at finer
Apple II ftp sites everywhere), and the Apple IIGS Toolbox Reference:
Volume 1 (for information on _PackBytes and its companion _UnPackBytes).

               - Neil Parker
--
Neil Parker                 No cute ASCII art...no cute quote...no cute
parkern@jacobs.cs.orst.edu  disclaimer...no deposit, no return...
parker@corona.uoregon.edu   (This space intentionally left blank:           )

taob@pnet91.cts.com (Brian Tao) (11/15/90)

From parkern@jacobs.CS.ORST.EDU (Neil Parker):

> Actually, Apple Preferred Format uses the Miscellaneous Tool Set routine
> _PackBytes ($2603) to do the compression.  _PackBytes uses a form of run-
> length coding for compression--a bit less sophisticated than Huffman.

    Ah yes, that's right.  I remember reading about that in SHRConvert.  So
all you have to do is pass a few parameters to _UnPackBytes and it will
automatically decode the APF file?  The joy of using the Toolbox!  :)

    If that's the case, I wonder if Apple will integrate some sort of built-in
GIF encoder/decoder for QuickDraw II and the Misc. Tool Set.  Then we would be
able to load in GIF's directly to any paint program.


\/\/\/\/\/\/\/\/\/ | Brian T. Tao           | UUCP: torag!pnet91!taob      |
/                \ | University of Toronto  | INET: taob@pnet91.cts.com    |
\  The Apple II  / | Scarberia, ON          |       taob@pro-micol.cts.com |
/   Lives On!!   \ |:::::::::::::::::::::::::::::::::::::::::::::::::::::::|
\                / |   "Computer guru?  Someone who got their computer a   |
/\/\/\/\/\/\/\/\/\ |    couple of weeks before you did." (Alvin Toffler)   |

campbellb@viking.UUCP (Brian Campbell) (11/20/90)

I forgot who originally posted the question, but the person wanted to know
how to decode or unpack Dpaint II pics.  I wrote a program a while back to do that
and display it on the screen or convert it to a screen format file.  As I recall, the
algorithm was fairly simple.  The hardest part may be getting past all of the header
stuff in the Dpaint II picture file (type $C1, I think).  I can provide you with the
algorithm to do all of this stuff I you need it.  BTW, does anyone know whether the
file is packed using the TOOLBOX Pack routine, i.e., can the UNPACK routine be used in
lieu of my algorithm? (at least past the header part.)

parkern@jacobs.CS.ORST.EDU (Neil Parker) (11/20/90)

In article <179@generic.UUCP> taob@pnet91.cts.com (Brian Tao) writes:
>From parkern@jacobs.CS.ORST.EDU (Neil Parker):
>> Actually, Apple Preferred Format uses the Miscellaneous Tool Set routine
>> _PackBytes ($2603) to do the compression.  _PackBytes uses a form of run-
>> length coding for compression--a bit less sophisticated than Huffman.
>    Ah yes, that's right.  I remember reading about that in SHRConvert.  So
>all you have to do is pass a few parameters to _UnPackBytes and it will
>automatically decode the APF file?  The joy of using the Toolbox!  :)

Yes, you can decode an APF picture using _UnPackBytes.  However, it isn't
quite as simple as just passing the whole file to the toolbox.  If memory
serves, each scan line is individually packed, and there are a lot of
pointers in the file to the start of each scan line.  There's also a lot of
other stuff in the file too.  I'm not kidding when I say "Read the File
Type Note"--it'll make life a lot easier for you.

>    If that's the case, I wonder if Apple will integrate some sort of built-in
>GIF encoder/decoder for QuickDraw II and the Misc. Tool Set.  Then we would be
>able to load in GIF's directly to any paint program.

Sure, it would be handy...a routine to do LZW compression (the kind used by
GIFs) would be useful for a lot of stuff, not just GIFs.  However, I
wouldn't advise holding your breath in anticipation...
--
Neil Parker                 No cute ASCII art...no cute quote...no cute
parkern@jacobs.cs.orst.edu  disclaimer...no deposit, no return...
parker@corona.uoregon.edu   (This space intentionally left blank:           )

MQUINN%UTCVM@PUCC.PRINCETON.EDU (11/24/90)

On Mon, 19 Nov 90 21:09:55 GMT Brian Campbell said:
>I forgot who originally posted the question, but the person wanted to know
>how to decode or unpack Dpaint II pics.  I wrote a program a while back to do

DeluxePaint II pictures are saved as Apple Preffered Format ($C0).

>and display it on the screen or convert it to a screen format file.  As I
> recall, the
>algorithm was fairly simple.  The hardest part may be getting past all of the
> header
>stuff in the Dpaint II picture file (type $C1, I think).  I can provide you

File type $C1 is just a raw, unpacked picture file.

>with
> the
>algorithm to do all of this stuff I you need it.  BTW, does anyone know whether
> the
>file is packed using the TOOLBOX Pack routine, i.e., can the UNPACK routine be
> used in
>lieu of my algorithm? (at least past the header part.)

Yes.

----------------------------------------
  Michael J. Quinn
  University of Tennessee at Chattanooga
  BITNET--   mquinn@utcvm
  pro-line-- mquinn@pro-gsplus.cts.com

johnmac@fawlty.towers.oz (John MacLean) (11/28/90)

In article <1990Nov20.042109.23588@scion.CS.ORST.EDU> parkern@jacobs.CS.ORST.EDU (Neil Parker) writes:
>In article <179@generic.UUCP> taob@pnet91.cts.com (Brian Tao) writes:
>>    If that's the case, I wonder if Apple will integrate some sort of built-in
>>GIF encoder/decoder for QuickDraw II and the Misc. Tool Set.  Then we would be
>>able to load in GIF's directly to any paint program.
>
>Sure, it would be handy...a routine to do LZW compression (the kind used by
>GIFs) would be useful for a lot of stuff, not just GIFs.  However, I
>wouldn't advise holding your breath in anticipation...
>Neil Parker                 No cute ASCII art...no cute quote...no cute

Unfortunately, it appears there is some legal question over the rights of
any implementation of LZW and thus every GIF en/decoder.
There is a patent on the LZW algorithm, and the holders are getting more
agressive.
I assume this is why Super Convert (The commercial version of SHRConvert)
does not have GIF support, and GIF support in TGE Library Disk #1 may yet
be removed.

Please don't start any post wars about patenting algorithms.
The fact is you can get a patent on an algorithm.

If anyone KNOWS what this means to PD/Freeware implementations of LZW
(such as all our favourite GIF decoders and Shrinkit), please pass this on.

John MacLean.
-- 
This net: johnmac@fawlty.towers.oz.au                   Phone: +61 2 427 2999
That net: uunet!fawlty.towers.oz.au!johnmac             Fax:   +61 2 427 7072
Snail:    Tower Technology, Unit D 31-33 Sirius Rd,     Home:  +61 2 960 1453
          Lane Cove, NSW 2066, Australia.

taob@pnet91.cts.com (Brian Tao) (11/29/90)

> If anyone KNOWS what this means to PD/Freeware implementations of LZW (such
> as all our favourite GIF decoders and Shrinkit), please pass this on.
>
> John MacLean. 

    Andy Nicholas uses a modified version of LZW called LZW/2 in GS/ShrinkIt
(and presumably ShrinkIt 3.03).  Whether or not this is compatible with normal
LZW is a different question.  What about all those PD GIF viewers on MS-DOS
machines?  Do they all have the GIF/LZW algorithm licensed?

\/\/\/\/\/\/\/\/\/ | Brian T. Tao           | UUCP: torag!pnet91!taob      |
/                \ | University of Toronto  | INET: taob@pnet91.cts.com    |
\  The Apple II  / | Scarberia, ON          |       taob@pro-micol.cts.com |
/   Lives On!!   \ |:::::::::::::::::::::::::::::::::::::::::::::::::::::::|
\                / |   "Computer guru?  Someone who got their computer a   |
/\/\/\/\/\/\/\/\/\ |    couple of weeks before you did." (Alvin Toffler)   |

russotto@eng.umd.edu (Matthew T. Russotto) (11/30/90)

In article <234@generic.UUCP> taob@pnet91.cts.com (Brian Tao) writes:
>> If anyone KNOWS what this means to PD/Freeware implementations of LZW (such
>> as all our favourite GIF decoders and Shrinkit), please pass this on.
>>
>> John MacLean. 
>
>    Andy Nicholas uses a modified version of LZW called LZW/2 in GS/ShrinkIt
>(and presumably ShrinkIt 3.03).  Whether or not this is compatible with normal
>LZW is a different question.  What about all those PD GIF viewers on MS-DOS
>machines?  Do they all have the GIF/LZW algorithm licensed?

Unisys seems to think so.  IMO, they can take their patent, fold it until it
is all corners....

LZW/1 and LZW/2 are both minor variants on LZW-- they just are broken into
4096 byte blocks, essentially.  LZW/1 clears after 4096 bytes, LZW/2 has
an explicit clear code.  There is some header information in front of each
block.
--
Matthew T. Russotto	russotto@eng.umd.edu	russotto@wam.umd.edu
     .sig under construction, like the rest of this campus.