WEBVTT

1
00:00:18.920 --> 00:00:20.280
<v Matt Godbolt>Hey Ben.

2
00:00:20.280 --> 00:00:21.440
<v Ben Rady>Hey Matt.

3
00:00:21.440 --> 00:00:24.000
<v Matt Godbolt>It has been a while, hasn't it?

4
00:00:24.000 --> 00:00:25.010
<v Ben Rady>Been a bit.

5
00:00:25.010 --> 00:00:36.820
<v Matt Godbolt>I mean, not for our listener, obviously. Our listener, it's just been a month. But for us, things... life has overtaken us. A lot of things are going on. We are, in fact, on different continents right now.

6
00:00:36.820 --> 00:00:49.160
<v Matt Godbolt>And I'm looking at my sound levels, in fact, and I'm wondering how awful this is going to sound. So I'm going to just tweak something. But, yeah, I apologize in advance to the poor editor who has to edit this because I am recording...

7
00:00:49.160 --> 00:01:03.700
<v Matt Godbolt>on my laptop from my wife's childhood home in her bedroom where she grew up in Birmingham in the UK, which is not where I was planning on being around this time.

8
00:01:03.700 --> 00:01:03.820
<v Ben Rady>Mm-hmm.

9
00:01:03.820 --> 00:01:09.600
<v Matt Godbolt>But nevertheless, adult things happen and you end up in a different landmass. So that's me.

10
00:01:09.600 --> 00:01:09.740
<v Ben Rady>Right.

11
00:01:09.740 --> 00:01:23.540
<v Matt Godbolt>So apologies for the sound. And I still haven't actually changed it. Let me just do that now. OK. Now I'm going to start clipping and... let's see what that does. That looks... that looks better. No, maybe I am clipping now. I got excited. All right.

12
00:01:23.540 --> 00:01:32.690
<v Matt Godbolt>This, my... this, dear listener, is going to be a heavily not edited at all podcast because Ben and I just need to record something so that you've got something to listen to.

13
00:01:32.690 --> 00:01:33.100
<v Ben Rady>Yeah.

14
00:01:33.100 --> 00:02:02.800
<v Matt Godbolt>Yeah. I met a number of people claiming to be our single listener at a conference recently, which was lovely. So shout out to the many single listeners that we had there. That was good to hear. It's always nice to get feedback. I mean, like, it's a funny thing that we do, right? We just chat, talk to each other. Apparently people listen to this, which is on them, in fairness. They don't have to. We're not making them.

15
00:02:02.800 --> 00:02:02.830
<v Ben Rady>Okay.

16
00:02:02.830 --> 00:02:03.060
<v Ben Rady>Yeah. Yeah.

17
00:02:03.060 --> 00:02:05.560
<v Ben Rady>It's amazing. I don't understand it.

18
00:02:05.560 --> 00:02:17.950
<v Matt Godbolt>So here we are. Yeah, we have no idea, as is normal, as is usual. But I've been doing some cool things that I would have just talked to you about because normally we would do this down the pub.

19
00:02:17.950 --> 00:02:18.050
<v Ben Rady>Right.

20
00:02:18.050 --> 00:02:18.160
<v Ben Rady>Yeah.

21
00:02:18.160 --> 00:02:19.820
<v Matt Godbolt>But again, due to 4,000 miles between us, this is...

22
00:02:19.820 --> 00:02:27.520
<v Ben Rady>Yeah. I haven't actually heard about any of this stuff, so it's not going to be... Yeah, I'm genuinely interested because I have not talked to you in a long time.

23
00:02:27.520 --> 00:02:28.160
<v Matt Godbolt>the first time. So you know that I...

24
00:02:28.160 --> 00:02:33.700
<v Ben Rady>Due to the aforementioned time dilation created by you going across the Atlantic Ocean that is stretched out.

25
00:02:33.700 --> 00:02:34.480
<v Matt Godbolt>Is that what it is?

26
00:02:34.480 --> 00:02:35.720
<v Ben Rady>Yes.

27
00:02:35.720 --> 00:02:43.700
<v Matt Godbolt>That... it does make me wonder, because it does feel like we're in like the 1950s here in the UK, because they haven't got air conditioning and it is very, very, very hot.

28
00:02:43.700 --> 00:02:43.980
<v Ben Rady>Uh-huh.

29
00:02:43.980 --> 00:02:45.100
<v Ben Rady>Right. Right. That's...

30
00:02:45.100 --> 00:02:46.420
<v Matt Godbolt>Someone should tell them about this new technology.

31
00:02:46.420 --> 00:02:47.700
<v Ben Rady>Yeah.

32
00:02:47.700 --> 00:03:00.160
<v Matt Godbolt>Oh, and they will not let me back in the country. Yeah. So one of the things that I got really excited about, well, you know, I love emulators. That's my thing. When I'm not forcing compilers to do things they shouldn't do, I am...

33
00:03:00.160 --> 00:03:08.930
<v Matt Godbolt>emulating my childhood. And the thing that has really annoyed me all the time is that monitors are too crisp.

34
00:03:08.930 --> 00:03:09.710
<v Ben Rady>Yep.

35
00:03:09.710 --> 00:03:10.500
<v Ben Rady>Yep.

36
00:03:10.500 --> 00:03:23.800
<v Matt Godbolt>I mean, we've talked about this before in a podcast, but like, you know, my very first computer, the first computer I programmed on was plugged into a portable color television, you know, full CRT bulbous screen,

37
00:03:23.800 --> 00:03:24.110
<v Ben Rady>Yeah.

38
00:03:24.110 --> 00:03:24.740
<v Ben Rady>Yeah. Right.

39
00:03:24.740 --> 00:03:25.340
<v Ben Rady>Right.

40
00:03:25.340 --> 00:03:35.580
<v Matt Godbolt>like analog push buttons, like when radio buttons were actual, the buttons you had on radios with a physical mechanism, you press one and the others pop out, you know, right.

41
00:03:35.580 --> 00:03:36.120
<v Ben Rady>Right, right, right. Yeah.

42
00:03:36.120 --> 00:03:46.780
<v Matt Godbolt>And then behind that was a tiny little thing you would tune to get it to the right channel. And then your, so your computer that you plugged in had to pretend to be a TV station, right?

43
00:03:46.780 --> 00:03:47.620
<v Ben Rady>Right.

44
00:03:47.620 --> 00:03:58.090
<v Matt Godbolt>It would generate radio frequency of PAL or NTSC at some frequency. You tune it into channel 36 in the UK or channel...

45
00:03:58.090 --> 00:04:01.840
<v Ben Rady>Yeah, it was like three or four, I think. Yeah, three or four, something like that.

46
00:04:01.840 --> 00:04:02.180
<v Matt Godbolt>Yeah. In the US, right.

47
00:04:02.180 --> 00:04:02.860
<v Ben Rady>Right.

48
00:04:02.860 --> 00:04:06.960
<v Matt Godbolt>And the TV didn't know that it wasn't actually plugged into an aerial listening to something off the...

49
00:04:06.960 --> 00:04:07.980
<v Ben Rady>Right.

50
00:04:07.980 --> 00:04:38.690
<v Matt Godbolt>But what that meant was, you know, not only was the CRT... not a perfect device. It's a very, very analog device that involves phosphors and things that... don't instantly light up and instantly fade away, which is part of their charm. But the picture quality was rubbish because you had to squirt color information down a single line. And it wasn't even like you could use a digital encoding, because this stuff had to work on like 1950s

51
00:04:38.690 --> 00:04:41.520
<v Matt Godbolt>analog components when color TV was invented.

52
00:04:41.520 --> 00:04:41.920
<v Ben Rady>Right.

53
00:04:41.920 --> 00:04:50.810
<v Matt Godbolt>It's like the worst of all worlds. But it's really, really nostalgic to see the terrible picture quality that came from it.

54
00:04:50.810 --> 00:04:58.480
<v Ben Rady>Right.

55
00:04:58.480 --> 00:05:04.960
<v Matt Godbolt>And people would use this, right? There were tricks you could do to make colors look more blended and in some cases to achieve extra effects on a real TV that you won't get on an emulator.

56
00:05:04.960 --> 00:05:05.970
<v Matt Godbolt>Anyway, this was annoying me.

57
00:05:05.970 --> 00:05:07.160
<v Ben Rady>Mm-hmm.

58
00:05:07.160 --> 00:05:42.300
<v Matt Godbolt>So I thought, right, sod it. I'm going to learn how this stuff works and I'm going to make my emulator faithfully reproduce all of the things, warts and all. And so I did one pass of this and it's a... it's kind of a fudge. It's like, yeah, we need to blur it a little bit. We need to do some of these effects. But it was like, no, this is not a first principles simulation of what's going on. So I thought I'm going to go deep rather than start by like just synthesizing the picture quality and that kind of stuff. Why don't I learn how to do it? How do I learn to be a TV person?

