AM radio receiver block

124Β»

Comments

  • colB
    colB Member Posts: 988 Guru

    Your ILO rectifier is nice. I have a functionally identical implementation, but no where near as concise or efficient. Very elegant!

  • Laureano Lopez
    Laureano Lopez Member Posts: 102 Advisor

    I made this one before

    keeping three previous values, for x, |x| and x*|x|. Having three states is not nice for the x8 chain, so I made the other one. I also tried a triangular version -as usual, the cost/benefit ratio is not good. They all need to work on doubles, even the rect one, to allow that low a threshold.

  • Laureano Lopez
    Laureano Lopez Member Posts: 102 Advisor
    edited October 2022

    btw, these parameters of the phase drift

    The upper one is the 1-pole coefficient, the lower one is just a gain, and I divide the gain by sqrt (the 1-pole coefficient), which is the filter's gain rms for white noise input

    I take both parameters in log2 space because they behave logarithmically, with a -10..0 range which seems about what's usable for both.

  • ANDREW221231
    ANDREW221231 Member Posts: 349 Pro
    edited October 2022


    That's the signal source, your receiver shouldn't telepathically modulate the stations πŸ€”


    telepathically modulate!!! how dare you? spaghetti code always uses a land line πŸ˜…


    basically i gave up the idea of correct signal behavior (so any meaningful distinction between receiver and emitter) after realizing that the desirable thing about the heterodyne (for our purposes) was that the carrier (mixed with the local oscillator) frequency actually sweeps in tuning unlike the fixed frequencies of direct conversion, giving us the nice swooshing effect like colin was talking about... (think you knew that already but i didn't)

    so, i hit on just frequency shifting everything , my new version encodes all carrier stations at 20khz , each one has its own to frequency shift in relation as needed up or down (conceptually allocated a bit like a sheppard tone), each 'station' its own shifter operating only +/- 10k from the I.F.,,, if the range sent to the shifter exceeds available bandwidth it simply mutes output (getting rid of some of those filtering problems you mentioned) so it doesn't require all the oversampling aside from 2x for host, [but it does use enough all pass filters to slow down compile time to some undefined chunk of a fruitfly's incubation cycle]

    also a shifter in lieu of a ring modulation gets rid of positive sidebands, so foldback from nyquist and imaging aren't a problem. gotta do some tests to see if the signal from a frequency shifter is qualitatively different from the lower half of a ring mod, as FS quality is defined by range and the number of allpasses allocated


    i'll post my three station version soon after. my thought is the conventionally oversampled is the way to go but it might depend if the oversampled heterodyne airspace is actually messy like you said




    one thing it does have which i am quite confident about is its use of your decoupled envelope detector instead of a rectifier for demodulation (the version of mine that everyone complemented's only difference from colin's was the env detector in audio signal chain). stock envelope followers don't work well, but yours does, i suspect as the attack and release aren't crammed to a single feedback line. it has good radio sound, and seems to be good for removing higher frequency cr*p , and probably images too.. logically i wanna say it effects the sound more like a slew limiter than a normal filter




    oh yeah and speaking of telepathic:

    AM goes 550-1720k in 10k bands, with all stations bandlimited to 5k, so I went with that (the bandwidth, not the range)

    i arrived at the same thing guided by nothing save the cosmic whims of personal magnetism!!

  • ANDREW221231
    ANDREW221231 Member Posts: 349 Pro
    edited October 2022

    also, slightly daft question, but what are the considerations in creating a supersonic sine wave using polyphase oversampling? like i can see a conventionally oversampled system producing a super high frequency sine wave no problem but what about when none of the constituent sine waves oscillators are actually running at that speed? do they somehow still combine to produce the desired 2fast4nyquist output in the oversampled space?


    edit: ok, looks like the sine oscillators do alias just fine so it makes sense, unlike the factory sine which expressely forbids such forms of fun by producing no output after sr/2

  • ANDREW221231
    ANDREW221231 Member Posts: 349 Pro

    also what did you do to get the tuning whine so quiet? after some back and forth on this personally i have come to agree with colin, dimmed whine is a war crime

  • Laureano Lopez
    Laureano Lopez Member Posts: 102 Advisor

    So instead of shifting at "reception", you shift the "source" signals and then all further processing is at fixed frequencies? I think that should give a similar effect, yup.

    also what did you do to get the tuning whine so quiet?

    It's a number of things, most related to aliasing. First, having the IF at 10k, equal to the bandwidth (the space between carriers). If 2*IF is not a multiple of BW, images can fall into the range of the current band.

    You have tuned your oscillator so that its distance to S1 is IF. Because the distance between S1 and S2 is slightly smaller than 2*IF, when S2 wraps around, it doesn't overlap exactly with S1. After rectification, the S2 carrier falls into the audible range instead of DC. Yes, the RF filter should fix that, but your IF is not helping it. In practice, AM bandwidth is 10k and the IF is always a multiple of 10k, so this kind of overlap never happens, images always fall "on the grid" when you're tuned.

    Running the rectifier at x8 also avoids a lot of aliasing (using an ilo rectifier avoids a little more). I use a rectifier and a lowpass because it doesn't seem like consumer radios used anything fancier, like an asymmetric peak detector. Also, it sounds right enough to me. The rest comes down to the bandwidth and steepness of the RF and IF bandpass filters. I had left the bp4 and bp6 macros disconnected below, so you could try them. Here it's all set up:

    I think it would be reasonable to use a 4-pole for RF and leave the 8-pole for IF -the RF filter is supposed to be simpler after all. This would raise the whining between stations without raising it too much when you're tuned.

    what are the considerations in creating a supersonic sine wave using polyphase oversampling? like i can see a conventionally oversampled system producing a super high frequency sine wave no problem but what about when none of the constituent sine waves oscillators are actually running at that speed? do they somehow still combine to produce the desired 2fast4nyquist output in the oversampled space?

    These are conventionally oversampled sine oscs 😁 All the phase macros are connected through OBC ports, so they all use the same state. It's really a single osc, which has been loop-unrolled by 8.

  • ANDREW221231
    ANDREW221231 Member Posts: 349 Pro
    edited October 2022

    you had just beat me to first post this morning (editor: yesterday) after getting waylaid on *another thread*. had wanted to get in and waylay notions of frequency shifters needing to be in the discussion (CPU and 'airspace clutter' benefits don't really make up for added 'stupid design' and lowered dignity) but you probably didn't need too much convincing of that.


    tho there is something that maybe does? not sure whether your comment about peak detectors means you tried it out or not, but as i was saying of envelope detectors: well first off i realized it would implicitly challenge the glorious purpose you'd found for your ILO rectifier then it took another minute to realize no it wouldn't lol, its not some XOR proposition

    so , if we were to get into fancy peak/env detector stuff there is an obvs & elegant way to do so without giving up oversampled ILO rectification


    doyeeeee. anyway just hear me out because its interesting. certainly there's only so much a thing can sound like a radio and even were the addition of this to overshoot that point and continue on dragging a parking cone with it, something its doing is neat that i can't get my head around. ofc i did due diligence of blasting the output LP and envelope detector with white noise to make sure it wasn't just doubling up similar frequency responses with the power of imagination. well, it is double filtering, but with some notable differences that "let me show you its features"


    ***


    alright well, bad news. i've already put this reply off, so hope you like cliffhangers, because the behavior i was going to reference is no longer happening... not only that but i checked audio recordings i made of it yesterday and its missing from them too.. it was a marked cramping above around 10k that could be coaxed into behaving weirdly that i'd earmarked as serendipitous non linear time invariant radio magic


    LOL



    well, shucks. i'll leave as a spooky bookend the following fragments of my first go at a write up of the now missing behavior (certainly i've missed something, this has to shake out πŸ€”):


    t provides some filtering but seems to attenuate the bad noise between stations more than it does the baseband. i blasted white noise thru both of em just to be sure it was doing something measurably different than the demod lowpass, it looks like cramping and some kind of high shelf which i've concluded sounds plausible as a source of

    actually, its a bit mysterious. tune inbetween stations and AB the env detector version against normal, and the normal one has a crud on top sound that the envelope detector seems to selectively attenuate. noticing that a value of 1 usually makes it to the release input

  • Laureano Lopez
    Laureano Lopez Member Posts: 102 Advisor

    had wanted to get in and waylay notions of frequency shifters needing to be in the discussion

    I didn't give that more thought merely because it makes my brain hurt, though it's entirely possible that it does help with imaging. It's also way too complicated to be of any use in a cheap analog radio, and we know this would be much simpler in digital anyway 😁

    first off i realized it would implicitly challenge the glorious purpose you'd found for your ILO rectifier then it took another minute to realize no it wouldn't lol, its not some XOR proposition

    Yep, you would still need either the rectifier (to get ARV, average rectified value) or a square on the input and a square root on the output (to get RMS). What the attack/release filters do replace is the 4-pole Butterworth lowpass. See, the attack/release pair is a lowpass, it's just biased to have different speeds (hence cutoffs) on raising and falling slopes. This is useful for something like compression, where the envelope is used to compute a gain, and you want this gain to behave asymmetrically. Here, the envelope is not a control signal, it's the actual audio. That's why I think an asymmetric filter is not useful. Say you're modulating a 1 Hz tone on a 10 Hz carrier:

    You add 1 to your modulator to make it fully positive, then multiply by the carrier. At the receptor, you take abs and the shape of the modulator appears:

    If you hadn't made your modulator fully positive, you'd get overmodulation and a rectifier wouldn't be able to reconstruct the signal without distortion:

    Now, look at the upper right image. To recover the original signal, you need to lowpass the orange thing. If your lowpass were biased to be faster on raising slopes, you'd get a sine that's rougher when it raises. That's not right, is it? Envelopes of audio signals usually raise faster than they fall, but this is not the envelope of an audio signal: it's the audio signal itself. So a plain lowpass is actually the right tool.

  • ANDREW221231
    ANDREW221231 Member Posts: 349 Pro

    yeah, i arrived at the same conclusion after hammering out a bit of rigor. i have no idea where that cramping came from but it was a hum dinger red herring showing up exactly once for a hail mary ig to confuse me one last time. there was one weird behavior i kinda nailed down where tuning between stations to a spot where an annoying image whistle would pop out, then tweaking the release setting slightly which would basically cut out that single frequency without cutoff or neighboring sound changing much. dunno, if i've learned one thing is there are all kinds of ways to get sounds to lose bits of themselves here and there, i no longer intend on getting to the bottom of it

    did figure out that what i like about the sound of the env gen tho, pretty sure it's that it has a gentler rolloff than the conventional LP


    so yeah 'stay tuned for part 2' maybe lasted five minutes then gave up our time to the frequency shifter heterodyne!! which was a good move. has 4 stations but it does them well... looking at your 'oversampled heterodyne airspace' where stations mix with the local oscillator and daaaaaamn it's more chaotic than i thought. the way it sounds i was surprised to see it looked like that. like an intersection in new dheli

    in mine the heterodynes keep an orderly queue, nothing crosses over anything but its all an act for the sake of the middle . like a theater performance, one step off stage left is instant parkour somersaults to get out of the way, stage right holding formation to one step of certain death. all to maintain an illusion of bandwidth that's extremely scarce

    took some doing, like killing carriers approaching DC at the last second without terrible DC pops. wouldn't you still have had to deal with that... carriers approaching 0 and mirroring back up, or did oversampling give you enough headroom to avoid it?

  • ANDREW221231
    ANDREW221231 Member Posts: 349 Pro

    Envelopes of audio signals usually raise faster than they fall, but this is not the envelope of an audio signal: it's the audio signal itself. So a plain lowpass is actually the right tool.



    btw this all tracks but i think i badly explained as the way i'm using the envelope detector doesn't have problems to recover the signal, in use it works just fine its just maybe not as beneficial as i originally thought. really it only uses the attack phase and even then just as a tool to darken the sound to taste. there's a good chance a 1p could fulfill the same role perfectly but yeah the 'demod LP' in my upload while labelled as a lowpass is in fact the very detector


    the blown valve is as well, basically applying the demodulation process again to the demodulated signal as a cheap way to get even order distortion and a bit sketchy, not sure i love it but


    DC offset can be used to adjust loudness of tuning whine and in combination with demod LP as a tone control offers pretty good control for dialing in desired radio sound

  • Laureano Lopez
    Laureano Lopez Member Posts: 102 Advisor

    did figure out that what i like about the sound of the env gen tho, pretty sure it's that it has a gentler rolloff than the conventional LP

    Yep, the attack/release pair is 1-to-2-pole, 6 to 12 db/oct. I was using a 4-pole lowpass, 24 db/oct. The faster rolloff allows a higher cutoff, so less of the original signal is lost.

    really it only uses the attack phase and even then just as a tool to darken the sound to taste.

    If you set the release gain to 1, which effectively bypasses the release filter, the remaining attack filter is just a 1-pole lowpass, 6 db/oct. I guess in your arrangement you didn't need to filter out much, so you're actually using the filter to get a darker tone. A gentle 1- or 2-pole lowpass would be just fine for that.

    I'll take a look later at the frequency shifting stuff, can't parse it on the fly and the neighbor's dog barking doesn't help at all πŸ˜…

  • ANDREW221231
    ANDREW221231 Member Posts: 349 Pro

    shifting is probably the way to do it, as there's no aliasing or roving images to worry about. not sensible to try doing things the real way if the computer is just going to punish you for it. now that i'm thinking about it.... if the whole point was the heterodyne woosh of stations shifting into their proper frequency why did no one think of putting the signal onto carrier waves of fixed distance and adjust their tuning globally to be wherever as needed?


    actually i take that back. would have ended the fun prematurely with a meek hop over the finish line


    might be the way to get something that works correctly without having to force it every step of the way like i had to


    If you set the release gain to 1, which effectively bypasses the release filter, the remaining attack filter is just a 1-pole lowpass, 6 db/oct. I guess in your arrangement you didn't need to filter out much, so you're actually using the filter to get a darker tone. A gentle 1- or 2-pole lowpass would be just fine for that.

    yeah, i think there was some logic in your doohickey for handling control input that kept it at 1 going into the filter and i didn't notice for a while, that's when i found all it would do for my cause was add bad things ad DC and nyquist. maybe that was the secret ingredient 😎

    I'll take a look later at the frequency shifting stuff, can't parse it on the fly and the neighbor's dog barking doesn't help at all πŸ˜…

    oh yeah, i wouldn't spend the effort to grok the structure, its just an over designed custom solution to force a smooth virtual run of heterodyne-like-behavior at the cost of an actual heterodyne architecture . like, multiple shifters will get the work done but there were a lot of weird edge case stuff at transitions that needed hunting down and patched on an individual basis. i think the output is more or less what its 'supposed to be' though (i mean actually an audio reference to be certain wouldn't be a bad idea, as far as 'just thinking stuff' goes this would represent poor stewardship to leave opportunity on the table)

  • ANDREW221231
    ANDREW221231 Member Posts: 349 Pro
    edited October 2022

    also i think i brought up the just tuning sine waves thing to colin and he said something about positive images that outstripped my ability to visualize. left on the backburner on the justification its better to avoid positive sidebands altogether since analog only has to worry about them once, but in digital you're stuck with them forever


    but maybe swooshes from the other direction are missing from mine. heck

This discussion has been closed.
Back To Top