Page 2 of 3

Re: jvok's Sleazy Listening stereo coder

Posted: Wed Feb 22, 2023 10:09 am
by LeeCavanagh
Is the 4th 178hz or is that some other magic number ?

What do you use for online streaming Albert? The one previously mentioned or something else ?
And can I have a listen please.
Then you can tell me if I’m going down the wrong road.
I know there is no right way but there is certainly a wrong way :)
I’m using some good vst plugins (more for production really) , I know I know, but they still have all the needed crossovers EQ compression over sampling look ahead n stuff, so whilst I’m not about to make anything like above, I just wanted to give myself something to do, I can always open my mind to a better way to achieve the sound I like to hear on my internet station which I’m tweaking every day early in the morning ,
thanks for the info (and a few other bits of info I found that has your hallmark).

Re: jvok's Sleazy Listening stereo coder

Posted: Wed Feb 22, 2023 11:48 pm
by sinus trouble
This is really interesting stuff! :)

Just to clarify i am on the same page? And to simplify for others who may not understand?

Sample rates are based on the number of say "Snapshots" of a signal as it changes? the higher the sample rate, the higher the resolution of the waveform?

So therefore in the case of this encoder, 8 transitional states are used to rebuild or recreate the signal?

Please feel free to correct me if i am completely wrong? :lol:

Re: jvok's Sleazy Listening stereo coder

Posted: Thu Feb 23, 2023 12:51 am
by LeeCavanagh
I can’t do math :)
I was thinking of EQ

Re: jvok's Sleazy Listening stereo coder

Posted: Thu Feb 23, 2023 1:07 am
by jvok
sinus trouble wrote: Wed Feb 22, 2023 11:48 pm Sample rates are based on the number of say "Snapshots" of a signal as it changes? the higher the sample rate, the higher the resolution of the waveform?

So therefore in the case of this encoder, 8 transitional states are used to rebuild or recreate the signal?
Yeah thats exactly right.

My schematic uses 16 states although the logic isn't right yet. Alberts pro iv uses 8 for the stereo mpx and 16 for the pilot

Re: jvok's Sleazy Listening stereo coder

Posted: Fri Feb 24, 2023 12:49 am
by sinus trouble
Cheers Jvok :)

Perspective from Albert and also Rev i find mind blowing!! Also brilliant!!!

Your concept of keeping things simple resonates with me too!

Lee Cavanagh Commented "I Cannot do Maths" This statement with respect is not entirely true!

Maths can be daunting? But it looks more complicated than it is! :)

Re: jvok's Sleazy Listening stereo coder

Posted: Fri Feb 24, 2023 1:38 am
by LeeCavanagh
;)

I can do math but I don’t like it, my dad is a maths genius so I feel inadequate.
It’s not stopped me earning as much as he did , that’s the only benchmark to go off, lol.

Respect to you guys for all the projects, if I knew what each thing did, I guess it’s a bit like my coding (or being a chef), putting together the right combo and following its own logic ‘ patterns ‘ outcomes ‘ re-evaluation …

Re: jvok's Sleazy Listening stereo coder

Posted: Fri Feb 24, 2023 1:55 am
by Albert H
Just as an aside, Lee:

When i was learning electronic engineering fundamentals (way back, in my youth) my Father (who was an Electrical Engineer of some repute) taught me the mathematics I needed. I remember him saying:

"Mathematics is just another tool in your toolbox. It's as important as any of the other tools or instruments you use, and a good understanding of it can be a real time-saver." Over 40 years of professional experience shows me that he was exactly right!

Re: jvok's Sleazy Listening stereo coder