59
00:05:42.300 --> 00:06:06.980
<v Matt Godbolt>I want to take a real BBC Micro or Sega Master System. I'm going to plug it into my computer. I'm going to use a software defined radio, which lets me decode radio frequency signals into essentially a stream of ones and zeros that I can read fast. And then I'm going to software decode that thing back into a color picture.

60
00:06:06.980 --> 00:06:34.320
<v Matt Godbolt>And that's going to teach me everything I know about how the heck this works. And then I'm going to look at each bit of the code and kind of go, which things are available... What parts of that could I have done using analog electronics back in the day? Which things are like DSP tricks that you would only have had in high-end televisions and stuff like that? And now I can actually pluggably make a TV and say, I want a 1990s era

61
00:06:34.320 --> 00:06:51.330
<v Matt Godbolt>type display, or I want... no, I want the actual 1984 Thorn TV that I had in my bedroom, which I have a photograph of, and I found... and I've got the manuals for, and I'm going to try and find an actual real one so I can do some real sampling. But you know, that's... it's been a journey, my friend. What do you want to know?

62
00:06:51.330 --> 00:06:51.740
<v Ben Rady>Wow.

63
00:06:51.740 --> 00:07:02.310
<v Ben Rady>Wow. Well, so, okay. So just to clarify exactly what you're saying here is you didn't have enough emulator in your emulator. So you added another layer of emulation on top of your emulator.

64
00:07:02.310 --> 00:07:04.820
<v Ben Rady>So you have two layers of emulation.

65
00:07:04.820 --> 00:07:14.950
<v Matt Godbolt>In fairness, I haven't put this into the emulator yet. There's a version in the emulator, but this is purely learning about the decoding. What I hadn't registered really is there's kind of two parts to the whole thing.

66
00:07:14.950 --> 00:07:15.300
<v Ben Rady>Yeah.

67
00:07:15.300 --> 00:07:25.160
<v Matt Godbolt>One is the RGB that is actually being generated by the computer, right? There is obviously RGB at some point.

68
00:07:25.160 --> 00:07:25.740
<v Ben Rady>Mm-hmm.

69
00:07:25.740 --> 00:07:31.760
<v Matt Godbolt>With the exception of NESes, which is a whole other story, and we don't have time for that, but like there is RGB, and then it goes through encoding.

70
00:07:31.760 --> 00:07:31.760
<v Ben Rady>Yeah.

71
00:07:31.760 --> 00:07:40.520
<v Matt Godbolt>And then the BBC Micro's output encoding circuitry would differ from the ZX Spectrum's one, from the Sega Master System.

72
00:07:40.520 --> 00:07:52.300
<v Matt Godbolt>I'm sure all of the systems would come up with their own compromises about what's cheap to do or appropriate to do, to generate the signal. Then they would go through RF modulation, which adds a whole other thing in.

73
00:07:52.300 --> 00:08:06.960
<v Matt Godbolt>They may or may not mix in the audio, because the audio is in there as well. And then they would send it off to the TV, right? So there's stage one is how does the output stage generate the RF signal that's coming out. And then stage two is which type of TV have you plugged it into?

74
00:08:06.960 --> 00:08:18.560
<v Matt Godbolt>Is it a modern one? Is it a cheap and nasty color TV? Is it one of those ones where, you know, effectively over time, the heat of your... this is what I had with my friend Richard, we would go around his house.

75
00:08:18.560 --> 00:08:30.260
<v Matt Godbolt>And after a lot of programming, the screen would start getting worse and worse and start shimmering. And we realized that, oh, you'd have to retune the TV as everything had gotten hot. And so all these analog components had gone out of lock effectively.

76
00:08:30.260 --> 00:08:33.210
<v Matt Godbolt>And there was no... so it's...

77
00:08:33.210 --> 00:08:34.080
<v Ben Rady>Yeah.

78
00:08:34.080 --> 00:08:46.100
<v Matt Godbolt>Honestly, it's an amazing thing. And yeah, there's just so many layers. I've learned so much about how SDRs work, about how fast you have to sample stuff. Essentially, it's like an ADC.

79
00:08:46.100 --> 00:08:49.280
<v Matt Godbolt>So it's like a sampler, an audio sampler, right?

80
00:08:49.280 --> 00:08:50.180
<v Ben Rady>Right. Yeah, yeah, yeah.

81
00:08:50.180 --> 00:08:55.740
<v Matt Godbolt>But not running at 44 kilohertz or 64 kilohertz. It's running at 32 megahertz.

82
00:08:55.740 --> 00:09:24.320
<v Matt Godbolt>So it's 32 million samples a second, which is not totally unreasonable. It's fine. But the RF that we're looking at is a signal that varies and wiggles around a frequency that's like 400 megahertz or 300, 200 megahertz or something like that. So there's a kind of an analog trick for bringing down the signal from that really high domain down to a lower domain that you could then sample.

83
00:09:24.320 --> 00:09:24.420
<v Ben Rady>Right.

84
00:09:24.420 --> 00:09:25.140
<v Matt Godbolt>And how musical are you, Ben?

85
00:09:25.140 --> 00:09:33.720
<v Ben Rady>You know, not particularly. And it's also possible that our listener is also not. So, you know, over-explaining is probably a good thing here.

86
00:09:33.720 --> 00:09:47.320
<v Matt Godbolt>Right, that's fair. But right, so have you ever, you know when something is slightly out of tune, if you heard two notes that were slightly out of tune, they were both trying to be the same pitch.

87
00:09:47.320 --> 00:09:54.120
<v Matt Godbolt>And so like, an A is 440 hertz, right? And now... yeah, I can't tell it's an A, right?

88
00:09:54.120 --> 00:09:54.840
<v Ben Rady>Okay, yeah.

89
00:09:54.840 --> 00:10:00.800
<v Matt Godbolt>I haven't got perfect pitch. But if it's... and then I also... someone played a 441 hertz sound,

90
00:10:00.800 --> 00:10:01.260
<v Ben Rady>Right.

91
00:10:01.260 --> 00:10:10.220
<v Matt Godbolt>I wouldn't be able to hear the difference. But if you played the two together, there's that horrible wobbling, whoa, whoa, whoa, whoa kind of thing that happens when they grate against each other.

92
00:10:10.220 --> 00:10:10.300
<v Ben Rady>Yeah. Yeah.

93
00:10:10.300 --> 00:10:16.580
<v Matt Godbolt>It's a crunchy, horrible thing when something is nearly in tune, but it isn't in tune, right?

94
00:10:16.580 --> 00:10:17.980
<v Ben Rady>Mm-hmm. Mm-hmm.

95
00:10:17.980 --> 00:10:27.900
<v Matt Godbolt>That, the frequency of the whoa, whoa, whoa of the two, beating and grating against each other, is the difference of the two frequencies.

96
00:10:27.900 --> 00:10:32.490
<v Matt Godbolt>So 440 and 441 would give you a once a second wobbling sound.

97
00:10:32.490 --> 00:10:32.820
<v Ben Rady>Okay, yeah, that makes sense.

98
00:10:32.820 --> 00:10:33.920
<v Ben Rady>Right, right.

99
00:10:33.920 --> 00:10:43.920
<v Matt Godbolt>So the trick, and anyone who knows about this for real, who's like done electronic engineering or whatever, is like screaming at their speakers right now, this is not a trick.

100
00:10:43.920 --> 00:10:44.080
<v Ben Rady>Mm-hmm. I know.

101
00:10:44.080 --> 00:10:59.670
<v Matt Godbolt>This is like just how it's done. But like the trick to me is, what you do is you play the two frequencies... when you want to tune to, say, 200 megahertz, you generate a local 200 megahertz signal using just your own oscillator.

102
00:10:59.670 --> 00:11:00.320
<v Ben Rady>Okay.

103
00:11:00.320 --> 00:11:23.840
<v Matt Godbolt>And you play that again at the same time. You multiply them. You mix them together. You multiply them in this instance. But like, go with me in this, my music analogy, right? And the result is, yes, you hear both of those tunes, but they're so high-pitched and high-frequency that they're then beyond what you can sample with your sampler. But the difference between them, the wobbling around, is much lower frequency. It's the difference of their frequencies.

104
00:11:23.840 --> 00:11:24.830
<v Ben Rady>Okay.

105
00:11:24.830 --> 00:11:42.180
<v Matt Godbolt>And so now you get a signal that is around about plus or minus, you know, however wide the various frequencies might be. And so by playing a 200 megahertz tone and multiplying that with whatever noise is happening off the radio,

106
00:11:42.180 --> 00:11:42.700
<v Ben Rady>Okay.

107
00:11:42.700 --> 00:11:55.520
<v Matt Godbolt>I can then sample that at, say, 32 megasamples a second. And what I've got is essentially a plus or minus, sort of, Nyquist limit is half of that, 16 megahertz around the 200 megahertz window.

