# AM radio receiver block

## Comments

• Member Posts: 366 Saw

for that it would need to be multiplication not addition

My last version way back did have the mult, although that may not have been uploaded. You'll see there is a mult in the version I uploaded a few posts ago.

The thing that confused me is that it seems redundant, and in the context of a DSP model it is. However in a real world context, one significant benefit is that it's much easier/cheaper to amplify signals at lower frequencies. So the superhet trick of creating a much lower intermediate frequency in the receiver, then using an envelope follower detector on that means cheaper more compact circuitry because fewer amplifier stages for adequate gain... and you get those characteristic sweeping whistling sounds as a bonus :)

one thing ive been thinking about for a while: beat frequencies

That's what a heterodyne is - a beat frequency (I'm sure you know that)

Why would it only apply with frequencies that are close to each other?

check here https://en.wikipedia.org/wiki/Heterodyne, and look down about half way it explains how beat frequencies/heterodynes are a natural consequence of the maths of multiplying sinusoids.

It might be sensible to try and go down this route and develop a mathematical model where massive oversampling to recreate super high frequencies is unnecessary - just some trig and similar results ?

• Member Posts: 253 Saw
edited October 2022

That's what a heterodyne is - a beat frequency (I'm sure you know that)

Why would it only apply with frequencies that are close to each other?

i was talking about acoustic beating, the kind you get when adding two signals of similar frequency and you hear the difference frequency as beating effect.

https://en.wikipedia.org/wiki/Beat_(acoustics)

wikipedia calls this a psycho-acoustic phenomenon, but that seems only half right since it can be observed in signal output. anyway, my hunch was wrong: any combination (linear superposition) of two sine waves will have a varying signal envelope from wherever the two waves sum and cancel, this new uneven signal envelope varies in amplitude as if it was amplitude modulated by the beat or difference frequency

one interesting thing is its theorized that non-linearities in our hearing cause us to hear these 'combination tones' as something more concrete than they really are

anyway, that's all only tangential to the current topic of interest

as for that, well... i have this: some kind of single station heterodyne. i believe replacing the multiplier for the local oscillator with a frequency shifter works as i expected, to avoid the wasteful upper sideband the ring mod would create

really though, the extra sine oscillator shouldn't even be necessary? seems one could very as well just tune all carrier oscillators to move through the band of the fixed tuning filter.

really, i don't even see what would cause this (heterodyne version) to have a different character of sweeping sound than the normal version, one is a bandpass sweeping through carrier frequencies, the other is carrier frequencies sweeping through a bandpass (maybe @Laureano Lopez knows?) though they do seem to behave not identically

anyway i'm not sure how correct it all is, the tuning sweep sure is loud, and there's but a very narrow band where it doesn't it isn't obnoxious, it seems at that quiet point is where it turns from the audible range to more like LFO, though it is still audibly effecting the sound

• Member Posts: 366 Saw

really though, the extra sine oscillator shouldn't even be necessary? seems one could very as well just tune all carrier oscillators to move through the band of the fixed tuning filter.

The extra sine is so that the stages after - gain stages, detector etc. - that can operate at a lower frequency. Better for simpler cheaper electronics.

So to get a reasonable model that setup would make sense, unless there is a way to provide an identical output with less processing.

Not sure you can just remove the extra sine modulator, won't that change the sound of the detuned system due to additional side bands, and it's that - particularly when its nearly but not quite tuned in - that provides the nostalgia character of old AM radio.

It's interesting that Wikipedia mentions that there are few issues with unwanted frequency drift on the local oscillator, but some issues with phase drifting. Maybe adding some parasitic phase modulation might make it more authentic... or not... :) time for more experiments.

Maybe what you are talking about with frequency shifter is related to Single Sideband Modulation? https://en.wikipedia.org/wiki/Single-sideband_modulation

• Member Posts: 253 Saw

so, the frequency shifter wouldn't be implementing single sideband AM (as the carrier signal still has negative and positive sidebands), but i've long thought of frequency shifting as single sideband ringmod, or a ring mod with separate negative and positive frequencies. think its the best bet for doing this digitally, as without, the further across its range its tuned the further the positive sidebands are on a death march to nyquist .. and before that point its more effective than filtering them off

