I'm new to this forum, though I plan to be a regular reader, and possibly, a frequent poster.
I'm a proper retro geek; I started programming on my step-father's TRS80 Model I Level II (our family computer) in FEB/1980 and that began our shared heritage and interests in computing. My father bought me (well, shared with my brother Mike) a Dragon 32 about 1983; I've owned this for years, and written many games on it. At school, once they'd bought an RML 380Z, some 480Z's, and a pile of ZX81s, I wrote many games on the 380Z and 480Zs during my lunch breaks. My step father bought an Amstrad 464 (for the family, and his interests in colour computing) about early 1984; I have since written many games on that; I've owned it for years now. Whilst at college, I wrote new games on their BBC Model B's. I started being a professional programmer (on IBM PC Compatibles; IBM BASIC, GWBASIC, later COBOL, and so-on).
I never stopped writing new games for the computers I had access to; this kept alive my knowledge of memory and port addresses, features of obscure versions of BASIC, and so-on; my peers usually spot my geek skills fairly fast.
However, to more pertinent matters than my initial introduction to this forum... I saw your post; a fellow retro gamer having a familiar problem; loading original audio tapes into a PC-based emulator. Successfully.
I've spent some of the last eight months trying to port some of the games I wrote for the TI 99/4a and VIC-20 into emulators.
I've had LOTS of problems, and come up with lots of options, and have had some odd routes that were succesful, though not ideal.
I wrote a game called "Egg Panic" for the VIC-20 (in the native BASIC) about five years ago. I have also (incompletely, though it is very playable) ported it to Amstrad 464 (in the native BASIC). The Amstrad version even mirrors the VIC-20 character set for increased authenticity, and has subtleties like it seems to have a 22-character (the VIC-20 offers 23 rows of 22 columns) display even though the Amstrad has only 20 across in Mode 0 (16 colour mode).
I wrote a game called "Worm Maze" for the TI 99/4a (using TI BASIC) about a year ago, which I thought was finished, but was finished off very recently (due to the points below) which has also been (almost) ported to Amstrad 464 (I now need to update the two Amstrad versions; the full-screen-map (16 colour mode) version versus the more accurate version (4 colour mode)).
I used a ZX Spectrum tape lead (it was convenient; I have about 200 (mostly) retro, and (some) not-quite-current, computers and consoles, plus more original software than some retro libraries; my very large flat is getting very crowded) to connect the audio-input socket on my PC to the earphone socket on a cheap audio tape player (I used to use this one on a range of 8-bit computers; let's just say I have a few audio tape players; but most of them are carefully tweaked to meet the need for specific computers to reliably load and save).
I used a program called "Audio Grabber" to listen to the tape, writing the captured form into a WAV file.
I like the multi-system emulator "MESS", though it has it's features and quirks, it does tend to provide a very accurate emulation; I do have plenty of emulators, as some work best with only a handful of games (i.e. less buggy than some others).
So, I used MESS (v0.136) to emulate a bog-standard VIC-20 (it does a nice job of emulating the Europe edition of the TI 99/4a too, though there were issues; I'll explain later).
From the emulator, it can simulate a tape content using WAV file; you can get the emulator to "save" to such a file, or "load" from it, as though it was a real bit of tape, though it is (of course) at exactly the same speed. The "rewind" tool can be a bit crap at times, though, as it sometimes requires going through a typical windows program menu option to rewind one step of the virtual tape counter (each step being about one second) so it is usually easier to "unmount" then re-"mount" the same WAV file as the tape content. I'm not sure why this wasn't implemented as a "toggle" (rewind being on or off) and not "just a bit of rewind, on demand".
I did about thirty captures of my VIC-20 game onto my PC, endlessly varying the volume levels. Fortunately, Audio Grabber gives some feedback on how it is understanding the sound it is capturing, including an immediate play-back (to your PC speakers) facility.
After much experimentation, I largely concur with the classic recommendation of having the volume set to about half of maximum, then making very slight adjustments to suit, to get the reliability to improve.
However, no matter what I did, I could not get a perfect volume setting that would actually load a program longer than a few lines.
This tape player has a mini microphone; I am wondering if it contaminates the "earphone" output with a little "microphone" junk. I plan to try a different tape player, but many of mine are specifically (and precisely) tuned for certain computers, and I don't like playing with their settings. I'm struggling to find another "decent" one I can re-use without causing me some other pains later.
I've been a professional programmer since 1985 so I've been thinking about writing a program which cleans up a WAV file, since 80s computers write data to a tape at a low baud rate with very simple (i.e. binary) square waves, so it should not be a great task. Unfortunately, my professional skills are suited to modern 4GLs and not low-level stuff to run under Windows. Though my geek heritage (largely from 80s computers, then MS-DOS and UNIX) might give me some advantages, I've lost touch with C++ and even Visual BASIC, so need to do a lot of re-learning to get into a position to deal with this plan.
I did notice that the capture rate on the WAV file isn't that high; I'd like to have the sampling rate as high as possible, so that I can better determine what is noise and what is the original sound.
I was getting frustrated. I also wanted to play the game in an emulator, as it isn't handy having a VIC-20 on my PC desk when I want to retro-develop games on so many differing consoles; there is only space for a few to be on at once (I do have a few cheap TVs, though some are devoted to my console gaming).
I resorted to having a real VIC-20 on my right, and the PC on my left; typing into the emulator what I Saw on the VIC-20's TV. It helped a lot that the VIC-20 has only 3.5k, I wrote the program from scratch, and my program needs large arrays (it is a variation of space invaders with up to eighty aliens on screen at once, running in the native BASIC) so I spent a LOT of time revising and tweaking the same original code to gradually make it efficient enough yet have enough functionality; I knew the code really well, though I sometimes got a bit confused as to exactly which version of a bit of a program I was looking at (long late nights tend to add confusion).
In other words, I knew what this program looked like; I can remember what line number range handles what functionality, and could probably quote some of the program without looking at it... though, not perfectly, as wrote it a few years ago; the translation to Amstrad 464 was about AUG/2010 so my memory of it should be refreshed (the CD was created around FEB/2011).
Once I'd got the bugs sorted out (it helps to ask the computer on the right what the suspect bit of program is supposed to look like on the computer on the left) I used the emulator to save to a WAV file. I kept interim copies, as it was slow to type in a program, and edit it, in an emulator, as the PC does not have a VIC-20 keyboard; this takes some getting used to, especially with awkward computers that use weird control sequences and codes that must be entered through the keyboard to offer screen control (like the screen clear [inverse heart] and cursor home [inverse S] symbols).
Having created the program on the VIC-20, but not the same year, did require me to get some practise handling the appearance and editing / typing of the control codes; it did not take long to get the hang off, again, though trying to use a PC keyboard to do the same thing was a much bigger learning issue and I had a lot of problems getting the hang of that.
Eventually, it worked; I could play it, on the emulator.
I did some alternate tests, too; I created an audio CD, which contained the PC captures of the original VIC-20 audio tape recordings (I usually make at least three saves to an audio tape, and check at least two of them) plus various MESS recordings of the same VIC-20 game (albeit the one typed directly into MESS). I used a CD/MP3 to audio-tape interface; this looks like a normal tape, but has a lead coming out of it. You insert this tape end into the Commodore-specific tape drive, shut the lid (as much as have a lead hanging out the simulated tape lets you) and plug the interface lead into a CD player which contains the needed audio CD. You ask the VIC-20 to load the game, get the tape deck doing its' thing, then tell the CD player to pick the right track, and press play on that.
After a lot of fiddling with volume controls, and establishing a persistent volume level, some of the original PC captures could be loaded into a real VIC-20 (typical; none of them loaded into MESS) but all of the MESS-created recordings were loadable into a real VIC-20.
Great. If I type it into MESS, I can port it into a real one; not what I wanted, but, from a retro game developer point of view, I can now use my PC to create new games.
Annoyed, and increasingly distracted by my desire to gain success from other projects, I put this aside.
Later (last Monday) I remembered my TI 99/4a game, "Worm Maze". I enjoy this, and wanted to play it on emulator; I bragged (inaccurately, it seems) to a retro gamer that I'd got it into an emulator (I got confused with "Egg Panic", I think; we were talking about lots of games, commercial and personal). So, when I tried to find it to e-mail it, I decided I needed to port it, else I'm a liar.
Porting a TI 99/4a game from audio tape to PC has exactly the same issues as those I had with the VIC-20 game; I was getting annoyed.
So, I developed a strategy to improve my ability to type the "Worm Maze" game (it uses TI BASIC) into the emulator.
Initially, I tried to use the emulation and type the code in directly; I found this awkward and slow, whilst I was slowly getting used to a PC interpretation of a TI keyboard.
Frustrated, I decided to type the source code of the game directly into Notepad; here I could use a PC keyboard for what it is designed for, as I'd spotted the "paste" option in MESS (this does not seem to be supported for all emulated systems).
I did a few small tests; this seemed to work, as I could clearly paste a couple of lines of code in (literally; I tried two, and they were short).
It was easy enough to keep a TI 99/4a to my right, with the game loaded, and "LISTing" a few lines at a time (to stop the TV / TI screen scrolling beyond what I'd typed on the PC) whilst typing it into the PC. It helps that I wrote the game, so I can easily tell when I'm looking at a zero or Oh, one or the letter I, and similar popular mis-readings, because I understand the context, how I might have achieved that bit of program, and what it is trying to do.
It also helped, that just as I had trouble making the "Egg Panic" game fit on a VIC-20, I had enormous difficult trying to get "Worm Maze" to work, fit in 16k, have eight detailed levels, endless subtleties, two varieties of roving monsters (one edible; the other not), a 32 (maximum) segment worm (the player character), navigating a 21x21 maze, sliding blocks, switches, disappearing/re-appearing blocks (controlled by switches) etc. and more crammed in, and yet still be playable, in a slow implementation of BASIC with single-line statements and that I'm new to (as I said, my first game for it). So, I've edited and edited this program; endlessly refining sections, to try to make it fit, work and have the features I wanted (well, most of them; I've listed some of the surviving features). I cheated in a few areas; I resorted to creating a level editor on an Amstrad 464 (I know them very well; I've been programming them since around 1984). I also made a mess of the first incarnation of the worm's move and grow functionality, so I also did some prototyping (test code) on the same Amstrad; the solution was ported back, and integrated back into the TI version (the only existing whole version of the developing game, at that time).
In other words, again, I know what this program looks like; I can remember what line number range handles what functionality, and could probably quote some of the program without looking at it (I did find myself doing some typing from memory, checking that it was right once I'd noticed).
When I tried to paste the program into the emulator, I quickly spotted something that should have been obvious from the start; the TI is slow at responding to the keyboard. Even now, and I'm very used to typing on one now, I still sometimes type too fast when I'm not concentrating on slowing down my typing speed to what it can handle. The problem is a lack of a type-ahead buffer; we get used them on modern PCs, and many 80s computers are either quick enough or able to reproduce that feature. However, the TI is easily distracted, and simply ignores key strokes it was not expecting.
So, when I pasted a chunk of program in, the TI obligingly listened; to most of it. However, the bit it missed isn't so obvious; when the TI is given a new, or replacement program line, it takes a moment to think, to check it looks ok (it might immediately complain about the content) or what to do with it (if it seems ok, at a simplistic glance). As the program grows, and the length or complexity of this next line increases, the processing delay increases.
I decided to duplicate the text I'd typed into notepad (which I'd saved copies of anyway) but make a special derivative; this derivative would have spaces and blank lines added, to give the emulated TI more time to digest each supplied line. After a bit of experimentation, it became clear how much, and where, to add the white-space padding (the blank lines and spaces) so that the program could be inputted by this method.
Most of the padded program lines just had ten extra spaces inserted at their front; as I got later down the program, I started adding more; nearer the end, I needed about 20 spaces.
Before long lines, or just after particularly complicated ones, I inserted a blank line that contained about forty spaces,
but had no preceding spaces on the current line; there is a line length limit that a TI can accept, and some of my program lines were very close to that limit.
The padded version of the program I saved, and kept on hand; I kept the originating program text on hand too, as I thought it might be useful to easily browse a copy of the whole program under Windows using Notepad.
Eventually, I had something I could save (in the emulator) and start testing.
One of the early "bugs" I came across was the "DIP Switch" settings; these settings let you pick the 32K RAM expansion, and so-on. However, my game just fits on a real TI 99/4a, when using TI BASIC; it seems to use every byte. So, unless I turned off everything (and I mean everything) there wasn't enough RAM to make it work under the emulator.
Bug fixing required comparisons between what I could see in the emulator (using LIST) and what I could see on the real TI (again, using LIST). Corrections, however, needed to be to the PC Notepad version of the program, the padded version, then the emulated TI version; in that order.
I even spotted some bugs in the original TI version, now that I could review much more than about twenty lines at a time (under Notepad) but those had to be fixed in the TI version first, then every other place that a version of this program was being, or had been, typed.
I still found that I had made some typing errors. I even (once) confused an oh for a zero in a variable name I should have immediately spotted... but I blame the late nights for that.
But, after only a few bug fixes, it was working, and identical to the real TI 99/4a version, which itself, was lightly improved upon.
Out of curiosity, I had a go at trying to make my game work using TI EXTENDED BASIC (on a real TI). Unfortunately, the loss of the 700 odd bytes (which I now know about) and some other bits and bobs have taught me that I need to create a TI EXTENDED BASIC specific version, so I'm not starting that this month. Though it got me downloading and reading the manual (I didn't get one with my second-hand cart). Which lead to more inspiration on possible TI related game projects.
So, not really a full answer, but lots of detail on what I've tried, and some ways of making typing-it-in easier and more accurate.
When I find out how to get an emulator to correctly, reliably, and accurately read an original audio tape, I'll let you know; I need to know, and I'm frustrated with months of efforts trying to get this to work, and trying workarounds, and trying strange tests to see if I can figure out what's wrong. But I've learned a lot, in the process.