108
00:11:55.520 --> 00:12:01.300
<v Matt Godbolt>So I can get from minus, because it's the same, you can't tell if it's one hertz above or one hertz below.

109
00:12:01.300 --> 00:12:01.840
<v Ben Rady>Okay.

110
00:12:01.840 --> 00:12:14.000
<v Matt Godbolt>They both beat at once a second. So you get both the signals that are from like 200 to 216 and down to 184, whatever that... Right.

111
00:12:14.000 --> 00:12:14.050
<v Ben Rady>Okay.

112
00:12:14.050 --> 00:12:14.320
<v Matt Godbolt>But, and that's the band.

113
00:12:14.320 --> 00:12:21.640
<v Ben Rady>And this is all to like bring these frequencies down into a range where you can sample them at the rate that you're able to sample them with the hardware that you have?

114
00:12:21.640 --> 00:12:27.160
<v Matt Godbolt>Exactly. Without getting all those sort of like pointless noise of like lower frequency things that you don't care about.

115
00:12:27.160 --> 00:12:28.020
<v Ben Rady>Okay.

116
00:12:28.020 --> 00:12:40.520
<v Matt Godbolt>And then there's some other tricks that you have to do because, you know, again, you can't discriminate between something that's one hertz higher from what's only one hertz lower. And there's a trick. Maybe we want... if we talk about every trick here, we're going to be here for three hours.

117
00:12:40.520 --> 00:12:40.540
<v Matt Godbolt>So I'm...

118
00:12:40.540 --> 00:12:49.240
<v Ben Rady>And then the thing that's melting my brain here is that it's like, you know, you talk about this with audio and I can kind of like think about it, but it's like, this is television, right?

119
00:12:49.240 --> 00:12:49.900
<v Matt Godbolt>Correct. Yes.

120
00:12:49.900 --> 00:13:02.100
<v Ben Rady>So it's like, you know, it's not just audio. In fact, it's not even primarily audio. It's the signal that you're using to, you know, bend this, you know, electron ray, whatever the heck it is.

121
00:13:02.100 --> 00:13:03.760
<v Matt Godbolt>Electron beam that's flashing back and forth.

122
00:13:03.760 --> 00:13:03.760
<v Ben Rady>That's... yeah.

123
00:13:03.760 --> 00:13:04.420
<v Matt Godbolt>Exactly.

124
00:13:04.420 --> 00:13:04.680
<v Ben Rady>Right.

125
00:13:04.680 --> 00:13:06.720
<v Matt Godbolt>And again, and it all had to be done in analog.

126
00:13:06.720 --> 00:13:06.860
<v Ben Rady>Right.

127
00:13:06.860 --> 00:13:18.360
<v Matt Godbolt>So you know this first stage I just described, you could imagine some kind of magical thing that oscillates. You get it tuning. When you're tuning the television, what you're really doing is tuning that oscillator to a frequency... that there's more...

128
00:13:18.360 --> 00:13:31.720
<v Matt Godbolt>There's a middle stage. There's an intermediate frequency and stuff like that. But like for the purposes of this conversation, you're tuning an oscillator. And then the difference between the oscillator you tuned and the signal that's just got, of course, every TV station mixed into it will...

129
00:13:31.720 --> 00:14:07.620
<v Matt Godbolt>will give you, will center it around the thing that you care about. And then if you filter the stuff that's higher and lower frequency, now you've just got your TV tune. But yeah, now you've got like another layer of encoding. So think about it as encoding. Now you've probably talked about, and I'm going to say a word that you're going to say a different way to me. And I don't know if it's a me thing or a UK thing, US thing. So the not-RF signal that you would plug in, the yellow lead on your old consoles where you didn't have the audio in, you would have like three leads, you'd have left and right audio, which would be red and white.

130
00:14:07.620 --> 00:14:07.880
<v Ben Rady>Yeah.

131
00:14:07.880 --> 00:14:08.140
<v Ben Rady>Yeah.

132
00:14:08.140 --> 00:14:10.030
<v Matt Godbolt>And then the yellow lead, which would be the video.

133
00:14:10.030 --> 00:14:10.440
<v Ben Rady>Yeah.

134
00:14:10.440 --> 00:14:13.150
<v Matt Godbolt>Well, that will be what kind of video?

135
00:14:13.150 --> 00:14:22.060
<v Ben Rady>Oh, I don't know. RF video. I mean, but yeah, I always think of it as like, you've got component and comPOSite and... okay.

136
00:14:22.060 --> 00:14:26.630
<v Matt Godbolt>COMposite is the word I was looking for there. Yes. So yes, I would say COMposite.

137
00:14:26.630 --> 00:14:27.210
<v Ben Rady>Yeah. Oh, okay.

138
00:14:27.210 --> 00:14:37.370
<v Matt Godbolt>I don't know if it's just a thing that I say. So, you know, our listener can have a think. But yes, so effectively there are like several layers of encoding.

139
00:14:37.370 --> 00:14:37.760
<v Ben Rady>Yeah.

140
00:14:37.760 --> 00:14:47.820
<v Matt Godbolt>The first thing is we're going to make something RF so we could transmit it over the... what, the waves, the airwaves, right? The composite is too low frequency and everyone would pick the same one.

141
00:14:47.820 --> 00:14:57.280
<v Matt Godbolt>So obviously every channel has its own. But in there are two things, right? One is the composite video, which is itself composed of more things, which we'll get to.

142
00:14:57.280 --> 00:14:57.620
<v Ben Rady>Mm-hmm.

143
00:14:57.620 --> 00:15:08.580
<v Matt Godbolt>And then there's essentially like an FM radio signal that is the audio that is just on the edge of the video signal, either side of it, the way that it works out. And I'm a bit vague on this bit because I haven't got to that yet.

144
00:15:08.580 --> 00:15:18.780
<v Matt Godbolt>But you can imagine, yeah, given the amount of spectrum that you're allowed to use, the bandwidth of radio range, you would kind of fiddle it around and say, okay, the FM lives in this part of it.

145
00:15:18.780 --> 00:15:18.800
<v Ben Rady>Mm-hmm.

146
00:15:18.800 --> 00:15:50.940
<v Matt Godbolt>And then the middle part is all this. And the much wider part, for what it's worth, is the TV signal, which is itself composed of several things, right? Red, green, blue, synchronization pulses, like this is the top of the screen. This is a new line, right? Now in our... you and me, these are packets. These are like binary encoding and you go like, how about the start frame, you know, whatever. But like, this is... it can't be the case, because we're talking analog era electronics.

147
00:15:50.940 --> 00:16:07.500
<v Matt Godbolt>And so first of all, the first trick is that it's amplitude modulated onto the carrier. So there is the carrier, you know, the 200 megahertz that I mentioned before, is just a wiggling 200 megahertz signal.

148
00:16:07.500 --> 00:16:08.280
<v Ben Rady>Yeah. Yeah.

149
00:16:08.280 --> 00:16:12.300
<v Matt Godbolt>And we just turn the volume of that up and down like old AM radio, right?

150
00:16:12.300 --> 00:16:12.640
<v Ben Rady>Yeah. Right.

151
00:16:12.640 --> 00:16:20.940
<v Matt Godbolt>Forget frequency modulation. We're not modulating the frequency. But by flapping the amplitude up and down fast enough, we are actually using frequencies around it.

152
00:16:20.940 --> 00:16:21.280
<v Ben Rady>Right.

153
00:16:21.280 --> 00:16:26.240
<v Matt Godbolt>If you were to put it through a spectrum analyzer, you see that you get this bandwidth just because of the way it...

154
00:16:26.240 --> 00:16:36.630
<v Ben Rady>OK, so just to reiterate some of this back to make sure I understand what's going on here. You've got, because it's television, you have this limited frequency in which you're allowed to use for your signal, right?

155
00:16:36.630 --> 00:16:36.710
<v Matt Godbolt>Yeah.

156
00:16:36.710 --> 00:16:36.800
<v Matt Godbolt>Yeah.

157
00:16:36.800 --> 00:16:37.320
<v Matt Godbolt>Correct.

158
00:16:37.320 --> 00:16:50.280
<v Ben Rady>You're going to slice off some of that for the audio. You're going to slice off some of that for, you know, both channels of the audio. You're going to slice off some of that for the video. And then within that frequency, you're actually encoding the signal in the amplitude of the waves in that frequency.

159
00:16:50.280 --> 00:16:53.390
<v Matt Godbolt>Correct, by modulating the up and down of that.

160
00:16:53.390 --> 00:16:53.660
<v Ben Rady>Have I got that right?

161
00:16:53.660 --> 00:16:54.430
<v Matt Godbolt>Yeah, yeah.

162
00:16:54.430 --> 00:16:55.040
<v Ben Rady>Yeah. OK.

