ZX Spectrum Core - Reading Games from Tape

User avatar
NightShadowPT
Posts: 186
Joined: Mon May 25, 2020 9:56 am
Has thanked: 1 time
Been thanked: 7 times

ZX Spectrum Core - Reading Games from Tape

Unread post by NightShadowPT »

Hi all,

As I am waiting for a tape recorder to add to my MiSTer setup, in order to be able to run ZX Spectrum games from cassete, I have tried to load games from my iPhone directly to test the feature.

By trying this, I have faced a weird behavior that I am not sure if it is the fault of the MiSTer, the ZX Core or the iPhone.

Problem is as follows:

By connecting my iPhone directly to the audio input in the MiSTer, I am able to open the you tube video from Pringles that commemorates the ZX Spectrum 40th birthday and the code loads perfectly by the core.

This got me curious if I would be able to load other Spectrum software from other you tube videos.

Most of the ones I have tried, when the data stream starts, I get absolutely no sound on the ZX Spectrum core (as if the cable is not connected, or the sound is muted).
I would understand if the sound is not at the right pitch that the loading would fail, but in this case there is absolutely NO SOUND going through.

I know this can work because I can consistently load the Pringles program, and I have also been able to fully load Chase H.Q. from another video, but with the majority of the videos I have this strange behavior.

I have also tried using Spectaculator for iOS on my phone, and doing the full loading of the games, but the sound looks ok through the speaker, but when I try to connect the cable to the MiSTer I have the same problem.

I am really at a loss here, any ideas what is happening?
akeley
Posts: 860
Joined: Mon May 25, 2020 7:54 pm
Has thanked: 237 times
Been thanked: 228 times

Re: ZX Spectrum Core - Reading Games from Tape

Unread post by akeley »

I don't know about why the assorted utubes/emu sources aren't not working. But for loading tapes from the phone I can recommend this program: https://github.com/semack/zx_tape_player

Generally the problems with phones stem from too low volume and some background stuff interfering with the signal. This might vary between different phone models too. This app is the best from several similar ones out there and works even on my phones which have otherwise failed to load using the other apps. Mind you, I only have tried the Android version on real ZX Spectrum, but I suppose it's worth a shot (they have a Test Flight version for iOS).
User avatar
lister_of_smeg
Posts: 35
Joined: Mon May 25, 2020 3:11 am
Has thanked: 2 times
Been thanked: 17 times

Re: ZX Spectrum Core - Reading Games from Tape

Unread post by lister_of_smeg »

This is most likely caused by there being insufficient amplitude for the ADC to register a 'high' signal level. You'll need to boost the volume as most of those videos on YouTube (from what I've seen) have the volume drastically reduced (presumably so as not to cause viewers' ears to bleed!).

Here's an example of one video I downloaded and loaded into Audacity. As you can see the volume is pretty low.

bJVqfY4.png
bJVqfY4.png (49.39 KiB) Viewed 1070 times
User avatar
NightShadowPT
Posts: 186
Joined: Mon May 25, 2020 9:56 am
Has thanked: 1 time
Been thanked: 7 times

Re: ZX Spectrum Core - Reading Games from Tape

Unread post by NightShadowPT »

akeley wrote: Mon May 09, 2022 10:12 am I don't know about why the assorted utubes/emu sources aren't not working. But for loading tapes from the phone I can recommend this program: https://github.com/semack/zx_tape_player
This looks great. I will give it a try later today. Thanks!
lister_of_smeg wrote: Mon May 09, 2022 10:23 am This is most likely caused by there being insufficient amplitude for the ADC to register a 'high' signal level.
You may be right... I will do some more testing and try to boost the volume.

Just for the record, the following videos load perfectly:
Chase H.Q.
Pringles - ZX Spectrum 40th Birthday

And these didn't work:
Poppey
The Hobbit
Batman
Green Beret

Thanks all for your suggestions.
FPGA64
Posts: 199
Joined: Mon Mar 01, 2021 3:10 pm
Has thanked: 21 times
Been thanked: 56 times

Re: ZX Spectrum Core - Reading Games from Tape

Unread post by FPGA64 »

Amazed any load. The Youtube videos will have compressed lossy sound. The human ear may not hear it but the computer will. Only pure wav files or other lossless formats should be used.

Try

https://github.com/raydac/zxtap-to-wav

using the tasp files to create the wav files
User avatar
lister_of_smeg
Posts: 35
Joined: Mon May 25, 2020 3:11 am
Has thanked: 2 times
Been thanked: 17 times

Re: ZX Spectrum Core - Reading Games from Tape

Unread post by lister_of_smeg »

FPGA64 wrote: Mon May 09, 2022 12:09 pm Amazed any load. The Youtube videos will have compressed lossy sound. The human ear may not hear it but the computer will. Only pure wav files or other lossless formats should be used.
Not in the case of a waveform as simple as FSK modulation. Lossy compression from a clean digital source like TZX at YouTube's typical bitrate is certainly better than a cassette tape can manage.

It may struggle if you're trying to use an extreme turbo loading scheme like OTLA (as the pulse lengths may end up being so short they get discarded by the encoder's low-pass filter), but at the baud rates usually seen BITD it's not a problem.
User avatar
pgimeno
Posts: 444
Joined: Thu Jun 11, 2020 9:44 am
Has thanked: 168 times
Been thanked: 121 times