as far as getting rid of the other oscillator, i tried it both ways and i'm not sure of a difference, but i prefer it with the oscillator for at least aesthetic reasons

funny story, i was trying to suppress the carrier a little bit because the whine was too pronounced for my taste and before it clicked that i could just adjust the AM offset i successfully used a SVF to notch pickup to filter out the carrier and just added a new one back in with a sine oscillator at .25 the amplitude (lol, lmao)

i included it here with a manual control knob because i think its interesting to see the effect of phase or lack thereof on carrier (0 for fake, 1 for real) it seems to attenuate lower frequencies and flatten the spectrum a good bit

also reduced the carrier offset setting because i think its a better configuration

• Member Posts: 253 Saw
edited October 2022

i should explain that when i say 'the further the positive sidebands are on a death march to nyquist i'm not not referring to the positive sidebands of the station but an entire copy of the station itself heading north

• Member Posts: 366 Saw
edited October 2022

Here's an update. There's a switch to toggle between a filter based detector and one based on an envelope follower. There's also some noise/drift based phase shift on the internal oscillator. This is definitely part of the puzzle in terms of authenticity. You now get some bands of noise near the tuning point (just after the best tuning position for each station.

There are fewer stations in this version... still not ideal though. Maybe need to do some research into how stations were spaced out across the available band, and how that related to the frequency of the internal filter and supported audio bandwidth per station.

Use shift with the tuning knob for fine tuning.

EDIT: Definitely switch Reaktor's oversampling up to 88200/96000 for this to work better...

• Member Posts: 253 Saw
edited October 2022

currently working on something for that... three stations on a single sine carrier at 15 khz w/ 10khz bandwidth and 5k allotted for baseband by staggering frequency shifters

that means i still have another comfortable 20k usable bandwidth at 88k. haven't really decided what to do yet but pretty sure its possible to barber pole/sheppard pattern as many stations as one sees necessary without requiring the actual bandwidth (heterodyne ftw!)

just matters that there's a station above is following the current one down and that the one below sinks into hell

anyway i think 5k bandwidth 10k per station is good for most requirements and also for AM sound/tone

i gotta ask again, are you sure your oversampling is working correctly? i thought maybe last time i'd tested it incorrectly, but this time i recorded the output of the sine stations at 88200 with this setup here with the output going to oversampled lowpass filtering below 44100

which should have removed any supersonic stations before recording, but again they were all below nyquist and spaced out between 4 and 6 khz apart

if it was working as intended that'd be dope but if it is, it is only in a way i am unable to understand. and if so i want in on it. but it seems that everything that is happening is happening below nyquist of 88200

• Member Posts: 253 Saw

doesn't oversampling multiplexed like this require some kind of polyphase deal?

like when i oversampled oscillators it required splitting up the phase increment between the number of OS and and adding it to each phase counter so that the state of the phase would be slightly different across each one

• Member Posts: 366 Saw
edited October 2022

like when i oversampled oscillators it required splitting up the phase increment between the number of OS and and adding it to each phase counter so that the state of the phase would be slightly different across each one

I think ideally the input should be interpolated somehow, but this was always a 'good enough if it sounds right to me' kind of deal. I'm not trying to make a virtual hi fidelity radio transmission system :)

The oscillators should all be phase correct though. The oversampled clock ups the reported sample rate, that divides down the phase accumulator step. Then the OBC for the phase counters is shared across the individual sections - that means that each will update the phase by a 'split' phase increment. All should be running at a correct phase offset. Not saying there are not bugs though :).

Of course there might be issues that I've not considered, so if you spot something post a fix!

EDIT: which version are you testing? The earlier ones were not using a high pass to remove the original audio frequencies after encoding.

• Member Posts: 366 Saw

There's definitely aliasing there. But here's a pic with the waterfall analyser where initially there was no filter, then I connected a 20Khz low pass, and its mostly clear. at 44k, not so clear, but still a significant reduction, the first station is at 64k.