163
00:16:55.040 --> 00:17:07.290
<v Matt Godbolt>And so the way that it's done is that a black picture is the brightest. So it's inverted, right? So a totally black screen would be just the normal

164
00:17:07.290 --> 00:17:08.020
<v Ben Rady>OK.

165
00:17:08.020 --> 00:17:15.300
<v Matt Godbolt>full amplitude... the RF signal.

166
00:17:15.300 --> 00:17:15.660
<v Ben Rady>Yeah.

167
00:17:15.660 --> 00:17:16.020
<v Ben Rady>Right.

168
00:17:16.020 --> 00:17:24.200
<v Matt Godbolt>And this is also true, incidentally... Yeah, no, sorry, I'm confusing myself here. Right, forget... Go ahead.

169
00:17:24.200 --> 00:17:27.040
<v Ben Rady>Is that true for the audio, too? This seems counterintuitive.

170
00:17:27.040 --> 00:17:33.280
<v Matt Godbolt>I don't... I don't think so. The audio is separate from this. At this point, we've left the audio behind. It's been filtered off.

171
00:17:33.280 --> 00:17:33.440
<v Ben Rady>OK.

172
00:17:33.440 --> 00:17:36.340
<v Matt Godbolt>It goes into audio circuitry, and I haven't looked at that too much.

173
00:17:36.340 --> 00:17:47.250
<v Matt Godbolt>But yeah, we've got this amplitude modulated thing where we want to extract from that essentially a single continuous analog signal from this wiggling thing.

174
00:17:47.250 --> 00:17:47.400
<v Ben Rady>Okay.

175
00:17:47.400 --> 00:17:47.700
<v Ben Rady>Okay. Okay.

176
00:17:47.700 --> 00:17:59.280
<v Matt Godbolt>And the way that we do that is we treat the... Actually, I'm not sure what the circuitry does at this point, but we're looking for the amplitude. So let's just ignore the fact that it's wiggling anymore and just say it's the amplitude of this.

177
00:17:59.280 --> 00:18:09.780
<v Matt Godbolt>We've got a thing that comes out. And now the amplitude is inverted such that the darkest picture is bright, the loudest, and the brightest picture would be almost no signal.

178
00:18:09.780 --> 00:18:13.220
<v Matt Godbolt>It never goes completely zero, because then you don't have anything to lock onto.

179
00:18:13.220 --> 00:18:13.520
<v Ben Rady>Yeah. Yeah.

180
00:18:13.520 --> 00:18:39.320
<v Matt Godbolt>But it's there. So we've got a range now. We've got a range of, say, voltages. And... It's unimportant that it's inverted, other than like the very dark signal is always there. So even if the picture's black, you can tune into the stupid thing and actually know that you've picked up a black picture, right? So from now on... quickly, early on, you invert it the other way around. So it looks sane to humans where, you know, bright is high and dark is low. Let's go with that, right?

181
00:18:39.320 --> 00:18:39.700
<v Ben Rady>Yeah.

182
00:18:39.700 --> 00:18:42.520
<v Matt Godbolt>You with me so far? Because, yeah... the first thing is we invert it.

183
00:18:42.520 --> 00:18:46.820
<v Ben Rady>Yeah. Is this why television static is mostly white?

184
00:18:46.820 --> 00:18:51.880
<v Matt Godbolt>It is... we'll get to that actually. That's good, hold that thought, my friend, because this is the cool bit, right?

185
00:18:51.880 --> 00:18:52.880
<v Ben Rady>Okay. All right. All right.

186
00:18:52.880 --> 00:19:05.420
<v Matt Godbolt>So yes, we've got this, let's just say goes between zero and one volt, right? Where white is... one volt is bright white and zero would be black, except what we're gonna do is we're gonna say, no, no, no. We need a way of signaling the synchronization pulses.

187
00:19:05.420 --> 00:19:22.680
<v Matt Godbolt>We need to say, this is the beginning of the screen. And we need to say, this is the beginning of a line, because what's happening behind the scenes is that there is... we want to synchronize the electromagnets in the TV with this picture so that they start at the top of the screen, they slowly go down and more quickly, they flip from left to right.

188
00:19:22.680 --> 00:19:23.260
<v Ben Rady>Mm-hmm. Mm-hmm.

189
00:19:23.260 --> 00:19:31.560
<v Matt Godbolt>And we wanna make sure that everything's synchronized. Otherwise the picture rolls or it's diagonally skewed because the rows aren't aligned, right?

190
00:19:31.560 --> 00:19:32.040
<v Ben Rady>Yeah.

191
00:19:32.040 --> 00:19:42.860
<v Matt Godbolt>But we need a way of saying, this is a big... this is like, we sort of out of band. And so the out of band is lower than black. It's like we go... we say, right, black is actually gonna be 0.3 volts.

192
00:19:42.860 --> 00:20:17.360
<v Matt Godbolt>And anything below 0.3 volts is like blacker than black, and it's actually a signal. It's like, a thing is happening. It's our sort of out-of-band signal, because we know also that while we're between lines and while we're pulling the beam from the bottom to the top, we actually don't want to paint anything to the screen. Otherwise, you'd start seeing splurge as the light... as the beam retraces its steps, right? And you get pictures being overwritten with crap. So we want it to be low and we might as well just say, well, when it goes really low, that's a signal to you.

193
00:20:17.360 --> 00:20:17.900
<v Ben Rady>Okay.

194
00:20:17.900 --> 00:20:19.640
<v Matt Godbolt>Good so far?

195
00:20:19.640 --> 00:20:27.800
<v Ben Rady>So you said blacker than black, like the amplitude... as the amplitude decreases, that is our range of signal, right?

196
00:20:27.800 --> 00:20:33.790
<v Matt Godbolt>Yes. So we've got effectively between like 0.3 and one volt is the normal black to white.

197
00:20:33.790 --> 00:20:35.040
<v Ben Rady>Okay.

198
00:20:35.040 --> 00:20:39.200
<v Matt Godbolt>And then below, we're already talking... yeah, sorry, I've already inverted it so that it makes sane.

199
00:20:39.200 --> 00:20:39.860
<v Ben Rady>So you've... we've already talked about it being flipped at this point. Got it.

200
00:20:39.860 --> 00:20:40.890
<v Matt Godbolt>Yeah, yeah, yeah, yeah.

201
00:20:40.890 --> 00:20:40.990
<v Ben Rady>Yeah, yeah, yeah, yeah.

202
00:20:40.990 --> 00:20:41.160
<v Matt Godbolt>I'm sorry about that, yeah.

203
00:20:41.160 --> 00:20:42.800
<v Ben Rady>No, that makes sense. I'm back with you again.

204
00:20:42.800 --> 00:21:07.720
<v Matt Godbolt>Okay, yeah, I did do a bait-and-switch, changed my sort of... there, because it's just easier to think of it the right way up, right, the way you would want to see it, right, the way that it actually gets transmitted when you're using a composite cable. Because effectively by the time we have taken it away from being this amplitude modulated signal to just a signal between zero and one volts and turned it the right way up so that it makes sense, where now that's what you would get out of your composite cable.

205
00:21:07.720 --> 00:21:08.610
<v Ben Rady>Right, yes. Right, right.

206
00:21:08.610 --> 00:21:08.840
<v Ben Rady>Yeah.

207
00:21:08.840 --> 00:21:09.280
<v Ben Rady>Yeah.

208
00:21:09.280 --> 00:21:09.880
<v Ben Rady>OK, got it.

209
00:21:09.880 --> 00:21:20.060
<v Matt Godbolt>Right. So no audio, no weird wiggling, just pure something you could put into an oscilloscope directly and go, oh, I can see what that's doing, as opposed to just a mass of wiggly lines.

210
00:21:20.060 --> 00:21:20.560
<v Ben Rady>Right.

211
00:21:20.560 --> 00:21:21.110
<v Ben Rady>Yeah. Yeah.

212
00:21:21.110 --> 00:21:22.210
<v Matt Godbolt>Right. And I forget...

213
00:21:22.210 --> 00:21:22.480
<v Ben Rady>Right.

214
00:21:22.480 --> 00:21:27.100
<v Matt Godbolt>So TVs used to be black and white. You probably remember this.

215
00:21:27.100 --> 00:21:30.500
<v Ben Rady>I don't know. Actually, that's not true. I did actually own a black and white TV.

216
00:21:30.500 --> 00:21:35.540
<v Matt Godbolt>You're younger than me. I never... I think we had one black and white TV, but it was in my nan's house.

217
00:21:35.540 --> 00:21:37.620
<v Ben Rady>Yeah. We had a cheap one that was black and white. That was like an extra one.

218
00:21:37.620 --> 00:21:50.540
<v Matt Godbolt>But yeah, so the trick is that whatever we do to get color into our signal had to be, back in the 40s and 50s, whenever it was color was, had to be backwards compatible in the worst possible way.

