wav2cas utility

Help us complete the database with missing entries, dumps, ads, scans...

Moderator: Atari Frog

phsstpok
Posts: 30
Joined: Tue Mar 15, 2005 7:29 pm
Location: Northeast USA

Post by phsstpok » Tue Mar 15, 2005 10:07 pm

Atari Frog wrote:Did any of you notice some tape recorders were more reliable than others? I don't know if this has to do with the head alignment or something else but I found the 1010 would load some programs the XC12 just couldn't handle.
No, I only had one original 410 from 1979. I never wanted another tape recorder, EVER AGAIN.


OT:

Did anyone download the entire collection at the CAS Archive? or get a directory list at least? I haven't been unable to get on for weeks.


Phsstpok
Life is a bowl of cherries but what does that mean?
ijor
Posts: 426
Joined: Thu Mar 10, 2005 3:48 am

Post by ijor » Tue Mar 15, 2005 10:10 pm

phsstpok wrote:I converted two of the six commercial tape without much trouble. Two tapes were unusable. They had huge audio gaps and nothing could be done to save them.
This is not necessarily a bad tape. Some commercial tapes have long gaps, it could be for copy protection and it could be for other reasons as well. Actually, it would be very strange that the signal degraded so much to the point that you get a long gap with silence. Unless, of course, the tape is physically damaged (and not magnetically). But in this case you should be able to visually see the physical damage.
We discussed stereo vs mono. He explained that one channel has audio and the other has the data but blending both audio channel doesn't affect the algorithm.
Record in Stereo and NOT in mono. Or at least do as deathtrappomegranate does, just disconnect one of the stereo plugs. What you have been told is indeed true. There are only two frequencies that must be decoded, and if the signal is good that would work even when recording in stereo. But if the signal is degraded, the noise coming from the other channel could make the difference. Furthermore, if your tapes seem to have a very low level, then you will automatically get a level boost by recording in stereo.

There is one exception. Some (usually cheaper) third party tape recorders and interfaces recorded in mono. If the tapes were recorded in one of those systems, then you should record the WAV file in mono.