Posted: Wed Mar 01, 2023 10:54 pm
by jvok
Right here's v2, I tried to incorporate everyones suggestions (especially yours Albert).
  • Changed the active filters out for a MAX7411 switched capacitor filter. This is a 5-pole elliptical filter similar to the old Toko modules so has much better rejection at 19kHz (should be >35dB down)
  • Changed the output reconstruction filter to an active design. This is a 4-pole Bessel filter with ~60kHz cut-off so is pretty similar to the Pro IV filter (but with different component values)
  • Got rid of the pilot filter, this isn't needed when the output filter does the same thing
  • Added an active mixer to combine MPX and pilot, so the pilot level control doesn't affect the MPX level (I had spare opamps so might as well)
  • Changed the 4060 for a PIC. This is mainly so I can generate the 1.5MHz clock for the filters (which I can't do with a 4060), but also means I can get 16x MPX/32x pilot oversampling with no extra chips. I know 8x is good enough but might as well do it if its free (besides a few cheap resistors)
  • SYNC out is now 5V TTL
The 16x oversampling works by reversing the sequence half way through, so it counts 0-1-2-3-4-5-6-7-7-6-5-4-3-2-1-0 then repeats. This takes advantage of the sine wave's symmetry to double the number of samples so you can get 16x oversampling with only a single 4051. Whereas a 4060 can only count in one direction (0-1-2-3-4-5-6-7 then repeat) so can only get 8x oversampling without adding more chips or using a 4067 (which is obsolete).

The pilot gets 32x oversampling using the same technique to generate only half a sine wave. To generate the full sine wave the input to the resistor ladder is inverted every half cycle, so it will generate 16 steps positive and 16 steps negative (32 total). The signal you need to do this is just a 19kHz square wave so this can also be fed to the SYNC out.

I think the timing on the PIC code will be really tight so I'm gonna order some parts and try it on a breadboard first.
mpx1.png

Re: jvok's Sleazy Listening stereo coder

Posted: Thu Mar 02, 2023 12:57 am
by Albert H
Jvok - just a couple of small points:

1..I'd be inclined to relabel your "Gndref" as "midrail" - it makes the operation of the circuit rather more obvious.

2. Experience shows that it's a good idea to put protection diodes from the inputs of the pre-emphasis op-amps to ground. I usually use bi-directional LEDs - in this case I'd put them across C3 and C4 - and this protects the sensitive inputs of those op-amps.

3. I'd probably choose NE5532 for the pre-emphasis stages and for the output filter. I was very surprised when I looked at the noise that comes from the TL074 (even though Texas Instruments describe them as "low noise") - the NE5532 or the LM833 is more current-hungry, but is very much quieter! Also, the NE5532 will withstand more abuse than the TL07X series!

I'll be interested in the results you get from your design.

My latest switching coder iteration has two 8-times oversampled modulators - the usual one to generate a 38 kHz centred subcarrier, and a secondary one centred on 114kHz. The 114kHz image is inverted and added in the appropriate amount to null the 114kHz spur generated by the 38khz modulator. The higher harmonic products are easily handled by the output filter, and the spectrum of the latest version is significantly improved over the basic 8X oversampled version!

Re: jvok's Sleazy Listening stereo coder

Posted: Thu Mar 02, 2023 5:42 am
by 3metrejim
sinus trouble wrote: Wed Feb 22, 2023 11:48 pm This is really interesting stuff! :)

Just to clarify i am on the same page? And to simplify for others who may not understand?

Sample rates are based on the number of say "Snapshots" of a signal as it changes? the higher the sample rate, the higher the resolution of the waveform?

So therefore in the case of this encoder, 8 transitional states are used to rebuild or recreate the signal?

Please feel free to correct me if i am completely wrong? :lol:
If you did any radio circuitry in the early 2000's you would have probably used these references. I'm really surprised that they are still up after nearly 25 years. Apologies in advance for the ad overload on the tripod site.

https://transmitters.tripod.com/stereo.htm
https://www.qsl.net/n9zia/lpfm/index.html

Bonus: If you need 4.864MHz crystals and are in the UK, mouser has hundreds in stock (and at a price less than I bought some for 25 years ago!)

Re: jvok's Sleazy Listening stereo coder

Posted: Sun Mar 05, 2023 12:14 am
by sinus trouble
Yes 3metrejim :)

Indeed, i was browsing those sites and they bring back some great memories!

I look forward to see what Jvok comes up with! :)

Re: jvok's Sleazy Listening stereo coder

