Filter brewing for the Soekris R2R - Page 39 - diyAudio
Go Back   Home > Forums > Source & Line > Digital Line Level
Home Forums Rules Articles diyAudio Store Gallery Wiki Blogs Register Donations FAQ Calendar Search Today's Posts Mark Forums Read

Digital Line Level DACs, Digital Crossovers, Equalizers, etc.

Please consider donating to help us continue to serve you.

Ads on/off / Custom Title / More PMs / More album space / Advanced printing & mass image saving
Reply
 
Thread Tools Search this Thread
Old 14th March 2015, 02:59 AM   #381
diyAudio Member
 
Join Date: Oct 2011
Quote:
Originally Posted by spzzzzkt View Post
No magic or special scripts required, just RTFM...

So it took all of about 30 minutes of "suck it and see" to get 99% of the way...

The sneaky trick is the --plot option. What this does with selected SoX effects is to generate a command file which allows you to plot the transfer curve of the effect in Matlab or Octave.

When I first checked using the manual example the results weren't particularly promising - the resulting file contained a couple of equations of the transfer function and plotting commands.

Next attempt using the rate option that John S discusses in posts linked earlier in the thread was a waste of time. It basically doesn't work with --plot option, so no go.

Having a look through the effects listing I noticed that the "sinc" option used the same switches as "rate" but supported --plot. Now we are getting somewhere....

So after a quick peek at the manual page...

Code:
sox --plot octave /path/to/input.wav /path/to/output.wav sinc -20k -I -n 1016 > plot.plt
Holy CRaP™!! the output plot file contained 1016 filter coefficients!

The sampling rate is based on the input.wav, so you need short (1 second is enough) files with 358.2k and 384k sampling rates for FIR1.

From the SoX "rate" documentation...


I'm excited.
That's really convenient!
Code:
sox --plot octave -v0.965 --buffer 32768 -r44100 test.wav -r352800 soxup-vMa.wav rate -vMa sinc -20k -I -n 1016 > plot.plt
Import it into matlab and so easily preview the figures with plot toolkit. But why the "b" is 1581 instead of 1016?
Attached Images
File Type: png Screenshot from 2015-03-14 09:09:17.png (162.9 KB, 371 views)
  Reply With Quote
Old 14th March 2015, 03:28 AM   #382
diyAudio Member
 
Join Date: May 2005
Location: Melbourne
Blog Entries: 1
Quote:
Originally Posted by LeonBernieniv View Post
That's really convenient!
Code:
sox --plot octave -v0.965 --buffer 32768 -r44100 test.wav -r352800 soxup-vMa.wav rate -vMa sinc -20k -I -n 1016 > plot.plt
Import it into matlab and so easily preview the figures with plot toolkit. But why the "b" is 1581 instead of 1016?
Yes that is what I've found too...
Not sure exactly why.
  Reply With Quote
Old 14th March 2015, 03:30 AM   #383
diyAudio Member
 
Join Date: May 2005
Location: Melbourne
Blog Entries: 1
OK, the SoX experiment looks promising but the sinc function is a bit different to rate.

rate bundles together upsampling, filtering and dithering in a fairly simple interface.

Quote:
rate [−q|−l|−m|−h|−v] [override-options] RATE[k]
whereas sinc is purely used for filtering.

Quote:
sinc [−a att | −b beta] [−p phase | −M | −I | −L] [−t tbw | −n taps] [freqHP][−freqLP [−t tbw | −n taps]]
This is fine as the DAM handles upsampling, and you would hope that there is some kind dithering done - although Søren has not mentioned this anywhere that I've seen.

It does mean that going from suggested rate settings is going to require a little bit of translation.

A couple of things I've noted..

The default 95% band-width in rate is referenced to -3dB point. sinc on the other hand defines the width of the transition band (default 5%) based on frequency specified at -6dB point.

By default rate is -3dB at fs/2 * 0.95. At 44.1kHz sampling rate this gives a default corner frequency at 22050*0.95 = 20974.5hz.

You can determine the corner frequency from the percentage given for -b with rate. NB: sinc uses -b to set the beta coefficient for the kaiser windowing function, so you cannot transfer the value set by -b between the two.

Another issue is that it is difficult to control the number of taps. I suspect I'm missing something in this regard that isn't 100% clear from the docs.


anyway this appears to be the easiest way to do controlled intermediate filters.

I'm a bit pushed for time, so that will have to do unless I find some spare time later today. Will be away from the Dam and laptop for a bit over a week.
  Reply With Quote
Old 14th March 2015, 07:42 AM   #384
diyAudio Member
 
Join Date: May 2005
Location: Melbourne
Blog Entries: 1
Quote:
Originally Posted by zfe View Post
In my opinion the passband for the higher sampling rate (88,96 and up) FIR1 filters should also only be something up to 20kHz while the stopband can be at higher frequencies than for the 44/48 case. At least I would wish such a filter set as option.
I think the main benefit of the higher sampling rates is that it makes live easier for building nice filters (as well for recording as for playback). All of my high sample rate recordings, I have looked at, have no content above -90dB from 18kHz, or at most 22kHz, on upwards.
... unless they are (or seem to be) converted DSD recordings which have a (noise) signal reaching higher levels above 35kHz again:
Attachment 471397
As they say "you can prove anything with statistics" Lies, damned lies, and statistics - Wikipedia, the free encyclopedia

Averaged response is great for finding underlying long term behaviours but useless for showing short term peaks in energy.

This is a spectrogram of a short segment of the HD Tracks 192/24 release of Miles Davis' So What.

Click the image to open in full size.

