Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 13:02 18 Sep 2025 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 : Improved filter for WAV file playback....

Author Message
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9644
Posted: 11:48pm 03 Feb 2017
Copy link to clipboard 
Print this post

Hi all.

I found these very interesting images and schematic for an RLC low-pass-filter on the web tonight:









All these screenshots are captured from this website.

What I like about this one, is that it's output waveform seems very respectable vs input PWM signal, and as it was designed to work with the 8-bit Arduino PWM output, this should jive perfectly with the 8-bit PWM output from the MM+ and it's new WAV playback feature.

Do any of the members have any thoughts or comments on this?

EDIT: For those who want to read about the mathematics of this filter, you can find out about it here. Edited by Grogster 2017-02-05
Smoke makes things work. When the smoke gets out, it stops!
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10406
Posted: 12:19am 04 Feb 2017
Copy link to clipboard 
Print this post




This is the waveform I get with the existing single pole filter - 500Hz sine wave

The MM+ and 200MHZ MZ use a 80KHz PWM rather than the 32KHz used in the Arduino example. The 252MHz MZ uses 96KHz

The filter above is set too low as the WAV output can cater for 16Khz input sample rates on the MM+ and 200MHz MZ. The 252MHz MZ can also use inputs with 48MHz sample rates.

There is no doubt the Chebyshef would do a better job but this is probably a case of diminishing returns




 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9644
Posted: 12:36am 04 Feb 2017
Copy link to clipboard 
Print this post

Hi there.

That CRO shot of the actual MM+ output is excellent - that works for me.

Is this with the filter on page 23 of the advanced manual?
2x 2k, 47nF and 1k per channel.

Chebyshef filter idea aborted.

As I did not see that waveform on the output of the MM+ until you posted the photo above, I was not aware it was actually THAT clean, so we'll just ignore this thread now.
Smoke makes things work. When the smoke gets out, it stops!
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10406
Posted: 01:12am 04 Feb 2017
Copy link to clipboard 
Print this post

The filter in Geoff's circuit is just 1K into 47nF. The rest is a potential divider. The picture was actually taken from the output of the LM386 on my 100-pin MZ board. The biggest issue with sound is making sure the input and outputs from the amp aren't clipping.

In my case the amp is fed with 5V and has a 20x gain so I need to make sure the input signal is something less than 250mV. I'm using 4K7 and 270R to do this. I'm also AC coupling Geoff's circuit to the input of the amp using a 0.47uF polyester capacitor
 
Cremo
Newbie

Joined: 21/07/2015
Location: Italy
Posts: 36
Posted: 12:28am 05 Feb 2017
Copy link to clipboard 
Print this post

I need help:
I did some tests with PLAY WAV and I obtained very bad results.
At 1Khz i measured a distortion of about 5%. Maybe the file I prepared was not correct.
I would like to know if someone measured values like the ones obtained with Arduino (50dB that is a distortion of about 0.3%).
Maybe my file is not correct ?

Thank you.

Pietro
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10406
Posted: 01:04am 05 Feb 2017
Copy link to clipboard 
Print this post

  Quote  At 1Khz i measured a distortion of about 5%.


If you created a file with 8KHz sampling rate then you only have 8 samples per waveform so 5% seems about right. The PLAY TONE command with a 1Khz output has 80 samples per waveform.

A 16hz wav file would be better but still not great

The MZ at 252MHz can output 48 samples per 1KHz waveform at 1KHz from a WAV fileEdited by matherp 2017-02-06
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9644
Posted: 01:11am 05 Feb 2017
Copy link to clipboard 
Print this post

So, does that mean that with 16kHz samples, the distortion should be in the area of 2.5% then?

Just curious.....
Smoke makes things work. When the smoke gets out, it stops!
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025