Page 1 of 3

Open source utility to perform WAV->P conversion for ZX81

Posted: Tue Aug 06, 2013 12:28 pm
by mcleod_ideafix
Hi all!

My name is Miguel Angel. I'm also known as mcleod_ideafix at WOS and other forums. I've found this forum while in search for ZX81 demos.

Some time ago, I was lent a ZX81 program that its owner had from the 80's and I wanted to preserve it. I recorded the sound at my office and went home with a huge WAV.

Later, I tried to use any program that could convert the information stored in the WAV to a .P file. I found two:
- One of them is JAVA ZX81 Tape Converter. Last updated 2007. Not even capable of loading the WAV's I provided. It raises an I/O exception about something wrong with mark/space (??). I tried with both WAV's and AIFF's files, which this converter claims to support but no luck. Already have the last version of the JRE.
- The other one is from Stephen McDonald, and belongs to a group of MS-DOS programs named Steven McDonald's ZX81<=>PC Converters [Version 3.0], last updated in 1999. I can actually get the audio read with it, after converting it to 22050Hz, 8 bits, but the conversion is very slow and the resulting .P is wrong.
- Besides, I tried to load the WAV with the Wave Loader option of EightyOne, but after the loading, the emulator (not the emulated machine) hung.

So, as neither of these two utilities had the source code available for me to fix them, and as they seem to be abandonware, I decided that, if I want to preserve this ZX81 program, I would have to read by my own devices. I found a very valuable piece of information in a plain text file from Martin Korth (No$Cash) that really helped me on interpreting what's in the audio signal, and later on, interpret the contents of the .P file to give a BASIC listing of the saved program, contents of screen, etc.

Details about the preserved program (basically, a spanish release of ZXAS and ZXDB) are here: http://foro.speccy.org/viewtopic.php?f=11&t=3261

About the converter program:

The last version is available at the following address:
http://www.zxprojects.com/images/storie ... 1putil.zip

As of version 1.0.3, zx81putil can perform the following operations:
- Read a sound file, WAV format, with the loading noise of a ZX81 program and convert it (with a litte luck) to a .P file (I'm preparing a Youtube video showing how this utility can help you to restore damaged recordings)
- Read a .P file and converting it back to a nice and clean WAV file for further reproduction.
- Read a .P file and convert it to a TZX 1.20 compliant file that can be played with any external utility (such as some players available for smartphones).
- Play out loud a .P file to load it directly from your PC to the ZX81, without intermediate WAV conversion.

Please, check the README file for details on how to use the program. There are some advanced options present but not yet well documented.

Win32 executable included. Source code is included. You should be able to compile on Linux or OSX without any fuss. If you want support for direct playing of .P files in your executable, make sure you have the SDL devel package and include this when compiling: -DSUPPORT_PLAY_CMD

Re: Open source utility to perform WAV->P conversion for ZX8

Posted: Tue Aug 06, 2013 5:18 pm
by sirmorris
Fantastic stuff! Thanks for sharing your hard work :D

Re: Open source utility to perform WAV->P conversion for ZX8

Posted: Tue Aug 06, 2013 10:15 pm
by iturbez
Hola, Miguel Ángel. Sólo unas palabras en español para darte la bienvenida a este, tu foro.

Muchas gracias por compartir tus programas y experiencias. He descargado tu programa, y lo probaré en cuanto tenga un momento.

Hi, Miguel Ángel. Only a few words in Spanish: Welcome aboard.

Thanks for this fantastic stuff.

Re: Open source utility to perform WAV->P conversion for ZX8

Posted: Wed Aug 07, 2013 12:30 am
by yerzmyey
I wrote about the utility in the newest MONOCHROME ZX81 magazine too.

Re: Open source utility to perform WAV->P conversion for ZX8

Posted: Wed Aug 07, 2013 12:46 am
by mcleod_ideafix
Yay! Thanks! :)

Re: Open source utility to perform WAV->P conversion for ZX8

Posted: Wed Aug 07, 2013 2:33 am
by PokeMon
mcleod_ideafix wrote:As of version 1.0.3, zx81putil can perform the following operations:
- Read a sound file, WAV format, with the loading noise of a ZX81 program and convert it (with a litte luck) to a .P file (I'm preparing a Youtube video showing how this utility can help you to restore damaged recordings)
Thanks for your work. I will give it a try, soon. ;)

I developed the ZX-IDE which now transfers programs from PC to ZX81 and want to implement the back direction to SAVE data from ZX80 or ZX81 to the PC.
So do you support both targets as there is no big difference ?
The load/save data is nearly the same except that the ZX80 omits the file name transmitted by ZX81 before data (memory contents) is following. :?:
And the charset is a little bit different ...
But saw already your tables for chars and token in the source, which could be doubled and then changed.

Re: Open source utility to perform WAV->P conversion for ZX8

Posted: Thu Aug 08, 2013 1:31 am
by 1024MAK
Welcome Miguel!

:D :D :D

Nice work :mrgreen:

Mark

Re: Open source utility to perform WAV->P conversion for ZX8

Posted: Thu Aug 08, 2013 2:30 am
by mcleod_ideafix
Thank you all for the welcome! :)

BTW: I assume this is old and known by all you, but in case anyone is afraid to upgrade internally his/her ZX81, I've prepared a graphic tutorial about how to do it that I posted yesterday. Text is in spanish, so I will link you to a google translated version.
http://translate.google.es/translate?sl ... 02&act=url

Re: Open source utility to perform WAV->P conversion for ZX8

Posted: Fri Aug 07, 2015 9:11 pm
by Rishi
mcleod_ideafix wrote:
So, as neither of these two utilities had the source code available for me to fix them, and as they seem to be abandonware, I decided that, if I want to preserve this ZX81 program, I would have to read by my own devices. I found a very valuable piece of information in a plain text file from Martin Korth (No$Cash) that really helped me on interpreting what's in the audio signal, and later on, interpret the contents of the .P file to give a BASIC listing of the saved program, contents of screen, etc.
Since the text file being referred to here is no longer available at this link, could someone provide the info, i was thinking about loading a program into extended memory, and leave it there for retrieval after the power has been out (or that would make a real back-up area) but i'm fairly sure not all system variables are stored as part of the program, and then i thought may as well use the normal program storing convention, well anyway i'd like to know what it is. And i am having some plans and ideas :D

Re: Open source utility to perform WAV->P conversion for ZX8

Posted: Fri Aug 07, 2015 10:02 pm
by IanB
Welcome Miguel!