219
00:21:50.540 --> 00:21:50.540
<v Ben Rady>Yeah.

220
00:21:50.540 --> 00:21:50.540
<v Ben Rady>Mm-hmm.

221
00:21:50.540 --> 00:21:59.360
<v Matt Godbolt>Like they couldn't squeeze three copies. They couldn't go, oh, this is now red and this is now green and this is blue, because your black and white TV would be like, well, it's just... I only show what red is, or something like that.

222
00:21:59.360 --> 00:21:59.550
<v Ben Rady>Right, right.

223
00:21:59.550 --> 00:21:59.740
<v Ben Rady>Yeah, yeah.

224
00:21:59.740 --> 00:22:18.270
<v Matt Godbolt>So there was a trick here. Yeah. Oh, but I missed over the... Going below 0.3 volts is a signal to either pull the signal up to the top of the screen if it's a long period of time, or if it's a short burst below 0.3 volts, it pulls it back to the left.

225
00:22:18.270 --> 00:22:18.500
<v Ben Rady>Mm-hmm.

226
00:22:18.500 --> 00:22:27.770
<v Matt Godbolt>So there are like two independent circuits that are always running inside the TV, one of which is just a square, both of which are sawtoothed.

227
00:22:27.770 --> 00:22:29.660
<v Ben Rady>Yeah.

228
00:22:29.660 --> 00:22:31.330
<v Matt Godbolt>Sawtooths, excuse me, sawtooths.

229
00:22:31.330 --> 00:22:31.650
<v Ben Rady>Mm-hmm.

230
00:22:31.650 --> 00:22:31.960
<v Ben Rady>Yeah.

231
00:22:31.960 --> 00:22:46.730
<v Matt Godbolt>And they're set to be, you know, just slightly longer than a frame and just slightly longer than a line, so that they will naturally just kind of go zero to left to right, left to right continuously, and top to bottom slower, but continuously.

232
00:22:46.730 --> 00:22:47.440
<v Ben Rady>Mm-hmm. Mm-hmm.

233
00:22:47.440 --> 00:22:59.760
<v Matt Godbolt>But the pulse going that low for a while is a signal to say, doesn't matter where you think you are, start dragging yourself to the top of the screen if you're the top to bottom, or left of the screen.

234
00:22:59.760 --> 00:23:07.180
<v Matt Godbolt>So that also gives you a certain amount of slop, where... not AI slop for a change, slop where if, for example, your TV's

235
00:23:07.180 --> 00:23:07.180
<v Ben Rady>Yeah.

236
00:23:07.180 --> 00:23:32.230
<v Matt Godbolt>crystal oscillators, or they weren't even crystals, but the little oscillators that were doing these sawtooths, was slightly out of spec, then, you know, you just keep rewiring, pulling them back onto the right sort of thing. And if there was no signal at all, then they would sort of free run. And that's when you would see the picture rolling, for example. If there was enough to see where the picture was, but you didn't... the TV couldn't pick up that synchronization pulse anymore, then it would just free run.

237
00:23:32.230 --> 00:23:32.270
<v Ben Rady>Yeah.

238
00:23:32.270 --> 00:23:32.320
<v Ben Rady>Yeah.

239
00:23:32.320 --> 00:23:40.130
<v Matt Godbolt>And so the whole picture would spin over and over again. And I realize I'm gesturing wildly with my hands, which doesn't help our listener at all.

240
00:23:40.130 --> 00:23:41.360
<v Ben Rady>Yeah. Yeah.

241
00:23:41.360 --> 00:23:56.180
<v Matt Godbolt>So without getting into too many of the specifics, both of those things cause the TV to reset the top bit and the left to right bit. The interesting thing for me for the first time about this was like realizing that that sawtooth from top to bottom is always running.

242
00:23:56.180 --> 00:24:06.760
<v Matt Godbolt>You know, you and I think that the beam scans from left to right, then it goes down a bit and comes back again sort of diagonally, and then it scans the next row left to right.

243
00:24:06.760 --> 00:24:11.600
<v Matt Godbolt>But it doesn't. It's doing... it's always a slightly diagonal line from left to right.

244
00:24:11.600 --> 00:24:11.880
<v Ben Rady>Yeah.

245
00:24:11.880 --> 00:24:16.680
<v Matt Godbolt>And then it's a much less diagonal angle from right to left, because it's much quicker going back than it is going across.

246
00:24:16.680 --> 00:24:17.060
<v Ben Rady>Mm-hmm.

247
00:24:17.060 --> 00:24:23.970
<v Matt Godbolt>And so you'd think that the whole picture would be slightly wonky because it's... and it is.

248
00:24:23.970 --> 00:24:24.160
<v Ben Rady>Yeah.

249
00:24:24.160 --> 00:24:30.000
<v Matt Godbolt>And so they just adjust the damn magnets to turn them by half a degree backwards so that it's all the right way around again.

250
00:24:30.000 --> 00:24:31.350
<v Matt Godbolt>It's just, you know, beautiful.

251
00:24:31.350 --> 00:24:31.540
<v Ben Rady>Oh...

252
00:24:31.540 --> 00:24:35.040
<v Matt Godbolt>And I had to model that because I'm like, why is everything slightly off?

253
00:24:35.040 --> 00:24:35.540
<v Ben Rady>Right.

254
00:24:35.540 --> 00:24:36.180
<v Matt Godbolt>Oh, yeah. Yeah.

255
00:24:36.180 --> 00:24:54.780
<v Matt Godbolt>Okay, so that's the retrace. So we were talking about black and white. So you could imagine now it's really, really easy. We have these two electromagnets that are being dragged... dragging the electron beam up and down, left and right. They're synchronized with the signal. And then the rest of it is just the brightness.

256
00:24:54.780 --> 00:25:07.980
<v Matt Godbolt>And that's just how many electrons we squirt at the screen in the direction the beam is currently pointing. And there you go. You've got a black and white telly. You are done. Hooray, high fives all round.

257
00:25:07.980 --> 00:25:16.550
<v Matt Godbolt>But now we want color. And so, you know, as a computer programmer, we would say, oh, V2, you know, or you sort of come up with something.

258
00:25:16.550 --> 00:25:16.740
<v Ben Rady>Right.

259
00:25:16.740 --> 00:25:29.980
<v Matt Godbolt>Well, we've got the red, the green, and blue, and three channels. And then somehow, oh, there's also a black and white version. But no, they had to come up with a really clever way of getting color into the signal.

260
00:25:29.980 --> 00:25:41.940
<v Matt Godbolt>So the trick, and this is the great thing, the trick is take... we take the color information and we break it down into three components.

261
00:25:41.940 --> 00:25:51.930
<v Matt Godbolt>Rather than red, green and blue, we pick brightness, which we already have, because that's what the black and white signal was. And then we have two chrominance signals.

262
00:25:51.930 --> 00:25:52.660
<v Ben Rady>Mm-hmm.

263
00:25:52.660 --> 00:26:02.410
<v Matt Godbolt>And you know if you've ever pulled up a color picker in any of your art packages, you've probably seen the ones where you've got HSV and you know you've got brightness and then two different other sliders.

264
00:26:02.410 --> 00:26:02.550
<v Ben Rady>Mm-hmm.

265
00:26:02.550 --> 00:26:02.700
<v Ben Rady>Mm-hmm.

266
00:26:02.700 --> 00:26:15.780
<v Matt Godbolt>And you can pick any color with three things. That's the beauty of like any space is that if it's a 3D space, you can have any coordinate system and you can get to all the points of the coordinate system as long as you've got three of them.

267
00:26:15.780 --> 00:26:28.580
<v Matt Godbolt>And that's what it is. So like we have essentially a brightness, which is overall how bright something is. We have how saturated a color is, between totally that color or white,

268
00:26:28.580 --> 00:26:40.280
<v Matt Godbolt>white, however white the brightness would let us go. And then we have a kind of color wheel for the third axis, which says, well, which color, if we're not white, which color are we tending towards?

269
00:26:40.280 --> 00:26:51.520
<v Matt Godbolt>And you could imagine you're just, you know, just a genuine, honest kind of color wheel and like, well, it's a direction on there. And so now we've got three signals again. So that's cool. And one of them is one we're already transmitting.

270
00:26:51.520 --> 00:26:59.980
<v Matt Godbolt>So can we hide the other two signals somewhere that a black and white telly that hasn't even... doesn't even know the color exists

271
00:26:59.980 --> 00:27:01.060
<v Ben Rady>Right.

272
00:27:01.060 --> 00:27:08.350
<v Matt Godbolt>doesn't see them, without using more bandwidth, because we can't add... you know, we've got all these TV channels packed into the RF spectrum.

273
00:27:08.350 --> 00:27:08.720
<v Ben Rady>Yeah.