I'm not so bothered, because stuff like the rectifier will be adding heaps of aliasing to the final output anyway, but I don't really mind because it's a noisy thing anyway - lofi

• Member Posts: 366 Saw

Just stuck Laureano's 8x up and downsampling macros on the inputs (not really necessary?) and the output, and that removes what foldback hash there was. It's now completely clear below 40k.

• Member Posts: 253 Saw
edited October 2022

nice, it took me so long of being confused to work out for sure and was just coming back to say if modularor audio with dc added is ring modded with a sine wave there should be no baseband signal, its all centered around the carrier

and finally i think i tracked down the bug. most of the wires were working but the ones directly connected to the output did this

even then i was only 80% sure because the heterodynes pretty much looked to be landing in the right range and had no idea if it was just your noise modelling. will you post the updated version? i'll just

i'd basically started over and come up with a really good system for a very radio like sound but its just hobbled by range and the workarounds accommodating that. it may or may not work to try to merge with a version using oversampling

• Member Posts: 253 Saw
edited October 2022

I'm not trying to make a virtual hi fidelity radio transmission system :)

i think i almost got there in the one i started from scratch, but it only has three stations!

• Member Posts: 366 Saw
edited October 2022

and finally i think i tracked down the bug. most of the wires were working but the ones directly connected to the output did this

What I was doing at the transition from oversampled to non-oversamples was a quick and dirty hack, just making sure that there was some sort of filter and then just using one of the oversampled parallel channels without any true downsampling. This is mainly because I wasn't bothered at all about some aliasing, rather I was trying to quickly get something up and running to test a model.

So those 'not available' wires are like that because they're not connected to anything so were not compiled.

• Cordoba, ArgentinaMember Posts: 90 Tri
edited October 2022

maybe @Laureano Lopez knows?

I tried to get what you were doing there and failed -why is the tuning control going to the mod&mix? That's the signal source, your receiver shouldn't telepathically modulate the stations 🤔

It seems the point of the superhet was just having the tunable filter broad and the narrow filter fixed, because a tunable narrow filter was too expensive or maybe not possible. (Also something similar for the amplifiers). In digital, a single filter and an envelope detector would be enough. That's of course very boring 😐️ So, here's my try

AM goes 550-1720k in 10k bands, with all stations bandlimited to 5k, so I went with that (the bandwidth, not the range). The hardest part is filtering the image frequencies (hence, the RF filter). They appear when the local oscillator gets high enough to reach the RF range, so all stations below the LO shift to negative and reflect. We could avoid this by placing our IF at SR/6, so that even after sliding all bands we still don't reach the RF range. That's a waste of bandwidth though, and the alternative is using a steep RF filter, which kind of kills the whole point 😅 Wikipedia says

Early Autodyne receivers typically used IFs of only 150 kHz or so. As a consequence, most Autodyne receivers required greater front-end selectivity, often involving double-tuned coils, to avoid image interference. With the later development of tubes able to amplify well at higher frequencies, higher IF frequencies came into use, reducing the problem of image interference.

So that's it: a higher IF or a steeper filter. I tested 4/6/8-pole for both the RF and IF filters. They all kind of work, but of course the lower orders give more leakage and louder sweeps. Funnily enough, the RF filter seems to be less tolerant -I blame aliasing at the mixer. With a low IF, it's pretty essential for 2*IF to be a multiple of the bandwidth: otherwise we get images falling into the range of the current station. I set IF = bw = 10k, which allows to fit 7 stations with x4 oversampling, or 16 with x8. We need the filters to have bandwidths in Hz: I use 10k for the RF, and (a very subjectively picked) 5625 for the IF. I tweaked the oscillator drift to have separate parameters for velocity and amplitude: this allows to change the noise colour without simultaneously changing its level. I also rectify before downsampling to avoid a lot of aliasing, and use ilo rectifiers to avoid a tiny bit of aliasing which widens the usable spot around each station.

I know, it's supposed to be lo-fi. Still, aliasing is so specifically digital that it kind of breaks the spell for me: I hear crossing sweeps and it's like