Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 12:52 28 Nov 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : PM audio LPF....wow....

     Page 3 of 4    
Author Message
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 6798
Posted: 07:00am 13 Jun 2023
Copy link to clipboard 
Print this post

Fair enough, Bill. :) I'm not trying to change your mind, but I feel that it's important to explain *why* we have filters and what they do. As I said, I'm not going to test the theory just in case it's correct. :) It does *look* correct to me and specs seem to back me up.

Early CD players, in the days before oversampling and using the 44.1kHz carrier, incorporate a "brick wall" filter at about 20kHz precisely to do what Volhout's filters do (you can't produce audio at any higher than than half the carrier frequency so these filters have to be very steep to be effective). Later players oversample, doubling (or even much more) the Nyquist frequency (the effective sample rate), so the filter can have a less steep slope and still allow audio up to and even above 20kHz. Getting rid of the 44kHz isn't a new thing. It was invented as a necessity with PCM.

Incidentally, 44100 is 2x2x3x3x5x5x7x7 so it's a rather interesting number and may have been chosen because of the way in which it is calculated.
Edited 2023-06-13 17:20 by Mixtel90
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9308
Posted: 08:50am 13 Jun 2023
Copy link to clipboard 
Print this post

Even in LPFM(Low Power FM), the audio processing is expected to pass via a 15kHz "Brick-wall" LPF of some sort.  The idea is to SERIOUSLY attenuate the audio above 15kHz, so that the audio signal cannot screw with the stereo pilot tone at 19kHz, which would affect the receiver's ability to detect a stereo FM transmission.

Without said filter, any HF audio would cause the receiver to switch between stereo and mono at the will of the audio signal.  Not a good result on your radio if it is swapping between stereo and mono many times per second.

Filters like this and the MM one from Volhout are a wonderful thing, and have been in use for decades, and there IS a reason for needing and having them.
Smoke makes things work. When the smoke gets out, it stops!
 
ice2642

Regular Member

Joined: 27/05/2023
Location: Brazil
Posts: 82
Posted: 12:19am 18 Jun 2023
Copy link to clipboard 
Print this post

Yes, I do not read the silicon chip article, just buy the board, I hope they send instructions with it.

I build the LPF very simple, and it work in simple way too :)








I intend to do another one.

Someone out there calculated the diameter, thickness and quantities of spirals to make the 4.7mf inductor ??? Did you need any iron-type stuffing or did you use air?

Best Regards,
Edited 2023-06-18 10:24 by ice2642
MMBasic 5.0707 on PicoMite VGA
 
Turbo46

Guru

Joined: 24/12/2017
Location: Australia
Posts: 1611
Posted: 02:50am 18 Jun 2023
Copy link to clipboard 
Print this post

I don't think that anyone has wound their own inductor. They have bought them. Somebody may be able to tell you where to buy the 4.7mH inductors.

This is the original filter circuit from an earlier manual. The 2k2 resistors reduce the output level to a more suitable level.




Bill
Keep safe. Live long and prosper.
 
stanleyella

Guru

Joined: 25/06/2022
Location: United Kingdom
Posts: 2129
Posted: 03:14pm 18 Jun 2023
Copy link to clipboard 
Print this post

"Someone out there calculated the diameter, thickness and quantities of spirals to make the 4.7mf inductor ??? Did you need any iron-type stuffing or did you use air?"
I got a component tester, one that measures inductors, most do so could hand wind around a 1MR resistor with varnished copper wire from a transformer but I bought a 5 pack of 4.7mH inductors ebay £2 free p&p. Why bother making?
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 6798
Posted: 03:35pm 18 Jun 2023
Copy link to clipboard 
Print this post

An air-cored 4.7mH inductor, using 0.25mm wire is about a 90mm cube. You really don't want to be winding one. :)
You can buy one here
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
stanleyella

Guru

Joined: 25/06/2022
Location: United Kingdom
Posts: 2129
Posted: 03:45pm 18 Jun 2023
Copy link to clipboard 
Print this post

  Mixtel90 said  An air-cored 4.7mH inductor, using 0.25mm wire is about a 90mm cube. You really don't want to be winding one. :)