274
00:27:08.720 --> 00:27:29.060
<v Matt Godbolt>And although we're talking... I'm talking about the composite part now, the width of that signal has to somehow be squished into the radio spectrum. So what we do is we observe that if we wiggle the brightness really fast and not that much, maybe the black and white TV won't notice it.

275
00:27:29.060 --> 00:27:29.480
<v Ben Rady>Mm-hmm.

276
00:27:29.480 --> 00:27:45.150
<v Matt Godbolt>Because it's a crap old piece of analog electronics, it's old anyway, a higher frequency wiggle in the brightness would probably go unnoticed, or at worst just makes the white areas look a little stippled in places where it's just varying quite quickly.

277
00:27:45.150 --> 00:27:45.780
<v Ben Rady>Mm-hmm.

278
00:27:45.780 --> 00:27:57.060
<v Matt Godbolt>Okay, but now we've got a wiggle. What do we do with this wiggle? Well, this wiggle, we can somehow encode two pieces of information with that wiggle.

279
00:27:57.060 --> 00:28:02.080
<v Matt Godbolt>The amplitude of that wiggle could be one of the other dimensions.

280
00:28:02.080 --> 00:28:04.560
<v Ben Rady>Oh, OK. Yeah, and the frequency is the other one?

281
00:28:04.560 --> 00:28:08.480
<v Matt Godbolt>So now we've got one of them, but how do we get the third one?

282
00:28:08.480 --> 00:28:10.700
<v Ben Rady>Yeah. Is it the frequency of the wiggle?

283
00:28:10.700 --> 00:28:12.500
<v Matt Godbolt>What else... what's that, sorry?

284
00:28:12.500 --> 00:28:14.740
<v Ben Rady>Is it the frequency of the wiggle?

285
00:28:14.740 --> 00:28:25.950
<v Matt Godbolt>It's not the frequency... that would make sense at some level. And I think SECAM, the French thing, used something akin to that. But that would be too easy.

286
00:28:25.950 --> 00:28:26.520
<v Ben Rady>OK.

287
00:28:26.520 --> 00:28:40.760
<v Matt Godbolt>Also, there are limitations on what frequencies we can use for a variety of reasons, to do with the fact it has to not be a frequency that's going to interfere with this signaling itself, because all these other components are going.

288
00:28:40.760 --> 00:28:50.360
<v Matt Godbolt>And also the RF... sorry, the audio is in there as well. So there was some careful picking of these numbers so they all don't divide into each other and you end up with like stripes or things like that.

289
00:28:50.360 --> 00:28:50.540
<v Ben Rady>Okay.

290
00:28:50.540 --> 00:29:02.320
<v Matt Godbolt>Because there are artifacts, which is partly why we're talking about this, because it... those are artifacts I'm trying to capture in the emulator. So the other thing that we can fiddle around that isn't the frequency is the phase.

291
00:29:02.320 --> 00:29:04.240
<v Ben Rady>Oh, okay. Yeah.

292
00:29:04.240 --> 00:29:10.890
<v Matt Godbolt>So you can slide that back and forth and have the peak at this point in time or push it back a little bit, and now we've got another dimension.

293
00:29:10.890 --> 00:29:11.240
<v Ben Rady>Right.

294
00:29:11.240 --> 00:29:25.740
<v Matt Godbolt>And so the phase, as you'll recall, can be measured as between 0 and 360 degrees, if you want to think about it, right, as a sine wave. You can like slide the sine wave back and forth. And that maps nicely into our 360 degree color wheel that we had.

295
00:29:25.740 --> 00:29:29.610
<v Matt Godbolt>So that's how we pick the color. The color is just the phase of that wiggle.

296
00:29:29.610 --> 00:29:29.840
<v Ben Rady>Okay.

297
00:29:29.840 --> 00:29:45.350
<v Matt Godbolt>And then how saturated it is, is how wiggly... the brightness of that wiggle. So heavily saturated colors on a black and white television do have a grainy texture over the top of them now, because you can see the wiggle in it if you look hard.

298
00:29:45.350 --> 00:29:46.060
<v Ben Rady>Mm-hmm.

299
00:29:46.060 --> 00:30:01.830
<v Matt Godbolt>So that's cool. We have smuggled two pieces of extra information into our channel. Black and white TV people don't really notice it. But we've now got a new problem, which is that analog electronics is not very good at measuring things like phase differences.

300
00:30:01.830 --> 00:30:10.940
<v Matt Godbolt>Because how accurate do you have to be with your signal to know if it's in or out of phase? And in and out of phase with what?

301
00:30:10.940 --> 00:30:11.900
<v Ben Rady>Right.

302
00:30:11.900 --> 00:30:15.560
<v Matt Godbolt>Maybe you need a PTP timestamp synchronization and now everyone's on the same page.

303
00:30:15.560 --> 00:30:15.560
<v Ben Rady>Maybe.

304
00:30:15.560 --> 00:30:23.400
<v Matt Godbolt>You're down to the... No, no, we haven't got any of that. It's got to work with crap electronics in a 1960s box.

305
00:30:23.400 --> 00:30:24.120
<v Ben Rady>Yeah.

306
00:30:24.120 --> 00:30:25.840
<v Ben Rady>Can I... can I take a guess?

307
00:30:25.840 --> 00:30:28.370
<v Matt Godbolt>So we need... Yeah, please. This would be great, because I've been just jabbering.

308
00:30:28.370 --> 00:30:28.820
<v Ben Rady>Can I... can I guess?

309
00:30:28.820 --> 00:30:30.620
<v Matt Godbolt>So tell me, what do you think?

310
00:30:30.620 --> 00:30:36.960
<v Ben Rady>So there's two checkpoints that you have. One is the screen reset and one is the line reset.

311
00:30:36.960 --> 00:30:38.000
<v Matt Godbolt>Yes, go on.

312
00:30:38.000 --> 00:30:43.040
<v Ben Rady>So it could be either of those, or maybe even both.

313
00:30:43.040 --> 00:30:49.700
<v Matt Godbolt>You are bang on the money, my friend. And it almost makes me think you're cheating and Googling, but I can see your hands, so I know you aren't. Yeah.

314
00:30:49.700 --> 00:30:51.840
<v Ben Rady>I am not. I am not.

315
00:30:51.840 --> 00:31:01.330
<v Matt Godbolt>So at the beginning of each line, after we've had the little dip below the 0.3 volts that says, hey, this is the beginning of the line.

316
00:31:01.330 --> 00:31:01.740
<v Ben Rady>Mm-hmm.

317
00:31:01.740 --> 00:31:10.030
<v Matt Godbolt>And so we know that the electron beam has been dragged back and is currently now way off the left-hand side of the screen.

318
00:31:10.030 --> 00:31:10.480
<v Ben Rady>Mm-hmm.

319
00:31:10.480 --> 00:31:16.730
<v Matt Godbolt>We then come up to like a black level, because we're in the sort of border on the left-hand side.

320
00:31:16.730 --> 00:31:17.020
<v Ben Rady>Right.

321
00:31:17.020 --> 00:31:20.990
<v Matt Godbolt>And just before then, and there's something like... there's the front porch and the back porch.

322
00:31:20.990 --> 00:31:21.160
<v Ben Rady>Right.

323
00:31:21.160 --> 00:31:25.400
<v Matt Godbolt>There's some stupid names for these things, which is, you know, stupid, hilariously funny.

324
00:31:25.400 --> 00:31:25.660
<v Ben Rady>Interesting. Yeah.

325
00:31:25.660 --> 00:31:37.100
<v Matt Godbolt>We just do a quick burst of that color signal, just a little of it, that's short enough that, again, it's not going to be visible. It's off the side of the screen.

326
00:31:37.100 --> 00:31:45.540
<v Matt Godbolt>But anything that's looking for it will see it and go, ah, two things. One, this is a color TV signal. It's not a black and white TV signal.

327
00:31:45.540 --> 00:31:45.620
<v Ben Rady>Right.

328
00:31:45.620 --> 00:31:54.580
<v Matt Godbolt>It's a color TV signal, because I've seen the color burst. Two, synchronize my very short-lived one-line's worth signal

329
00:31:54.580 --> 00:31:55.140
<v Ben Rady>Right.

330
00:31:55.140 --> 00:32:16.360
<v Matt Godbolt>local oscillator of this color frequency, so that I've now got a reference that I can compare everything else to, and I can compare it to see if it's in or out of phase and by how much. And so that is the trick of getting color. Now decoding that is a pain, but you mentioned something about the black, you know, static.

331
00:32:16.360 --> 00:32:18.470
<v Matt Godbolt>So do you think you can answer your own question now?

332
00:32:18.470 --> 00:32:18.620
<v Ben Rady>Yeah.

333
00:32:18.620 --> 00:32:20.620
<v Matt Godbolt>Why is it black and white?

334
00:32:20.620 --> 00:32:27.980
<v Ben Rady>Well, because it's not going to have that burst right at the right time to tell it that it's a color TV.