Posted: Sun Mar 05, 2023 7:06 pm
by Krakatoa
jvok wrote: Wed Mar 01, 2023 10:54 pm Right here's v2, I tried to incorporate everyones suggestions (especially yours Albert).
  • Changed the active filters out for a MAX7411 switched capacitor filter. This is a 5-pole elliptical filter similar to the old Toko modules so has much better rejection at 19kHz (should be >35dB down)
  • Changed the output reconstruction filter to an active design. This is a 4-pole Bessel filter with ~60kHz cut-off so is pretty similar to the Pro IV filter (but with different component values)
  • Got rid of the pilot filter, this isn't needed when the output filter does the same thing
  • Added an active mixer to combine MPX and pilot, so the pilot level control doesn't affect the MPX level (I had spare opamps so might as well)
  • Changed the 4060 for a PIC. This is mainly so I can generate the 1.5MHz clock for the filters (which I can't do with a 4060), but also means I can get 16x MPX/32x pilot oversampling with no extra chips. I know 8x is good enough but might as well do it if its free (besides a few cheap resistors)
  • SYNC out is now 5V TTL
The 16x oversampling works by reversing the sequence half way through, so it counts 0-1-2-3-4-5-6-7-7-6-5-4-3-2-1-0 then repeats. This takes advantage of the sine wave's symmetry to double the number of samples so you can get 16x oversampling with only a single 4051. Whereas a 4060 can only count in one direction (0-1-2-3-4-5-6-7 then repeat) so can only get 8x oversampling without adding more chips or using a 4067 (which is obsolete).

The pilot gets 32x oversampling using the same technique to generate only half a sine wave. To generate the full sine wave the input to the resistor ladder is inverted every half cycle, so it will generate 16 steps positive and 16 steps negative (32 total). The signal you need to do this is just a 19kHz square wave so this can also be fed to the SYNC out.

I think the timing on the PIC code will be really tight so I'm gonna order some parts and try it on a breadboard first.

mpx1.png
Reading about your updated design, it reminded me I have seen someting similar (maxim IC switched capacitor filter, microcontroller...) and voilà, a french dude came up with this a while ago...:

http://radioinitiation.chez-alice.fr/en ... 20pro.html

Re: jvok's Sleazy Listening stereo coder

Posted: Sun Mar 05, 2023 8:35 pm
by Albert H
Looking at the French coder, there are a few things I'd change - the inductive output filter will ring horribly, and is certain to introduce phase shifts that will adversely affect the S component. That "limiter" looks like overkill, and will just introduce noise and distortion. I can't imagine why he's dimensioned the circuit for only 710mV out - in proximity to a transmitter, that's just asking for trouble! The DG201 analogue switches he's used are very expensive, and not really better than the 4053 and 4066 we've all traditionally used.

One product we did for a large broadcasting organisation actually specified those AD switches for the coder, which made the product significantly more expensive, and didn't offer any measurable improvement in performance. They also specified the op-amps we were to use (Analog Devices parts again), and demanded that we used Bournes trimmers from a particular range (and supplier!). I began to suspect that their chief engineer was getting a kickback from the parts suppliers (or he just had a fetish about seeing expensive AD and Maxim parts all over "his" boards!).

As a general rule, high-priced components are usually just expensive because they're scarce, not really because they're any better than generic parts. Fro example, my gram RIAA preamp uses cheap and cheerful NE5542 op-amps, and is quieter and has less distortion than many of the exotic preamps that the "audiophools" spend thousands on. I also don't bother with "audio grade" electrolytics, or other expensive parts. The topology of my gram preamp is slightly unusual, because of the order in which I do the equalisation - HF first, LF in the second stage. The advantage of this is that the high frequency clicks and pops from worn records get attenuated early on, preventing the high transient spikes that cause massive distortion in some competing circuits. It also costs virtually nothing to build, and the ones I have in my studio are powered by rechargeable batteries - this keeps the supply nicely pure, and costs virtually nothing to run! The only downside is that I have to remember to turn them off after use. The latest iteration of the gram preamp uses balanced input from the pickup (it's just a quick change to the headshell wiring), and completely eliminates any mains hum pick-up!

Re: jvok's Sleazy Listening stereo coder

Posted: Sat Mar 18, 2023 1:05 am
by jvok
First results from 32x oversampled pilot, theres a lot of noise spikes all over the place. I think these are the stray capacitance charging up because the source impedance is so high coming through the resistor chain
IMG_20230318_003844180_HDR.jpg
Taking out the 24k series resistor brings the level up to 5V pk-pk but gets rid of the spikes, which I think confirms the theory
IMG_20230318_004023470_HDR.jpg
Zooming in on the transitions there's still some nastiness but nowhere near as bad as before. I'm gonna try dropping all the resistor values by a factor of 10 and see if that improves things but I think the filter will clean most of this up anyway
IMG_20230318_004238055.jpg

Re: jvok's Sleazy Listening stereo coder

Posted: Sat Mar 18, 2023 1:35 am
by jvok
Adding some capacitance from the 4051 output to ground cleans up the spikes a bit but also slows down the rise time (which might not be a bad thing actually). You can see the trade off with difference cap values from 10-470p. Either way I don't think its worth trying to optimise this too much while its still on a breadboard

10p:
10p.jpg
47p:
47p.jpg
100p:
100p.jpg
470p:
470p.jpg

Re: jvok's Sleazy Listening stereo coder