I've configured so that the lowest energy value displayed is -90dB. FFT size 4096 and uses a Hann window. You can see the trumpet note - which is loud - has harmonics above -90dB out to
35kHz. There are harmonics on the same note which are above -65dB out to 28kHz, and above -55dB out to 23kHz.

While it might be the case that this is above the range of hearing of most people, I'd be loathe to filter detail from a recording because there is at least the possibility it may influence perception of the audio.

http://jn.physiology.org/content/83/6/3548

Of course you are free to use what ever filters you want.

cheers
Paul
Attached Images
File Type: png So Wrong.png (279.8 KB, 1053 views)

Last edited by spzzzzkt; 14th March 2015 at 07:45 AM.
  Reply With Quote
Old 14th March 2015, 08:13 AM   #385
diyAudio Member
 
Join Date: Oct 2011
Quote:
Originally Posted by spzzzzkt View Post
Yes that is what I've found too...
Not sure exactly why.
Got it! Few parameters changed but taps got 1017 with "-n 1016".

abbreviated:

sox --plot octave -r44100 test.wav -b 24 -r352800 soxup-vMa.wav rate -vMa sinc -20000 -M -n 1015 > sox_vMa.plt

ok. 1015 taps as type.
Attached Images
File Type: png Screenshot from 2015-03-14 15:00:29.png (165.3 KB, 285 views)
File Type: png Screenshot from 2015-03-14 14:56:44.png (72.3 KB, 286 views)
  Reply With Quote
Old 14th March 2015, 08:31 AM   #386
ristar is offline ristar  Singapore
diyAudio Member
 
Join Date: Mar 2013
Quote:
Originally Posted by MisterRogers View Post
I'm really enjoying CrapMagic! Great work!
Agree! Been listening to it for the past 3hrs.
  Reply With Quote
Old 14th March 2015, 09:40 AM   #387
diyAudio Member
 
Join Date: May 2005
Location: Melbourne
Blog Entries: 1
This just a real quick and dirty one, so no graphs or details just the filter.

I came across a post by John Swenson on the Bottlehead forum in which he mention that the filter he'd settled on used 80db attenuation in the stop band, and was intermediate phase.

John also expressed a preference for short filters, but this one is 932 taps so doesn't really qualify. I'd specified something like 750 taps, but there is something else happening that is influencing the resulting number of taps. It seems if you use a linear phase the result is very close, but minimum phase blows out the tap count.

I've found that SoX creates much shorter filters if you don't attempt to specify a specific number of taps or alter the transition band from the default 5%.

Doesn't sound too bad but it's more a test case for using SoX than anything particularly refined.

cheers
Paul
Attached Files
File Type: zip A_CRaP_take_on_BH.skr.zip (5.5 KB, 38 views)
  Reply With Quote
Old 14th March 2015, 09:42 AM   #388
zfe is offline zfe
diyAudio Member
 
Join Date: Dec 2014
Quote:
Originally Posted by spzzzzkt View Post
...I've configured so that the lowest energy value displayed is -90dB. FFT size 4096 and uses a Hann window. You can see the trumpet note - which is loud - has harmonics above -90dB out to
35kHz. There are harmonics on the same note which are above -65dB out to 28kHz, and above -55dB out to 23kHz. ...
I do not advocate for a brickwall at (say) 20kHZ. All I wanted to say, for higher sample rates, the design should not aim to be perfect reproduction up next to Nyqvist. I would treat some more ripple or attenuation above 20kHz for better behavior below 20kHz.

To put things in perspective: I turned my pre amp -80dB further when I powered the DAM off and so avoided hearing its devastating power-off spzzzzkt in my speakers.

But as you said with the DAM everyone is free to use the filters he wants to use. I like CrapMagic FIR2 by the way
  Reply With Quote
Old 14th March 2015, 10:08 AM   #389
diyAudio Member
 
Join Date: May 2005
Location: Melbourne
Blog Entries: 1
Quote:
Originally Posted by LeonBernieniv View Post
Got it! Few parameters changed but taps got 1017 with "-n 1016".

abbreviated:

sox --plot octave -r44100 test.wav -b 24 -r352800 soxup-vMa.wav rate -vMa sinc -20000 -M -n 1015 > sox_vMa.plt

ok. 1015 taps as type.


With the --plot option the output wave shouldn't be created, but you still have to specify the file.

I created a 1 second file of white noise and then upsampled that to create small files at the required rate. I guess either way works well enough.

The 44.1kHz white noise wav is attached fwiw.

cheers
Paul
Attached Files
File Type: zip WN1sec.wav.zip (333.8 KB, 14 views)
  Reply With Quote
Old 14th March 2015, 10:29 AM   #390
TNT is offline TNT  Sweden
diyAudio Member
 
Join Date: Apr 2003
Location: Sweden
Quote:
Originally Posted by zfe View Post
I would treat some more ripple or attenuation above 20kHz for better behavior below 20kHz.
So would/will I. Half a dB will not do any harm. I would even trade some ripple below 20khz to get a more ideal stop band.

//
  Reply With Quote

Reply


Hide this!Advertise here!
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Soekris 's DAC implementations Eldam Digital Line Level 972 14th January 2017 06:31 PM
Sold: Soekris DAM1021 R2R DAC Eldam Swap Meet 6 6th February 2015 08:23 AM
24-bit R2R DAC using miltiple 16/18/20-bit R2R chips Marek Digital Source 21 1st April 2011 10:05 PM
project brewing in my head, challenging, but seem like a good way to try new concepts lemans23 Multi-Way 26 11th October 2005 01:29 PM


New To Site? Need Help?

All times are GMT. The time now is 10:36 AM.


vBulletin Optimisation provided by vB Optimise (Pro) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
Copyright ©1999-2017 diyAudio

Content Relevant URLs by vBSEO 3.3.2
Wiki