For “converting” from Stereo to mono use any decent Wave Editor. Your sound card probably included one, but otherwise plenty are available. With the Wave Editor delete the “other” channel and convert the remaining one to Mono.
There is not much redundancy if any (my speculation not Ernest's words) designed into tape files. Long dropouts means missing data, irrecoverable missing data.
If by redundancy you mean error correction, then of course it is not present. Error correction is not present in floppies either (not even in PC ones). There is however a checksum byte on each record, this should be able to detect (but not correct) most errors.
Things that hurt my recovery include using cheap department store tapes 25 years ago, not properly documenting what was on the tapes. For example, some tapes had CSAVEd files, binary load files, LISTed files, SAVEd files, in no particular order. Tape counter numbers did me no good having tossed out my Atari Tape player years ago.
You might be able to recover partial files, specially if they were LISTED. I’m not sure what the format of CAS files is. But you might be able to see the text loading your CAS file with an hex editor. If the effort is worth or not, that’s of course to you to decide.
Tapes do degrade.
All magnetic media degrade. But tapes usually faster because both the media and the recording system were normally of lesser quality.
ijor
Posts: 426
Joined: Thu Mar 10, 2005 3:48 am

Post by ijor » Tue Mar 15, 2005 10:13 pm

Atari Frog wrote:Did any of you notice some tape recorders were more reliable than others? I don't know if this has to do with the head alignment or something else but I found the 1010 would load some programs the XC12 just couldn't handle.
Yes, of course. The best ones were the 1010 and the XC11. The XC12 AFAIK was never sold in the USA, and was probably the worst model.
Atari Frog
Posts: 2875
Joined: Sat Jan 31, 2004 9:08 pm

Post by Atari Frog » Tue Mar 15, 2005 10:27 pm

phsstpok wrote:Did anyone download the entire collection at the CAS Archive? or get a directory list at least? I haven't been unable to get on for weeks.
It seems the site is down for good...

I got the interesting stuff (original tape images and unknown games) and it's being sorted. Cracked tapes of known games were left out because they're no use at all in our project.

--
Atari Frog
http://www.atarimania.com
Atari Frog
Posts: 2875
Joined: Sat Jan 31, 2004 9:08 pm

Post by Atari Frog » Tue Mar 15, 2005 10:33 pm

ijor wrote:Yes, of course. The best ones were the 1010 and the XC11. The XC12 AFAIK was never sold in the USA, and was probably the worst model.
The XC12 is practical but seems pretty crappy overall. If the tape isn't PERFECT, you know your program will never load...

--
Atari Frog
http://www.atarimania.com
User avatar
deathtrappomegranate
Posts: 2248
Joined: Sat Jul 10, 2004 11:27 am

Post by deathtrappomegranate » Tue Mar 15, 2005 11:09 pm

I guess I've been lucky with XC12s, but the XC11 is better.

I haven't really tried manipulation of .wav files yet. Most of my audio stuff was lost when WinXP installation destroyed my FAT. It was a bug in XP, since acknowledged by MS, but I lost several gigs of data, including my PGP keys :( :(
phsstpok
Posts: 30
Joined: Tue Mar 15, 2005 7:29 pm
Location: Northeast USA

Post by phsstpok » Tue Mar 15, 2005 11:11 pm

ijor wrote:
phsstpok wrote:I converted two of the six commercial tape without much trouble. Two tapes were unusable. They had huge audio gaps and nothing could be done to save them.
This is not necessarily a bad tape. Some commercial tapes have long gaps, it could be for copy protection and it could be for other reasons as well. Actually, it would be very strange that the signal degraded so much to the point that you get a long gap with silence. Unless, of course, the tape is physically damaged (and not magnetically). But in this case you should be able to visually see the physical damage.
Generally since commercial tapes are as long or as short as they need to be I just record the entire tape to the PC. The two bad tapes had spiked noise, data fading in and out of low levels and even silence. Looking at the HEX file produced by WAV2CAS I could see that the recording dropped off mid-data, fading in and out. One tape had visible signs of corrosion or rot. The other one played for about 30 seconds and went nearly silent for the 10 minute length of the tape, except for some spikes. OK it wasn't dropouts.

My own tapes did fade in and out

[deleting my prior comments as all the quoting is messing up readability].
Record in Stereo and NOT in mono. Or at least do as deathtrappomegranate does, just disconnect one of the stereo plugs. What you have been told is indeed true. There are only two frequencies that must be decoded, and if the signal is good that would work even when recording in stereo. But if the signal is degraded, the noise coming from the other channel could make the difference. Furthermore, if your tapes seem to have a very low level, then you will automatically get a level boost by recording in stereo.
One of us is confused (probably me). It is my understanding that a stereo tape recorder lays down two tracks in the form of L+R on one track and L-R on the other track. During playback the signals are added and subtracted from one another to produce L+L and R+R, the separate channels. The two tracks do reinforce each other to help with the reproduction of the two CHANNELs. However the signals, orginate as two separate channels, Left and Right. If one channel didn't contain any information when recorded then there isn't anything during playback either. Hence, one CHANNEL will have signal and one won't. You would get no reinforcement by later recording both channels at the PC end. We don't have access to the actual tracks, so we can't take advantage of reinforcement.

Listening to the output of my tape deck it is clear that one channel is empty, except for some static and spikes.

I don't see how recording both channels at the PC end would help the situation.
There is one exception. Some (usually cheaper) third party tape recorders and interfaces recorded in mono. If the tapes were recorded in one of those systems, then you should record the WAV file in mono.

For “converting” from Stereo to mono use any decent Wave Editor. Your sound card probably included one, but otherwise plenty are available. With the Wave Editor delete the “other” channel and convert the remaining one to Mono.
Unless what I said a moment ago is completely wrong it would seem better simply to record one channel in the first place. This is what I meant by "mono". I didn't mean combine the two channels into mono.
If by redundancy you mean error correction, then of course it is not present. Error correction is not present in floppies either (not even in PC ones). There is however a checksum byte on each record, this should be able to detect (but not correct) most errors.
I stand corrected. No reduncy whatsoever.
You might be able to recover partial files, specially if they were LISTED. I’m not sure what the format of CAS files is. But you might be able to see the text loading your CAS file with an hex editor. If the effort is worth or not, that’s of course to you to decide.
Actually WAV2CAS produces a hex dump which one can use for analysis. It even has some limited self analysis. At the end of the dump of each record you see either "OK" or "Bad". "Bad" usually means whole bytes were lost. Occassionally the number of bytes is correct but the checksum is wrong. It doesn't matter. Data is lost and there isn't any possibility to recover it from the one file alone

A clever person might be able to recover file fragments but I don't know how to do this.

I forgot this earlier but Ernest suggested that if you have multiplie copies of the file you might use a WAV editor to replace damaged areas. It's doubtful data corruption would occur in the same places on both files. Individual records can be spotted with a WAV editor. The damage could be repaired. Even shorten records can be spotted.

Sounds pretty complex to me.

I would think it would be easier to recontruct the files from the respective hex dumps instead. Of course, I don't know the format of CAS files either, and I'm not much of programmer.

Tapes do degrade.
All magnetic media degrade. But tapes usually faster because both the media and the recording system were normally of lesser quality.[/quote]True. However, I was somewhat amazed how 20+ year-old, cheap diskettes held up sitting on the basement floor in a cardboard box all this time.


Phsstpok
Life is a bowl of cherries but what does that mean?
ijor
Posts: 426
Joined: Thu Mar 10, 2005 3:48 am

Post by ijor » Wed Mar 16, 2005 2:02 am

phsstpok wrote:One of us is confused (probably me). It is my understanding that a stereo tape recorder lays down two tracks in the form of L+R on one track and L-R on the other track. During playback the signals are added and subtracted from one another to produce L+L and R+R, the separate channels.
Hmm, I’m not an audio engineer, but I believe you are confused. Stereo analog recording is done with two discrete signals, there is no channel “matrixing”. The mono track is divided in two halves, the left channel is recorded on one half and the right on the other one.

Matrixing is done on stereo broadcastings (TV and Radio) for compatibility reasons. The same stereo signal might be detected both by a stereo or a mono receiver. So the mono signal (L+R) must be transmitted in the usual way. Obviously, it is not efficient two transmit the two channels again separately. So a single extra signal is encoded as L-R that is used by stereo receivers only.

But tape recorders operate completely different. If a stereo tape would be matrixed as you describe, then it would break compatibility with mono. You would hear only the left channel with a mono player (L+R + L-R = 2L). And when using a mono tape on a stereo player you would hear only one speaker (not very desirable).
If one channel didn't contain any information when recorded then there isn't anything during playback either. Hence, one CHANNEL will have signal and one won't.
This would be true in a perfect world. But there is noise, crosstalk, etc present in an audio signal. So some noise will be always present in the unused channel.
Listening to the output of my tape deck it is clear that one channel is empty, except for some static and spikes.
Exactly. And the lesser the quality and the level of the “non-empty” channel, the more the incidence of this noise when recording on mono. Furthermore, as we mentioned in previous messages, some commercial tapes have audio on the other channel, which will add interference with the data channel.
I forgot this earlier but Ernest suggested that if you have multiplie copies of the file you might use a WAV editor to replace damaged areas.
This will probably work with marginal tapes (almost good), or even with good tapes that had some small glitches during the WAV recording. Don’t think it will help with badly degraded tapes as you describe.
phsstpok
Posts: 30
Joined: Tue Mar 15, 2005 7:29 pm
Location: Northeast USA

Post by phsstpok » Wed Mar 16, 2005 2:19 pm

phsstpok wrote:One of us is confused (probably me). It is my understanding that a stereo tape recorder lays down two tracks in the form of L+R on one track and L-R on the other track. During playback the signals are added and subtracted from one another to produce L+L and R+R, the separate channels.
ijor wrote:Hmm, I’m not an audio engineer, but I believe you are confused. Stereo analog recording is done with two discrete signals, there is no channel “matrixing”. The mono track is divided in two halves, the left channel is recorded on one half and the right on the other one.

Matrixing is done on stereo broadcastings (TV and Radio) for compatibility reasons. The same stereo signal might be detected both by a stereo or a mono receiver. So the mono signal (L+R) must be transmitted in the usual way. Obviously, it is not efficient two transmit the two channels again separately. So a single extra signal is encoded as L-R that is used by stereo receivers only.

But tape recorders operate completely different. If a stereo tape would be matrixed as you describe, then it would break compatibility with mono. You would hear only the left channel with a mono player (L+R + L-R = 2L). And when using a mono tape on a stereo player you would hear only one speaker (not very desirable).
That makes sense to me.

I've since learned that the tracks of the compact cassette are layed down in true stereo and that a stereo track width is 1/32 of an inch, half the width of a mono track.

Thanks for clearing up my foggy memory.

...
phsstpok wrote:I forgot this earlier but Ernest suggested that if you have multiplie copies of the file you might use a WAV editor to replace damaged areas.
ijor wrote:This will probably work with marginal tapes (almost good), or even with good tapes that had some small glitches during the WAV recording. Don’t think it will help with badly degraded tapes as you describe.
This much I understood.

The technique is not something I would want to attempt unless it was absolutely necessary which it isn't in my case. It also wouldn't be possible with commercial tapes unless one had multiple copies from which to record different WAV files.

My personal programs aren't critical, obviously, but I would have liked to have recovered them. Foolish of me not to keep hardcopies.

Thanks for your help and setting me straight.

Phsstpok
Life is a bowl of cherries but what does that mean?
ijor
Posts: 426
Joined: Thu Mar 10, 2005 3:48 am

Post by ijor » Wed Mar 16, 2005 4:06 pm

phsstpok wrote:I forgot this earlier but Ernest suggested that if you have multiplie copies of the file you might use a WAV editor to replace damaged areas.
...

It also wouldn't be possible with commercial tapes unless one had multiple copies from which to record different WAV files.
You don't neccessarily need multiple tapes, but multiple WAV recording of the same tape. "Soft errors" are common and they could be fixed with multiple passes. Soft error is when an error happens by some reason that is not present in another pass. For example, a piece of dust might produce an error but the dust could move to a different position the next time you record.
Thanks for your help and setting me straight.
I wasn't exactly setting you straight :) Sorry if I sometimes sound a bit harsh. English is not my native language and I sometimes might sound not as friendly as I want.

Actually, it seems I wasn't completely right. I never used WAV2CAS so I only was talking from theory. For example, I thought that not recording in MONO was critical. From your experience and the one from the WAV2CAS author, it seems it might be important only in some cases.
phsstpok
Posts: 30
Joined: Tue Mar 15, 2005 7:29 pm
Location: Northeast USA

Post by phsstpok » Fri Mar 18, 2005 5:23 pm

ijor wrote:
phsstpok wrote:I forgot this earlier but Ernest suggested that if you have multiplie copies of the file you might use a WAV editor to replace damaged areas.
...

It also wouldn't be possible with commercial tapes unless one had multiple copies from which to record different WAV files.
You don't neccessarily need multiple tapes, but multiple WAV recording of the same tape. "Soft errors" are common and they could be fixed with multiple passes. Soft error is when an error happens by some reason that is not present in another pass. For example, a piece of dust might produce an error but the dust could move to a different position the next time you record.
Thanks for your help and setting me straight.
I wasn't exactly setting you straight :) Sorry if I sometimes sound a bit harsh. English is not my native language and I sometimes might sound not as friendly as I want.

Actually, it seems I wasn't completely right. I never used WAV2CAS so I only was talking from theory. For example, I thought that not recording in MONO was critical. From your experience and the one from the WAV2CAS author, it seems it might be important only in some cases.
[post edited for clarity]

Don't worry. I didn't infer anything beyond what you actually said. I just tried to absorb the information

I've been discovering what you mean about "soft errors". I have a troublesome tape. I may need some, if not all, of the techniques we have described here.

The tape is Epyx, "Crush, Crumble and Chomp!". This tape has duplicate copies, one each on the left and right tracks (recorded mono maybe?) on side A. (Side B is the Radio Shack TRS-80 version).

My first attempts with WAV2CAS went like this.

Right track yielded two bad blocks but position so that the programs won't load.

Left track yielded many bad blocks but at least loaded part of the title animations.

When I recorded both tracks I got better results. (By the way my sound card software appears to combine two tracks to mono when mono recordings are requested. It doesn't let me record left or right independently and so the single cable trick is helpful here). This time I got about a dozen bad blocks but in better locations of the program.. I was able to load the entire title section.

Crush, Crumble and Chomp is an unusual tape. It appears to contain two (or three) separate BASIC programs and raw data. You load the first part with the CLOAD commmand, just as you would with your own BASIC programs on cassette. When you RUN the program it starts the tape player again and loads data directly from the tape. I've learned from the many load attempts that the program is loading characterset data, and with no form of error checking. I know this because Atari audibly alerts you when it can't read a block of data. When this happens the program continues but you see corrupted characters being generated, can be one or all, yet the title animations proceed without error messages.

The third stage of the tape load is the main program. I was able to recover this program, completely intact (or so I believe). However, it is useless on its own, without that data that is loaded during the middle stage.

What I think has happened is WAV2CAS has missed a delay gap. I believe this because at one point the "virtual tape" is sending data before the program has requested what it thinks is a real tape player to start.

I can only see what I believe has been happening while using my real 800. In the emulator, everything happens too fast and there is no real-time tape progress indicator. APE for Windows has such an indicator. CAS2SIO just has a running record status but I can see that it doesn't stop or pause either.

I need a virtual PAUSE button.


Anyway, I have a few more ideas and will keep trying.

One trick I might is to put the three segments in different CAS files. The virtual tape player can't keep running if there is no more data to send.


Phsstpok
Life is a bowl of cherries but what does that mean?
ijor
Posts: 426
Joined: Thu Mar 10, 2005 3:48 am

Post by ijor » Fri Mar 18, 2005 7:06 pm

This tape has duplicate copies, one each on the left and right tracks (recorded mono maybe?)
Probably. Many commercial tapes were recorded in mono.
By the way my sound card software appears to combine two tracks to mono when mono recordings are requested. It doesn't let me record left or right independently and so the single cable trick is helpful here.
What you can do is to use a Wave Editor, once you have a stereo WAV file. With the editor you can do all sort of conversions, delete one channel, etc.
I've learned from the many load attempts that the program is loading characterset data, and with no form of error checking.
Hmm. It is possible to have data without checksum. But this requires bypassing the OS and using custom routines talking directly to the hardware. Some tapes use custom blocks as a form of copy protection. This might be the case here. But might me also something else.

What might be happening is that the program can’t read the middle stage (for some reason). Actually, it is possible that the checksum failed. Normally a loader will stop and tell you that an error occurred. But it is possible that this loader doesn’t. If the tape keeps running after the failure, the sound you hear is different.
What I think has happened is WAV2CAS has missed a delay gap. I believe this because at one point the "virtual tape" is sending data before the program has requested what it thinks is a real tape player to start.
This is what I said in my first message. Some programs won’t work with a SIO2PC cable because the motor control signal is missing. A real Atari can pause and restart the recorder. When using a SIO2PC cable the software in the PC has no way to know the state of this motor control signal. So it happens exactly what you describe. The PC is not pausing, and it sends the data too early.

When using an emulator is different. I’d suppose that the emulator actually emulates the motor control signal. But I don’t know if this is actually implemented or not.

Ok, suggestions:

Make a few recording in STEREO, say four or five (depending on your patience). Compress the WAV files and save them intact (say, burn a CD). This might be helpful in the future. Because even if you can’t now recover the program for some reason. You might be able in the future using those WAV files. Again, use STEREO. It is always possible to convert this to MONO deleting one channel or merging both.

If the middle stage is indeed protected, probably WAV2CAS will fail. I don’t know for sure if WAV2CAS (or the CAS format at all) support custom tape formats. But from what you said in an earlier post, I suspect it doesn’t. If this is the case you are out of luck at this time, but the WAV files might be usable when and if this support is added. And you (or somebody else) can always use the WAV files to physically record a new tape and load it with a real atari tape recorder.

If you are willing to do manual recovery, do the following. Find a decent Wave Editor. Convert all the WAV files to mono (but keep the originals in STEREO). You can get two, or three MONO files for each one STEREO recording. One for each channel separately, plus a third one merging both channels.

Identify your best recording (the one with fewer errors) and somehow mark the records (blocks) with errors. See if other recordings have these same blocks ok. Using the editor you can cut and paste the good blocks over the bad ones.

The “virtual pause” can be emulated manually. Split the WAV files into two separated files. Make the splitting at the point where the pause is needed. Load the first CAS. At the right time, load the second one. You will probably get the right timing after a few attempts.

All of this assumes this program is rare. If it is not, this probably is not worth.
Atari Frog
Posts: 2875
Joined: Sat Jan 31, 2004 9:08 pm

Post by Atari Frog » Fri Mar 18, 2005 10:05 pm

Hi,

First of all, thanks for contributing again! The tape image will be uploaded tomorrow :wink:

I happen to have Crush, Crumble and Chomp! on tape and tried the conversion a couple of weeks ago... without using WAV2CAS. If you have the last part of the program with the data, I can probably retrieve the first and second sections easily (as they are of the standard CLOAD variety).

Let me know if we can reconstruct the tape version of the game this way...

--
Atari Frog
http://www.atarimania.com
phsstpok
Posts: 30
Joined: Tue Mar 15, 2005 7:29 pm
Location: Northeast USA

Post by phsstpok » Sat Mar 19, 2005 5:05 am

Atari Frog wrote:Hi,

First of all, thanks for contributing again! The tape image will be uploaded tomorrow :wink:

I happen to have Crush, Crumble and Chomp! on tape and tried the conversion a couple of weeks ago... without using WAV2CAS.
What were you using if not WAV2CAS?
If you have the last part of the program with the data, I can probably retrieve the first and second sections easily (as they are of the standard CLOAD variety).
I already have the first part. I must have most of the last part as what I have begins at lline 10 and continues to what is probably the end of the program. The program appears to end with just a RUN command, as in to simply restart the program.
Let me know if we can reconstruct the tape version of the game this way...
The program is failing at direct reads of the tape. These are in the form of GET #U3, variable (U3 being itself a variable for the file number). The program is doing these reads in a For..Next loop. I would think timing for this would be critical. Difficult using a real tape never mind simulating it on a virtual tape..

I don't have a real Atari tape player. I'm curious how the real thing would behave during that read loop.


Phsstpok
Life is a bowl of cherries but what does that mean?
ijor
Posts: 426
Joined: Thu Mar 10, 2005 3:48 am

Post by ijor » Sat Mar 19, 2005 6:01 am

phsstpok wrote:The program is failing at direct reads of the tape. These are in the form of GET #U3, variable (U3 being itself a variable for the file number). The program is doing these reads in a For..Next loop. I would think timing for this would be critical. Difficult using a real tape never mind simulating it on a virtual tape..
Ah, I think I understand what is going on.

First, the (possible) solution, then the explanation. I assume you can recover all three parts successfully. You will need to increase the inter-record-gap on all the blocks of the second part. The inter-record-gap (IRG) is the pause (gap) between each record. You can use a WAVE editor to patch the WAV, or an hex editor to patch the CAS file.

What happens is the following: The Atari OS has two different modes for reading/writing cassettes. One is with a short IRG, other with long IRG. When you load/save a basic file with CLOAD/CSAVE you select the short/fast mode. When you use LOAD “C:”/SAVE “C:” you select the long/slow mode. The slow mode doesn’t just increase the IRG, it actually pauses the tape between each record. Actually the long IRG is done only for the purpose of allowing the stop/start of the tape.

When loading a file recorded with fast mode, everything must be done fast enough. This is because the tape is not stopped. But when using the slow mode you have all the time of the world. After the OS reads a full record, is stops the tape and save the record in a memory buffer. In the meantime, there is no rush, the tape is stopped.

If you try to read a file byte by byte in BASIC, using “GET,#”, this is very slow. It must be done in slow mode. The problem you are seeing, is again, the lack of the motor control signal on the SIO2PC interface. Because the PC never pauses the tape, the slow basic program has no chance to read anything except the first record (of the second part).

So what you must do is to artificially make a very long IRG. The idea is to give enough time for the BASIC program, as if the tape would have been stopped. The long gap must be added before each record of the second part. I can’t say how long this gap must be, probably a couple of seconds.

Now, patching the file manually will probably be not so easy …

Again, the problem is related only to the SIO2PC interface. It won’t happen in real hardware. And if the emulator properly supports the motor control signal, then it shouldn’t be a problem either.

Real hardware won’t have a problem because the second part was surely recorded using slow/long mode. SIO2PC needs extra long gaps to compensate for not pausing the tape.
Post Reply