335
00:32:27.980 --> 00:32:34.370
<v Matt Godbolt>Bingo. Bingo. So the color TV set will... will assume it's a black and white picture, because it can't synchronize to it and it can't find the color burst.

336
00:32:34.370 --> 00:32:34.630
<v Ben Rady>Yeah.

337
00:32:34.630 --> 00:32:34.880
<v Ben Rady>Yeah.

338
00:32:34.880 --> 00:32:42.880
<v Matt Godbolt>And so it will suppress all of its own color decoding circuitry. And so the noise only comes out in black and white. Congratulations, sir.

339
00:32:42.880 --> 00:32:43.520
<v Ben Rady>Wow.

340
00:32:43.520 --> 00:32:45.000
<v Matt Godbolt>You've won today's podcast.

341
00:32:45.000 --> 00:32:50.330
<v Ben Rady>Well, I just want to thank everyone involved, you know, my friends, my family here to support me.

342
00:32:50.330 --> 00:32:50.420
<v Matt Godbolt>Yeah.

343
00:32:50.420 --> 00:32:57.160
<v Ben Rady>And I'm just really proud of this accomplishment today. So thank you. Thank you all. Really appreciate it.

344
00:32:57.160 --> 00:33:18.890
<v Matt Godbolt>But so I guess, you know, and so emulating and simulating this has been an absolute blast, and learning all of the various things that they do to the TVs that do that, like, period appropriate. And I learned, for example, that there are delay lines for something we'll hopefully talk about in a second, which required a piece of glass that's exactly the right size so that like essentially it puts...

345
00:33:18.890 --> 00:33:19.180
<v Ben Rady>Wow.

346
00:33:19.180 --> 00:33:31.700
<v Matt Godbolt>There's like a piezoelectric crystal on both sides of this bit of glass, and it knows it takes 64 microseconds for the vibrations to make it through to the other side. And that's how you get a delay line, an analog delay line, for 64 micros.

347
00:33:31.700 --> 00:33:32.700
<v Matt Godbolt>You're like, what?

348
00:33:32.700 --> 00:33:33.140
<v Ben Rady>Wow.

349
00:33:33.140 --> 00:33:46.840
<v Matt Godbolt>There are other things that use specially shaped piezo crystals that then can filter out frequencies. It's just so clever. But while we're here, and as we've just been talking about the color burst in particular,

350
00:33:46.840 --> 00:33:48.720
<v Ben Rady>This sounds like an amazing project. Yeah. Yeah.

351
00:33:48.720 --> 00:33:56.380
<v Matt Godbolt>What is the name of the European, or most of the European, TV standard?

352
00:33:56.380 --> 00:33:57.840
<v Ben Rady>PAL.

353
00:33:57.840 --> 00:33:59.760
<v Matt Godbolt>Do you know what PAL stands for?

354
00:33:59.760 --> 00:34:02.840
<v Ben Rady>Oh, I do not.

355
00:34:02.840 --> 00:34:21.400
<v Matt Godbolt>It stands for phase alternating lines. And I think that probably tells you something about what happens on each line. And maybe about the color part, because this is where NTSC, which is something like the North American Television Standards Committee or something like that, which was developed first, incidentally.

356
00:34:21.400 --> 00:34:21.710
<v Ben Rady>Phase alternating lines.

357
00:34:21.710 --> 00:34:22.020
<v Ben Rady>Yeah, yeah. Uh-huh.

358
00:34:22.020 --> 00:34:33.440
<v Matt Godbolt>So NTSC predates PAL by about a decade or so. And so PAL learned from NTSC and went, we like everything about this, but... there's this one thing, and they fixed something.

359
00:34:33.440 --> 00:34:33.540
<v Ben Rady>Yeah.

360
00:34:33.540 --> 00:34:36.500
<v Ben Rady>And one thing, so phase alternating lines.

361
00:34:36.500 --> 00:34:36.900
<v Matt Godbolt>Uh-huh.

362
00:34:36.900 --> 00:34:49.260
<v Ben Rady>So if we're using phase to control color, the hue, right, then my guess here is that we shift the phase every other line.

363
00:34:49.260 --> 00:34:49.860
<v Matt Godbolt>Okay.

364
00:34:49.860 --> 00:34:57.520
<v Ben Rady>I'm trying to think of why that helps, though. I don't know why that helps.

365
00:34:57.520 --> 00:35:02.120
<v Matt Godbolt>Exactly. Yeah. Well, let's talk briefly, because I've looked... we're at 35 minutes, gosh.

366
00:35:02.120 --> 00:35:02.500
<v Ben Rady>Why does that help?

367
00:35:02.500 --> 00:35:02.600
<v Ben Rady>Right.

368
00:35:02.600 --> 00:35:17.820
<v Matt Godbolt>Let's talk briefly about one of the problems that NTSC had. And actually, this would be interesting, because I didn't grow up with an NTSC set. I grew up cursing them in the 90s, because we had to like try and make our graphics look good on NTSC TVs for like games.

369
00:35:17.820 --> 00:35:32.830
<v Matt Godbolt>But they wouldn't have suffered from the problem I'm about to describe. So... The problem with the phase being the color information is that tiny, tiny errors start moving you around on that color wheel, right?

370
00:35:32.830 --> 00:35:32.920
<v Ben Rady>Mm-hmm. Mm-hmm.

371
00:35:32.920 --> 00:35:45.800
<v Matt Godbolt>If you're just out by one degree, you're moving around this color wheel. And so you had a... you may have had an extra control on your early analog TVs that I would not have had.

372
00:35:45.800 --> 00:35:54.860
<v Matt Godbolt>I had color, brightness, contrast. Those were the three things. Do you remember another one? I'm really... you're younger than me, so you probably don't.

373
00:35:54.860 --> 00:35:56.980
<v Ben Rady>You know, I don't remember.

374
00:35:56.980 --> 00:35:57.370
<v Matt Godbolt>It's been a while.

375
00:35:57.370 --> 00:35:57.800
<v Ben Rady>It's been a bit.

376
00:35:57.800 --> 00:36:05.440
<v Matt Godbolt>So my understanding is that earlier American sets would have a tint as well.

377
00:36:05.440 --> 00:36:08.460
<v Ben Rady>Oh, yeah. Yes. 100%. Mm-hmm.

378
00:36:08.460 --> 00:36:38.420
<v Matt Godbolt>And so you would fiddle with the tint, because people's skin color would look like orangey or greeny or whatever sometimes, because... now you probably know where I'm going with this... because of small errors in the phase. Those errors commonly come from the signal being reflected off a building near you. And if you take two signals that are identical and add them together with just a tiny delay in one of them, it's similar to shifting the phase of everything.

379
00:36:38.420 --> 00:36:39.060
<v Ben Rady>Oh, yeah.

380
00:36:39.060 --> 00:36:43.260
<v Matt Godbolt>And I'm going to wave my hands a lot here, because I've read the math a few times and it hasn't really gone in.

381
00:36:43.260 --> 00:36:43.560
<v Ben Rady>OK.

382
00:36:43.560 --> 00:37:00.240
<v Matt Godbolt>But there's sort of an unfortunate thing, either if the TV is just not good at locking onto that signal and the parts aren't great, or if there's a systematic error because everything's being slightly delayed and you're getting a mirror copy coming in, then the colors would morph, and it would depend on where the TV set is.

383
00:37:00.240 --> 00:37:00.500
<v Ben Rady>Right.

384
00:37:00.500 --> 00:37:16.640
<v Matt Godbolt>And it depends on like how warm things are. And you... so fiddle around with this tint. So this is the thing the Germans who came up with PAL was like, how can we fix this? And they made the observation, which to this day lives on in things like JPEG.

385
00:37:16.640 --> 00:37:22.400
<v Matt Godbolt>So, and that is, humans care about the brightness far more than they care about the color.

386
00:37:22.400 --> 00:37:22.400
<v Ben Rady>Okay.

387
00:37:22.400 --> 00:37:22.400
<v Matt Godbolt>Right. So, you know, in, say, a JPEG, we store the... the brightness information at a higher resolution than we store the color information, because then you tend not to notice.

388
00:37:22.400 --> 00:37:22.400
<v Ben Rady>Okay. Yeah.

389
00:37:22.400 --> 00:37:22.400
<v Ben Rady>Yeah. Yeah.

390
00:37:22.400 --> 00:37:38.960
<v Matt Godbolt>This trick comes from this area.

391
00:37:38.960 --> 00:37:39.040
<v Ben Rady>Right.

392
00:37:39.040 --> 00:38:11.200
<v Matt Godbolt>So they said, well, what if it didn't really matter if we were storing color on every line, unique color in every line? And so it's not... it's not actually that they changed it. But what they said was like, if we flip the phase every other line and we delay the previous line's color and add it to the current line's color, we cancel out any phase error between the two of them, because they've been affected by 180 degrees different in each direction.