You can buy one here

Ha! Ha!
https://www.ebay.co.uk/itm/223659223294?
 
ice2642

Regular Member

Joined: 27/05/2023
Location: Brazil
Posts: 82
Posted: 06:27pm 18 Jun 2023
Copy link to clipboard 
Print this post

Thanks, i will buy one :)
MMBasic 5.0707 on PicoMite VGA
 
stanleyella

Guru

Joined: 25/06/2022
Location: United Kingdom
Posts: 2129
Posted: 07:25pm 18 Jun 2023
Copy link to clipboard 
Print this post

I am coding a "scope" and connected the sound pin playing tone to adc pin and all I got was a square wave , no filter. I'll try with filter later
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 6798
Posted: 07:42pm 18 Jun 2023
Copy link to clipboard 
Print this post

If that square wave was from an audio pin then, unless you are using PLAY SOUND to get a square wave, it's probably the 44.1kHz carrier. You can't see the audio at all without a filter of some sort because it doesn't exist as audio. :)

Edit:
Ah, I'd missed that you were using a PWM signal for the test. :)  That one is square if it's 50%.
Edited 2023-06-19 05:47 by Mixtel90
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
stanleyella

Guru

Joined: 25/06/2022
Location: United Kingdom
Posts: 2129
Posted: 08:49pm 18 Jun 2023
Copy link to clipboard 
Print this post

Thought so, no hint of sine wave, just carrier , looks like pwm 40KHz.
This is the filtered 10KHz tone
filter is important for sound so regards to the designer

Edited 2023-06-19 07:33 by stanleyella
 
ice2642

Regular Member

Joined: 27/05/2023
Location: Brazil
Posts: 82
Posted: 07:28pm 27 Jun 2023
Copy link to clipboard 
Print this post

My picomite vga arrive yesterday, and now it is done and working fine.

I am waiting now the parts for the sound

The quality of the board is very good, but the PS2 role for fixation is missing, I cut of the 2 pins, and ok, just care now when I plug the keyboard.







Stanley , your wav it's show very good.

Best Regards,
MMBasic 5.0707 on PicoMite VGA
 
stanleyella

Guru

Joined: 25/06/2022
Location: United Kingdom
Posts: 2129
Posted: 01:44pm 28 Jun 2023
Copy link to clipboard 
Print this post

10KHz Tone. My simple scope code to improve. Needs sync. For 160x80 LCD.

 dim count%,sync!,sync2!
 Dim samples!(160)
 Dim old_samples!(160)
PLAY TONE 10000,10000,60000
 SETPIN GP26, AIN
 'SetPin GP18,pwm1A 'this optional test signal comment out
 'PWM 1,5000,50   ' 50% = square wave ,this optional test signal comment out
 
 Pause 100
 adc open 500000,1 'samples per second
 cls
 adc start samples!()'get new samples
 
 for count%=0 to 159
   samples!(count%)=(samples!(count%)*20)+10 'scale 3V samples to 0 to 79 pixels
 next count%
 
 for count%=0 to 159
   old_samples!(count%)=samples!(count%) 'copy samples to old_samples
 next count%

 for count%=0 to 158
   line count%,samples!(count%),count%+1,samples!(count%+1),,rgb(white) 'draw first samples
 next count%
'-------- main loop
 do
   adc start samples!() 'get new samples
  '
   for count%=0 to 159
     samples!(count%)=(samples!(count%)*20)+10 'scale 3V samples to 0 to 79 pixels
   next count%
  '
   for count%=0 to 158
     line count%,old_samples!(count%),count%+1,old_samples!(count%+1),,rgb(black) 'erase old_sample
     line count%,samples!(count%),count%+1,samples!(count%+1),,rgb(white) 'draw new sample
   next count%
  '
   for count%=0 to 159
     old_samples!(count%)=samples!(count%) 'copy samples to old_samples
   next count%
 loop
end

 
stanleyella

Guru

Joined: 25/06/2022
Location: United Kingdom
Posts: 2129
Posted: 04:12pm 28 Jun 2023
Copy link to clipboard 
Print this post