Posted: Sat Mar 18, 2023 6:39 pm
by 3metrejim
Make sure the PIC is outputting all bits to PORTC at the same time (table lookup and write, I believe that PIC has a single cycle table lookup as it's going to be running pretty quickly -16 x 38kHz = 608Khz) and not doing something daft like setting each bit one by one, to avoid wrong outputs (with small glitches) between changes.

Also what is the purpose of C19? I would expect a DC coupling here, +/- about the centre reference. Maybe DC coupling and only something like a 1k resistor instead of 24k.

Maybe add a single RC between the Multiplexer and the opamp + input, cutoff well above 19kHz, just to filter any remaining glitches without affecting the 19kHz phase.

No way of switching to mono as each audio input will be at a slightly different level no matter how close to the zero crossover point you hold the multiplexer at.

Re: jvok's Sleazy Listening stereo coder

Posted: Sat Mar 18, 2023 10:32 pm
by jvok
3metrejim wrote: Sat Mar 18, 2023 6:39 pm Make sure the PIC is outputting all bits to PORTC at the same time (table lookup and write, I believe that PIC has a single cycle table lookup as it's going to be running pretty quickly -16 x 38kHz = 608Khz) and not doing something daft like setting each bit one by one, to avoid wrong outputs (with small glitches) between changes.
With the 4x pll I get 8 cycles to play with and the tightest loop I could come up with uses all 8 so its running flat out. Im using table lookup (MOVIW instruction to read INDF and also increment FSR1L at the same time which takes 2 cycles) followed by a MOVWF to LATC so its writing all 8 bits at once. Ill post the code when its done.

Could be slightly different propagation delays between the 3 bits causing timing issues but I think a lot of the spikes are just switching noise getting in. Which hopefully should be better once its on a pcb.
Also what is the purpose of C19? I would expect a DC coupling here, +/- about the centre reference. Maybe DC coupling and only something like a 1k resistor instead of 24k.
PIC output is 5v so 2.5v bias, rest of the circuit uses 7.5v bias. I ran out of gates on the 4504 to level shift it so just added the cap instead (I dont need full 15v swing for the pilot anyway).
No way of switching to mono as each audio input will be at a slightly different level no matter how close to the zero crossover point you hold the multiplexer at.
My idea for mono mode is to switch between the two centre taps at the full sample rate. The low pass filter should average that out to a constant audio level and clean up the switching noise (which would be no worse than in stereo mode). Not too arsed if it doesnt work, no ones spending the money on a stereo coder just to run it in mono anyway

Re: jvok's Sleazy Listening stereo coder

Posted: Sat Mar 18, 2023 11:24 pm
by 3metrejim
Instead of using a multiplexer and resistors for generating the 19kHz sinewave, why not just have a (4 bit) sinewave stored in the lookup table and use an R-2R, or weighted resistors connected to the PIC port to generate the sinewave directly, and ac couple it into the output amplifiers? You could then maybe drop the level shifter by using 3 transistors as level shifters for the main audio multiplex. Shame to tie up a quite capable PIC with what amounts to a (high frequency) sample player, if you can find a higher frequency crystal that fits the output frequencies, you might be able to add some extra functionality (status screen, blinkenlights)...

Re: jvok's Sleazy Listening stereo coder

Posted: Sun Mar 19, 2023 2:15 am
by Albert H
jvok wrote: Sat Mar 18, 2023 1:05 am First results from 32x oversampled pilot, theres a lot of noise spikes all over the place. I think these are the stray capacitance charging up because the source impedance is so high coming through the resistor chain
You can see now why I used lower value resistors in the chain in the NRG Pro IV coder! That was exactly the same problem I got when trying to use higher value resistors.

Re: jvok's Sleazy Listening stereo coder

Posted: Sun Mar 19, 2023 9:39 am
by jvok
3metrejim wrote: Sat Mar 18, 2023 11:24 pm Instead of using a multiplexer and resistors for generating the 19kHz sinewave, why not just have a (4 bit) sinewave stored in the lookup table and use an R-2R, or weighted resistors connected to the PIC port to generate the sinewave directly, and ac couple it into the output amplifiers? You could then maybe drop the level shifter by using 3 transistors as level shifters for the main audio multiplex. Shame to tie up a quite capable PIC with what amounts to a (high frequency) sample player, if you can find a higher frequency crystal that fits the output frequencies, you might be able to add some extra functionality (status screen, blinkenlights)...
Lack of suitable crystals is the main reason. I really wanted to use a 19.456mhz crystal so I could drop the 4x pll and use a cheaper pic, but the only ones I can find are smd. Also the 16f18344 has the nco block which is useful for getting a 1.5mhz clock for the filters.

The R2R thing isnt a bad idea, I thought about it but the powers of 2 steps it gives you dont make for as good a sine wave. Or in other words I get much less quantisation noise for the same number of bits with properly sine weighted resistors and a mux.

Alberts walsh idea might a good middle ground though, its still just switched resistors without a mux but keeps the proper sine weighting. Might see if I can extend the idea to 32x sampling