393
00:38:11.200 --> 00:38:23.400
<v Matt Godbolt>And every time I say that out loud, I go, there seems like there's something wrong with that. But I sit down, I do the maths, and the phase error cancels out. But at the loss of like the fact that you are mixing together two lines' worth of color information to kind of get one blurrier line of color information.

394
00:38:23.400 --> 00:38:23.400
<v Ben Rady>Of course it was the Germans.

395
00:38:23.400 --> 00:38:53.700
<v Matt Godbolt>So that is the... and again, probably without a picture or even, again, without me being very confident about it, but that phase alternation and knowing that the TV is going to do obviously the reverse, any error, any fixed error that you've added in cancels out, because when you reverse it the second time, you're adding minus... if you're bouncing off a building, it's adding three degrees of error.

396
00:38:53.700 --> 00:38:54.200
<v Ben Rady>Yeah.

397
00:38:54.200 --> 00:39:00.530
<v Matt Godbolt>You add in three degrees of error on the first line. You subtract three degrees of error on the second line. You assume that the other part is the same.

398
00:39:00.530 --> 00:39:00.780
<v Ben Rady>Yeah.

399
00:39:00.780 --> 00:39:05.690
<v Matt Godbolt>And so those two cancel out. You divide by two and you get just the right phase out of it.

400
00:39:05.690 --> 00:39:05.840
<v Ben Rady>Yeah.

401
00:39:05.840 --> 00:39:06.460
<v Ben Rady>Okay.

402
00:39:06.460 --> 00:39:16.310
<v Matt Godbolt>And so PAL, phase alternating lines, and NTSC, which was "never twice the same color" for that reason.

403
00:39:16.310 --> 00:39:16.540
<v Ben Rady>PAL.

404
00:39:16.540 --> 00:39:19.570
<v Matt Godbolt>That was the bad acronym for it.

405
00:39:19.570 --> 00:39:20.080
<v Ben Rady>That's funny.

406
00:39:20.080 --> 00:39:47.940
<v Matt Godbolt>So, yeah, this has been... an odyssey of discovery, as I said. I can now just about real time in software decode... without using GPU trickery, I can decode this all in software, and I can point at each bit of the code and I can say, yeah, I know what that bit's doing. And whatever... things I didn't cover, because we're already 40 minutes here, is that having done this decode, I now do a physically based electron beam simulation where I actually use a lot of

407
00:39:47.940 --> 00:39:47.940
<v Ben Rady>Wow.

408
00:39:47.940 --> 00:39:54.120
<v Matt Godbolt>virtual magnets to drag a virtual stream of electrons onto virtual phosphor, which then bloom.

409
00:39:54.120 --> 00:39:54.760
<v Ben Rady>Oh, wow. Wow.

410
00:39:54.760 --> 00:40:11.160
<v Matt Godbolt>And as the overvolting of like a too-strong, too-white signal happens, the pixels bloom. The current starts going high in the electron guns and you get more, wider spew of like electrons that hit more area of the screen.

411
00:40:11.160 --> 00:40:27.940
<v Matt Godbolt>What else? Then you can... I can simulate the fact that like they often... the flyback, which is this hilariously named but complicated thing that builds up enough charge to have this really high voltage that's needed, you can deplete it by having too much white for too long.

412
00:40:27.940 --> 00:40:38.470
<v Matt Godbolt>And then essentially the picture starts sagging after that, which is, you know, on... again, on cheap sets where there wasn't much capacitance, or, you know, you would put a pretty big white thing.

413
00:40:38.470 --> 00:40:38.920
<v Ben Rady>Wow.

414
00:40:38.920 --> 00:40:43.300
<v Matt Godbolt>And but I remember having one, my dad nicked a monitor from work. And it had this problem where if you had like a bright white title bar of like a game, everything else underneath it was kinked, because that bright white area had kind of gone and dragged all the power out of it.

415
00:40:43.300 --> 00:41:10.690
<v Matt Godbolt>And it's like, had to recharge it up to be able to like pull the electron beam properly. It's just amazing. It's so fun. And you have been a fantastic foil listening to me. I think I needed this more than I knew, actually. I did say to people at ACCU, I said, this is therapy for us... well, for me.

416
00:41:10.690 --> 00:41:10.860
<v Ben Rady>I will...

417
00:41:10.860 --> 00:41:16.940
<v Ben Rady>I cannot... I cannot wait to see this working in person. I just... I really am looking forward to this.

418
00:41:16.940 --> 00:41:32.440
<v Matt Godbolt>So the fun thing is is that I've left my desktop computer plugged in with the SDR in Chicago, 4,000 miles from where I'm sitting here, and I've left my Sega... foolishly left my Sega Master System plugged into it and turned on, with a Wonder Boy 3 cartridge in it.

419
00:41:32.440 --> 00:41:54.200
<v Matt Godbolt>And I'm still able... I could just about stream the picture live that's being decoded, everything could just about keep up, and I could just about transmit fast enough, like some crap MJPEG stuff, to get to me here. And I've got the satisfaction of watching the little character play the attract mode in full color with, you know, all of... warts and all. It's been a journey. It's been fun. But yeah.

420
00:41:54.200 --> 00:41:57.920
<v Ben Rady>Did it... did that survive the power outage up in Evanston a couple of weeks ago? Okay.

421
00:41:57.920 --> 00:42:06.000
<v Matt Godbolt>No, no, I had to ask the dog sitter who was in the house to go, can you just go and press this button?

422
00:42:06.000 --> 00:42:06.120
<v Ben Rady>Oh, my God.

423
00:42:06.120 --> 00:42:16.540
<v Matt Godbolt>I had to send a pic... Luckily, I had a picture from one of the many times I was doing the Advent of Compiler Optimization for like the thumbnails. I said, the computer is here, like a big drawn-on arrow, press this button.

424
00:42:16.540 --> 00:42:16.540
<v Ben Rady>Okay.

425
00:42:16.540 --> 00:42:20.020
<v Matt Godbolt>And yeah, they were able to turn it back on for me.

426
00:42:20.020 --> 00:42:20.180
<v Ben Rady>My god.

427
00:42:20.180 --> 00:42:31.790
<v Matt Godbolt>And yeah, I didn't get them to go in the basement and turn the NAS on, which has also died, but... my son has now done that. But yeah, hilarious stuff, man.

428
00:42:31.790 --> 00:42:32.940
<v Ben Rady>All right. Excellent.

429
00:42:32.940 --> 00:42:45.820
<v Matt Godbolt>Thank you for listening, my friend. This has been fun for me. I don't know what else to do now other than go on... I'm spent. I've been talking at the screen for this time.

430
00:42:45.820 --> 00:42:50.250
<v Matt Godbolt>But yeah, good... good shout on working out where the puzzles were.

431
00:42:50.250 --> 00:42:50.560
<v Ben Rady>This is... this is an amazing project.

432
00:42:50.560 --> 00:42:52.540
<v Matt Godbolt>That was... that was impressive thinking on your feet.

433
00:42:52.540 --> 00:42:58.860
<v Ben Rady>I mean, you know, whatever. We're all just nerds here. That's how that works.

434
00:42:58.860 --> 00:43:11.790
<v Matt Godbolt>So I'm probably going to edit this and put it out like in a couple of days' time, which I think will probably be the first time ever that we've had a Two's Complement go out within the time that we recorded it, which then unfortunately means we have none left in the bank.

435
00:43:11.790 --> 00:43:12.000
<v Ben Rady>Oh, yeah. Within a few... Right.

436
00:43:12.000 --> 00:43:18.880
<v Matt Godbolt>So dear listener, you will... the next one in August will be another seat-of-the-pants job. But...

437
00:43:18.880 --> 00:43:22.140
<v Ben Rady>Hopefully it's released on time, but no promises at this point.

438
00:43:22.140 --> 00:43:23.350
<v Matt Godbolt>Correct.

439
00:43:23.350 --> 00:43:24.920
<v Ben Rady>Right. Yeah.

440
00:43:24.920 --> 00:43:26.750
<v Matt Godbolt>Correct. Events may overtake us at this stage.

441
00:43:26.750 --> 00:43:27.140
<v Ben Rady>Yeah.

442
00:43:27.140 --> 00:43:28.220
<v Matt Godbolt>Yeah, that's true.

443
00:43:28.220 --> 00:43:29.060
<v Ben Rady>Yeah. All right.

444
00:43:29.060 --> 00:43:29.700
<v Ben Rady>Well, until then.

445
00:43:29.700 --> 00:43:33.900
<v Matt Godbolt>Until then, yeah, have yourself a great time.

446
00:43:33.900 --> 00:43:35.060
<v Ben Rady>Okay. Cool. See you later.

447
00:43:35.060 --> 00:43:37.060
<v Matt Godbolt>Bye.