Re: ZX Spectrum Core - Reading Games from Tape

Unread post by pgimeno »

There's another problem, and that one isn't solvable with amplification. The ADC input of the MiSTer is good for positive voltage measurements, but for audio usage it is seriously flawed. viewtopic.php?t=4145

At least the Popeye video posted has a DC bias that makes it unsuitable for the MiSTer. http://www.formauri.es/personal/pgimeno ... dacity.png

It needs to be centred around zero for the framework to detect the 1's and 0's correctly. Both that issue and the volume issue can be fixed with Audacity using the Normalize filter, but for an actual solution that doesn't involve audio editing, a cable with a resistor works better.
dshadoff
Core Developer
Posts: 455
Joined: Sun May 24, 2020 9:30 pm
Has thanked: 11 times
Been thanked: 104 times

Re: ZX Spectrum Core - Reading Games from Tape

Unread post by dshadoff »

"Flawed" is an exaggeration. It wasn't designed for negative voltages, so in order to "see" the entire waveform the audio hardware which generates the signal needs to have an AC-coupling, as all old audio equipment used to have (and virtually none of the newer digital stuff has). A capacitor placed in series (not across the leads, but in line with one of them) would be sufficient to create this AC coupling. I've used 10uF.

Having said this, some of the cores use a different basis for detecting values - I believe that the Spectrum core may assume that it only sees half of the waveform (I didn't write this one).

You can use the ADCTest core to interactively see what I'm talking about. On the CoCo core, I used AC coupling for my design and all of my tests.
jca
Posts: 1011
Joined: Wed May 27, 2020 1:59 pm
Has thanked: 78 times
Been thanked: 196 times

Re: ZX Spectrum Core - Reading Games from Tape

Unread post by jca »

Could you explain this AC coupling thing?
If you use AC coupling the resulting voltage will be pure AC centered on 0V so you will not "see" the entire waveform but only the positive half.
But you also say "I believe that the Spectrum core may assume that it only sees half of the waveform" so it would be OK.
dshadoff
Core Developer
Posts: 455
Joined: Sun May 24, 2020 9:30 pm
Has thanked: 11 times
Been thanked: 104 times

Re: ZX Spectrum Core - Reading Games from Tape

Unread post by dshadoff »

No, with AC coupling, it will no longer have a fixed connection to the DE10-Nano’s ground, so the incoming signal will be a differential signal, and can ‘float’ (or it can have a fixed bias applied to it). I found that such signals tend to drift toward the center of the range of the ADC, which means that a signal with peak-to-peak values of -0.7 to +0.7 Volts, instead of showing as only the portion above zero, will now be centered at roughly 1.7 to 2.0Volts, and show the entire waveform - for example, 1.3V to 2.7V .

It is still possible to exceed the range limits of the ADC, so be careful not to send too powerful a signal. As I said previously, the ADCTest core will help visualize such things, and I wrote it specifically because using tapes back in the 80’s was always a game where you play with the volume level a lot until you finally got it right. I always wished for a visualization tool back then, to help set the levels properly.
jca
Posts: 1011
Joined: Wed May 27, 2020 1:59 pm
Has thanked: 78 times
Been thanked: 196 times

Re: ZX Spectrum Core - Reading Games from Tape

Unread post by jca »

Thanks for the explanation.
User avatar
pgimeno
Posts: 444
Joined: Thu Jun 11, 2020 9:44 am
Has thanked: 168 times
Been thanked: 121 times

Re: ZX Spectrum Core - Reading Games from Tape

Unread post by pgimeno »

dshadoff wrote: Mon May 09, 2022 2:39 pm "Flawed" is an exaggeration. It wasn't designed for negative voltages, so in order to "see" the entire waveform the audio hardware which generates the signal needs to have an AC-coupling, as all old audio equipment used to have (and virtually none of the newer digital stuff has). A capacitor placed in series (not across the leads, but in line with one of them) would be sufficient to create this AC coupling. I've used 10uF.
With infinite impedance, a coupling capacitor is completely ineffective.

When it *is* effective, it has the effect of centring the wave around zero, that is, it produces positive *and* negative voltages. So, not being designed for negative values is a flaw.

For a coupling capacitor to be effective, the input impedance of the device that it is connected to must be reasonably low. The capacitor and the impedance effectively form a high-pass filter that removes the DC component.

The MiSTer ADC's input impedance is too high; that's another flaw. Coupling capacitors for tape recorders are designed for impedances of earphones, typically 8-32 ohms. The MiSTer ADC's impedance is high, in the order of 100K or 1M. That's about five orders of magnitude off.
dshadoff
Core Developer
Posts: 455
Joined: Sun May 24, 2020 9:30 pm
Has thanked: 11 times
Been thanked: 104 times

Re: ZX Spectrum Core - Reading Games from Tape

Unread post by dshadoff »

I see you still haven’t actually tried it and seen it for yourself.
That’s too bad.
User avatar
pgimeno
Posts: 444
Joined: Thu Jun 11, 2020 9:44 am
Has thanked: 168 times
Been thanked: 121 times

Re: ZX Spectrum Core - Reading Games from Tape

Unread post by pgimeno »

dshadoff wrote: Mon May 09, 2022 4:01 pm No, with AC coupling, it will no longer have a fixed connection to the DE10-Nano’s ground, so the incoming signal will be a differential signal, and can ‘float’ (or it can have a fixed bias applied to it). I found that such signals tend to drift toward the center of the range of the ADC, which means that a signal with peak-to-peak values of -0.7 to +0.7 Volts, instead of showing as only the portion above zero, will now be centered at roughly 1.7 to 2.0Volts, and show the entire waveform - for example, 1.3V to 2.7V .
This is still a problem. For devices with a digital output, like the TZXduino that made me research and find out about the problems of the ADC, silences are not in the middle of the peak-to-peak range; they are either at the high or at the low peak. This causes the coupling capacitor to find a new centre, as it is now constantly on one of the sides. If the capacitor does not charge fast enough, and it won't unless the impedance is low enough, these silences will cause an extra offset in the signal for a while.

It's precisely that extra offset, kept in time for a second or two, the one that prevented Spectrum programs from loading with the TZXduino in my case. I solved it by adding a couple resistors to the cable (but one would have sufficed), to lower the impedance.

Not sure what you mean that I haven't tried and seen by myself. I have seen by myself the problem with digital devices such as the TZXduino.
akeley
Posts: 860
Joined: Mon May 25, 2020 7:54 pm
Has thanked: 237 times
Been thanked: 228 times

Re: ZX Spectrum Core - Reading Games from Tape

Unread post by akeley »

pgimeno wrote: Mon May 09, 2022 8:05 pm I have seen by myself the problem with digital devices such as the TZXduino.
I have no idea if there is a technical problem or not, this is way over my head. But from a normal user standpoint using digital devices is a little bit pointless, really, at least when it comes to the ZX core, and all the others which allow you to load the same tape files from within the core. I guess it'd make sense with cores where ADC is the only option of getting a game into the MiSTer, but I don't remember if there are still cores like that.

Coincidentially, I've just got an ADC today and have been testing it with my Galaxy S4 phone and that app I mentioned earlier. I loaded a few games with 100% success rate ,which is neat...but also a bit silly, when you think about it 8-)
User avatar
pgimeno
Posts: 444
Joined: Thu Jun 11, 2020 9:44 am
Has thanked: 168 times
Been thanked: 121 times

Re: ZX Spectrum Core - Reading Games from Tape

Unread post by pgimeno »

Well, this thread is about someone who wanted to load from YouTube videos, and that's a very respectable goal.

Here's the oscillogram of the start of one of the tapes posted, Pringlesonic, taken directly from the video:
Pringlesonic-first-9-seconds.png
Pringlesonic-first-9-seconds.png (13.48 KiB) Viewed 637 times
That's the first ~10 seconds, showing the leading tone of the header, the header, the silence between header and data, the leading tone of the data, the data, and a silence. The arrows point to the level of the silences.

That level will cause problems in devices with a big coupling capacitor, for the reasons explained, due to the flaw in input impedance of the MiSTer.
dshadoff
Core Developer
Posts: 455
Joined: Sun May 24, 2020 9:30 pm
Has thanked: 11 times
Been thanked: 104 times

Re: ZX Spectrum Core - Reading Games from Tape

Unread post by dshadoff »

I see what you are describing, and you are correct that with just a capacitor it will take about a second or two to drift back to centre.
Electrically, you can cause this to drift back toward centre faster by forcing a load/shunt as you suggest.

However, this is also something which can be accommodated by the core itself so long as it doesn't exceed the ADC's limits (and I do accommodate in the CoCo core) - although again, I can't speak for the Spectrum core.

In the CoCo core (and indeed in the ADCTest core), I maintain an "average value over the past interval" as well as a "maximum offset from average value", where 'interval' is tunable. It is important to keep both limits within the range of the ADC. Since consumer electronics "line level" is generally limited to 0.894V peak-to-peak, this should be easily within the ADC's range.

As volume-level adjustment is important in order to create enough volume to be detectable, but not enough to overload (i.e. "hit the limits" or distort), I have placed handy "red zones" in the ADCTest core when you switch the "Scale" to "Line Level" for volume tuning.

There is more of a write-up at the core's README, and also within the code itself (for anybody who is interested).
https://github.com/MiSTer-devel/ADCTest_MiSTer
User avatar
pgimeno
Posts: 444
Joined: Thu Jun 11, 2020 9:44 am
Has thanked: 168 times
Been thanked: 121 times

Re: ZX Spectrum Core - Reading Games from Tape

Unread post by pgimeno »

I have checked and the capacitor in the TZXduino I have is 10µF (that's precisely the value suggested by dshadoff).

If my calculations are right, the input impedance of the MiSTer's ADC is in the ballpark of 100K ohms.

Here's an approximate simulation done with Audacity, of what the ADC will see with a 10µF coupling capacitor in the Pringlesonic video if no further filters are applied to it:

MiSTer-ADC-simulation.png
MiSTer-ADC-simulation.png (10.13 KiB) Viewed 567 times
The key here is that this core only detects zero crossings. When zooming in, you can see that the signal is actually above zero until past the 7 seconds mark. That will cause the second leading tone to be missed many of the times, which is the problem I was having.

Adding a 2K resistor to the cable will centre the signal around zero instead of centring it around a positive offset, and will make the coupling capacitor act much faster. It will also make the Spectrum core work even at much lower volumes. The disadvantage of that is that when audio is input through the ADC, the negative peaks will be trimmed, resulting in distortion. But if the resistor is in the cable, you can always change to another cable to solve the problem.
dshadoff
Core Developer
Posts: 455
Joined: Sun May 24, 2020 9:30 pm
Has thanked: 11 times
Been thanked: 104 times

Re: ZX Spectrum Core - Reading Games from Tape

Unread post by dshadoff »

And in my description above, "zero" is the running average for a period of time (generally 1/60th of second) on my cores, so it's a sliding scale and easily accommodated for, within the core.

But as I mentioned, I can't speak for the internals specific to the Spectrum core.
User avatar
pgimeno
Posts: 444
Joined: Thu Jun 11, 2020 9:44 am
Has thanked: 168 times
Been thanked: 121 times

Re: ZX Spectrum Core - Reading Games from Tape

Unread post by pgimeno »

dshadoff wrote: Mon May 09, 2022 10:13 pm However, this is also something which can be accommodated by the core itself so long as it doesn't exceed the ADC's limits (and I do accommodate in the CoCo core) - although again, I can't speak for the Spectrum core.
I think this is dependent on the structure of the saved data. The silence between the header block and the data block in the case of the Spectrum is what shifts the centre when the signal is fixed at one of the peaks. If the core accepts a higher input volume as centre, that effect will be much smaller and will probably become negligible. But that's a patch rather than a solution; the solution would be to modify the ADC board to add some circuitry that enables it for general audio usage, by providing a lower impedance and a proper centre.
User avatar
LamerDeluxe
Posts: 688
Joined: Sun May 24, 2020 10:25 pm
Has thanked: 392 times
Been thanked: 129 times

Re: ZX Spectrum Core - Reading Games from Tape

Unread post by LamerDeluxe »

Sounds like an update ADC board would be a good solution to improve reliability. Would that cause trouble elsewhere? Like with SNAC paddle support?
User avatar
pgimeno
Posts: 444
Joined: Thu Jun 11, 2020 9:44 am
Has thanked: 168 times
Been thanked: 121 times

Re: ZX Spectrum Core - Reading Games from Tape

Unread post by pgimeno »

I don't know, but there are spare analogue inputs. One option is to leave the current one untouched and add another one for audio. But I'll leave that up to whoever makes that decision.
dshadoff
Core Developer
Posts: 455
Joined: Sun May 24, 2020 9:30 pm
Has thanked: 11 times
Been thanked: 104 times

Re: ZX Spectrum Core - Reading Games from Tape

Unread post by dshadoff »

By the way, the way your TZXduino is holding the output level at a non-zero level during the gap is actually something that tape recorders of the era could not have done because of their output circuitry. This is a bug in TZXduino. Have you tried an actual cassette player from the pre-digital era ?

To answer the other question, any modifications to the ADC board to allow a rapid ‘return to zero’ would ensure that it could not be used for certain other applications - for example, a paddle input - which would require a DC coupling.
akeley
Posts: 860
Joined: Mon May 25, 2020 7:54 pm
Has thanked: 237 times
Been thanked: 228 times

Re: ZX Spectrum Core - Reading Games from Tape

Unread post by akeley »

I have this Sony tape recorder and have been trying it with ADC since yesterday. I did not manage to fully load a single game. I get the signal and see the stripes , sometimes it even loads for a while, but overall it seems too weak - hardly ever gets the headers. The same recorder works fine on my real Spectrum, with the same cable & tapes. I've also tried it on teh CPC core briefly, and also failed.

Meanwhile, using the phone, I can load anything on the ZX I want on the first attempt. Odd...for some reason I thought it'd be the other way around.
User avatar
pgimeno
Posts: 444
Joined: Thu Jun 11, 2020 9:44 am
Has thanked: 168 times
Been thanked: 121 times

Re: ZX Spectrum Core - Reading Games from Tape

Unread post by pgimeno »

dshadoff wrote: Tue May 10, 2022 1:36 pm By the way, the way your TZXduino is holding the output level at a non-zero level during the gap is actually something that tape recorders of the era could not have done because of their output circuitry. This is a bug in TZXduino. Have you tried an actual cassette player from the pre-digital era ?
Not sure what to answer. The tape player I used with the ZX Spectrum (Panasonic RQ-8100), which I still use, was sold as special for computers, and at maximum volume it outputs 0-5V levels like the TZXduino. This is the player I used in a 286 with a parallel port cable to load programs into my emulator and save snapshots. So in a way it is a cassette player from the era of the Spectrum, but it's not pre-digital. It has a phase inverter; programs only load with the MiSTer with the selector set to one of the phases.

Anyway, here we have the following situation. The TZXduino works with all real computers it supports: MSX, ZX80, ZX81, Spectrum and Acorn Electron (maybe Oric too, I haven't checked), but not with the MiSTer. On the other hand, some cores of the MiSTer work with some tape players but not with others, and not with the TZXduino. Yet you are claiming that the TZXduino has a bug, consisting of assuming that the input impedance of the devices it is designed to connect to are reasonably low. Sorry but I don't buy that.

I've also shown that in one of the videos, the signal is such that if played with certain players (or mobile phones) that have a 10µF coupling capacitor, it won't load on the MiSTer for the same reason as the TZXduino. Are you going to claim that those players/phones also have a bug because they don't work with the MiSTer?

Heck, it's an audio track, it has the correct signals, it has everything right - but the MiSTer won't load it. Whose fault is it, really?

dshadoff wrote: Tue May 10, 2022 1:36 pm To answer the other question, any modifications to the ADC board to allow a rapid ‘return to zero’ would ensure that it could not be used for certain other applications - for example, a paddle input - which would require a DC coupling.
Right - what I was proposing was to make a circuit that uses a different pair of ADCs for audio; the chip has 8 and there are only 2 in use currently, if my understanding is right.

Of course all cores with tape input would need to be adapted and everyone would need to buy new analogue input boards, which is a pain.
dshadoff
Core Developer
Posts: 455
Joined: Sun May 24, 2020 9:30 pm
Has thanked: 11 times
Been thanked: 104 times

Re: ZX Spectrum Core - Reading Games from Tape

Unread post by dshadoff »

pgimeno wrote: Sat May 14, 2022 10:29 pm Yet you are claiming that the TZXduino has a bug, consisting of assuming that the input impedance of the devices it is designed to connect to are reasonably low. Sorry but I don't buy that.
That is not what I am saying - I am saying that the TZXduino, outputing a fixed and unchanging non-zero voltage for several seconds, is doing something that a tape player of the era could not do (and which clearly shows side-effects on your oscilloscope which I am certain are not on tape devices of the era). That is very subsonic, a fraction of a hertz. Input impedance has nothing to do with that.
pgimeno wrote: Sat May 14, 2022 10:29 pm I've also shown that in one of the videos, the signal is such that if played with certain players (or mobile phones) that have a 10µF coupling capacitor, it won't load on the MiSTer for the same reason as the TZXduino. Are you going to claim that those players/phones also have a bug because they don't work with the MiSTer?
And for this one, I am saying that I didn't write the core, so I can't say whether the author intended for it to be driven by a DC-coupled device, whether the input is expecting full-range swings or partial swings, or even whether it was tested at all.

I suppose one relevant question which should be asked to the rest of the community is: "Has anybody got this core to load tapes at all ?" -> And if so, what type of device did you use, what volume level, etc.

What I have been saying all along saying is that, while the ADC has been used for tape input on some cores, it was not intended to be used a replacement for the input circuitry of all possible computers (since all computer had different circuitry) - as well as any other peripheral. Some fairly large portion of this is the role of the core itself - rather, all of the job, providing that the original electrical signal is within the range of the input hardware.

You seem to be getting angry at the hardware when you should be asking about the core itself, and how it processes the input data.
pgimeno wrote: Sat May 14, 2022 10:29 pm Right - what I was proposing was to make a circuit that uses a different pair of ADCs for audio; the chip has 8 and there are only 2 in use currently, if my understanding is right.

Of course all cores with tape input would need to be adapted and everyone would need to buy new analogue input boards, which is a pain.
Well, it is an open-source project, and you are free to create new things. Certainly what you are proposing here could help ameliorate some confusion.
If the solution you design is superior to the existing solution, I'd be happy to modify the core(s) that I have written to accommodate.
User avatar
pgimeno
Posts: 444
Joined: Thu Jun 11, 2020 9:44 am
Has thanked: 168 times
Been thanked: 121 times

Re: ZX Spectrum Core - Reading Games from Tape

Unread post by pgimeno »

akeley wrote: Wed May 11, 2022 6:49 pm I have this Sony tape recorder and have been trying it with ADC since yesterday. I did not manage to fully load a single game. I get the signal and see the stripes , sometimes it even loads for a while, but overall it seems too weak - hardly ever gets the headers. The same recorder works fine on my real Spectrum, with the same cable & tapes. I've also tried it on teh CPC core briefly, and also failed.

Meanwhile, using the phone, I can load anything on the ZX I want on the first attempt. Odd...for some reason I thought it'd be the other way around.
A patch you can try is to add a 1K resistor between the two wires of the cable. Then both will probably work fine.
User avatar
pgimeno
Posts: 444
Joined: Thu Jun 11, 2020 9:44 am
Has thanked: 168 times
Been thanked: 121 times

Re: ZX Spectrum Core - Reading Games from Tape

Unread post by pgimeno »

dshadoff wrote: Sun May 15, 2022 12:21 am That is not what I am saying - I am saying that the TZXduino, outputing a fixed and unchanging non-zero voltage for several seconds, is doing something that a tape player of the era could not do (and which clearly shows side-effects on your oscilloscope which I am certain are not on tape devices of the era). That is very subsonic, a fraction of a hertz. Input impedance has nothing to do with that.
1) My tape is of the era and does that. 2) If you calculate the cutoff frequency for a 10µF capacitor and a 100K resistor (that's the impedance I have estimated for the ADC), you will indeed get a "very subsonic" frequency. The value I get is about 0.16 Hz, and it is a consequence of the 100K impedance. You can keep denying it but it IS due to it.

The coupling capacitor needs a reasonably low input impedance to do its work, because it basically forms a high-pass filter with the device's load resistance which is what eliminates the DC offset. And 100K is not reasonable; the fraction of a hertz cutoff comes from there. Adding a resistor across the cable to lower the impedance and raise the cutoff frequency was how I fixed it and it works fine for this core.

dshadoff wrote: Sun May 15, 2022 12:21 am And for this one, I am saying that I didn't write the core, so I can't say whether the author intended for it to be driven by a DC-coupled device, whether the input is expecting full-range swings or partial swings, or even whether it was tested at all.
This is not in the core; it's in the framework. The core just uses the framework's module with default values. What the framework expects is zero crossings, and as the ADC doesn't support negative values, it measures very close to zero. Given that the ADC can't measure negative voltages, moving the centre to halfway the ADC's dynamic range would work better, and then the framework would need modifications, and the core's framework would need to be updated. But as things are, in order to work with audio the best solution is what the Spectrum core is doing, on the FPGA side, and a resistor across the inputs, on the hardware side.

dshadoff wrote: Sun May 15, 2022 12:21 amI suppose one relevant question which should be asked to the rest of the community is: "Has anybody got this core to load tapes at all ?" -> And if so, what type of device did you use, what volume level, etc.
With what I know, I can anticipate the answer. This core needs a volume high enough that the peaks can go negative, despite the "natural centre" of the ADC being around 1.8V. Therefore it needs a volume exceeding 3.6V peak to peak, probably something around 5V in order to properly trim the edges (incidentally that's what the TZXduino outputs). It also needs the silence to be in the centre of the signal; players with an out-of-centre silence will fail. This will only happen if the recording was made with an input high-pass filter, or if the player itself contains one, or if the tool to create the wave purposely generates the silences at zero.

How these predictions translate to practical loading with real players is a different matter. It will depend on the device. The TZXduino is one for which it causes problems. The tape player that akeley tried is another. My Panasonic RQ-8100 used to load in the real computer whatever the phase I selected, but in the MiSTer it only loads with reverse phase. However, all these devices work in principle with computers of the era. That's because they have an input circuit that is made for audio, while the MiSTer's ADC is not.

dshadoff wrote: Sun May 15, 2022 12:21 am What I have been saying all along saying is that, while the ADC has been used for tape input on some cores, it was not intended to be used a replacement for the input circuitry of all possible computers (since all computer had different circuitry) - as well as any other peripheral. Some fairly large portion of this is the role of the core itself - rather, all of the job, providing that the original electrical signal is within the range of the input hardware.
And what I contend is that the computers with tape input do have a proper input designed for audio, while the MiSTer does not. That makes those computers more tolerant to devices of different characteristics than the MiSTer. And the difference between input circuits doesn't really make any significant difference; at most in the volume necessary to load.

dshadoff wrote: Sun May 15, 2022 12:21 am You seem to be getting angry at the hardware when you should be asking about the core itself, and how it processes the input data.
The core is prepared for zero crossings; that's a reasonable assumption. But the hardware is not prepared for negative values, lacks a proper impedance for audio use, and is centred in a weird value that the core author probably didn't expect. That's why I contend that it's flawed and needs to be fixed (which is not to say that I'm angry).

dshadoff wrote: Sun May 15, 2022 12:21 am Well, it is an open-source project, and you are free to create new things. Certainly what you are proposing here could help ameliorate some confusion.
If the solution you design is superior to the existing solution, I'd be happy to modify the core(s) that I have written to accommodate.
I already have a solution for myself. I can make an alternative design, but I don't have the means to contact the relevant people to propose the change because I left GitHub and that's where things are expected to happen. Also, if you extrapolate from how much opposition I am getting from you, just imagine how fast such a change would "get sorged".
User avatar
NightShadowPT
Posts: 186
Joined: Mon May 25, 2020 9:56 am
Has thanked: 1 time
Been thanked: 7 times

Re: ZX Spectrum Core - Reading Games from Tape

Unread post by NightShadowPT »

Wow... this thread gained a life of it's own :)

Some of it is going over my head, but I'd like to provide an update since I have some additional information:

- Further attempts to upload from Youtube had a similar hit and miss result.
- As recommended on this thread, I have tried ZXTapePlayer on my iPhone and have a near perfect success rate on loading games.
- In the mean time, I have tried a new tape recorder (admittedly one of the sketchy looking ones from Amazon) and didn't have much success with it. The MiSTer can "hear" the tones, but id stops recognizing it very quickly - most times during the loading of the header

I'm not sure if any of the other technical solutions proposed on the thread work, but I am assuming I will not be able to use the Tape recorder unless I make some kind of change to the MiSTer.

Not sure if any of this information is useful, but here it is.

Thanks for your interest in the topic.
User avatar
pgimeno
Posts: 444
Joined: Thu Jun 11, 2020 9:44 am
Has thanked: 168 times
Been thanked: 121 times

Re: ZX Spectrum Core - Reading Games from Tape

Unread post by pgimeno »

NightShadowPT wrote: Thu May 19, 2022 7:38 pm I'm not sure if any of the other technical solutions proposed on the thread work, but I am assuming I will not be able to use the Tape recorder unless I make some kind of change to the MiSTer.
I'd like to clarify this.

You don't need to make a change to the MiSTer. The necessary changes need to be made by the people who maintain the MiSTer hardware, framework and cores. When that happens, you will need to get a tape input board (maybe it will replace the current ADC board, I don't know) and install it, and wait for the cores with tape input to catch up.

That's not likely to happen any time soon. In the meantime, to get more devices to work for the Spectrum core (maybe others too, I'd have to check every case), you can make yourself a cable with a 1K resistor across both wires.
Post Reply