vga version

mode 2
dim count%,sync!,sync2!
Dim samples!(320)
Dim old_samples!(320)
PLAY TONE 1000,5000,600000
SETPIN GP26, AIN
'SetPin GP18,pwm1A 'this optional test signal comment out
'PWM 1,5000,50   ' 50% = square wave ,this optional test signal comment out

Pause 100
adc open 500000,1 'samples per second
cls
adc start samples!()'get new samples

for count%=0 to 319
  samples!(count%)=(samples!(count%)*60)+10 'scale 3V samples to 0 to 79 pixels
next count%

for count%=0 to 319
  old_samples!(count%)=samples!(count%) 'copy samples to old_samples
next count%

for count%=0 to 318
  line count%,samples!(count%),count%+1,samples!(count%+1),,rgb(white) 'draw first samples
next count%
'-------- main loop
do
  adc start samples!() 'get new samples
 '
  for count%=0 to 319
    samples!(count%)=(samples!(count%)*60)+10 'scale 3V samples to 0 to 79 pixels
  next count%
 '
  for count%=0 to 318
    line count%,old_samples!(count%),count%+1,old_samples!(count%+1),,rgb(black) 'erase old_sample
    line count%,samples!(count%),count%+1,samples!(count%+1),,rgb(white) 'draw new sample
  next count%
 '
  for count%=0 to 319
    old_samples!(count%)=samples!(count%) 'copy samples to old_samples
  next count%
  pause 1000
loop
end

 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 4247
Posted: 04:19pm 28 Jun 2023
Copy link to clipboard 
Print this post

Tip: you can replace the for I=0 to 159 loops with MATH commands.
Math commands can perform offset and gain calculations on the whole array in one instruction
Also copy one array to another.

Volhout

P.s. I think the thread derailed a bit from it’s topic.
Edited 2023-06-29 02:23 by Volhout
PicomiteVGA PETSCII ROBOTS
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 6798
Posted: 04:31pm 28 Jun 2023
Copy link to clipboard 
Print this post

Don't be tempted to connect the input to a different signal source without protecting the PicoMite. This will give it some protection.


                3V3
                 !
                ---
                / \
                 !
input-----10k-----+----ADC pin
                 !
                ---
                / \
                 !
                 !
                GND



To be useful you'll probably need to use an op-amp to get some gain as a first stage. (With protection again! You can't win).
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 4247
Posted: 06:39am 29 Jun 2023
Copy link to clipboard 
Print this post

@stanleyella

for count%=0 to 319
 samples!(count%)=(samples!(count%)*60)+10 'scale 3V samples to 0 to 79 pixels
next count%


is the same as

math scale samples!(),60,samples!() 'multiply a() by 60
math add samples!(),10,samples!() 'add 10 to a()




and here

or count%=0 to 319
 old_samples!(count%)=samples!(count%) 'copy samples to old_samples
next count%


is the same as

math add samples!(),0,old_samples!() 'copies a() to b()

Edited 2023-06-29 16:41 by Volhout
PicomiteVGA PETSCII ROBOTS
 
stanleyella

Guru

Joined: 25/06/2022
Location: United Kingdom
Posts: 2129
Posted: 02:31pm 29 Jun 2023
Copy link to clipboard 
Print this post

Thank you @Volhout. picomite non vga manual pages 131,132- Math. no mention of math add or math scale? I have a scale function.
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9129
Posted: 02:35pm 29 Jun 2023
Copy link to clipboard 
Print this post

That's because it is a command and not a function see page 108 in the latest manual
 
stanleyella

Guru

Joined: 25/06/2022
Location: United Kingdom
Posts: 2129
Posted: 03:20pm 29 Jun 2023
Copy link to clipboard 
Print this post

  matherp said  That's because it is a command and not a function see page 108 in the latest manual


page 104-107 in my non vga manual which I thought up to date. 10th june 23.
Ta for bringing it to my attention. I want my code to run as fast as possible sometimes. Thanks all. stan...... How many countries got stan in their name?
 
     Page 3 of 4    
Print this page
© JAQ Software 2024