DIYing a DSP Processor engine. (Solution) - Page 6 - AVS Forum | Home Theater Discussions And Reviews
Forum Jump: 
 18Likes
Reply
 
Thread Tools
post #151 of 192 Old 12-19-2016, 07:44 PM - Thread Starter
AVS Forum Special Member
 
BassThatHz's Avatar
 
Join Date: Apr 2008
Location: Northern Okan range (NW Cascades region)
Posts: 7,267
Mentioned: 74 Post(s)
Tagged: 0 Thread(s)
Quoted: 2050 Post(s)
Liked: 1587
Well good news...

I was looking into the feasibility of bridging between not just ASIO, but the other sound device-types.

So I looked at the NAudio demo apps again, and at least on the output side... they have working solutions for WASAPI, DirectSound, WaveOut and ASIO.

So I think I'll just steal/hack and slash/reverse engineer that.

I might as well code all of them all at the same time.
Hopefully there are no additional gotcha's...

Input side, I'm not so sure about.

I think at this point in time there are very few apps, if any, that are able to bridge between all of these sound device-types in real-time.

This could very possibly be the first Windows app that can.

Ignoring the expensive and bloated DAW's that is (which are geared for effects-loops and music production on iMac's, rather than EQ'ing/XO'ing in Windows...)

I'm pretty sure that Windows limits non-ASIO devices to 8-ch I believe. So I'd really only be adding it for completeness, and increasing the number of supported sound cards.

7.1 might have been considered fancy 10 years ago, but not any more...
It's more like: YAWN! Is that all? Today.
Attached Thumbnails
Click image for larger version

Name:	5678.jpg
Views:	292
Size:	49.5 KB
ID:	1842065  

Last edited by BassThatHz; 12-19-2016 at 07:55 PM.
BassThatHz is offline  
Sponsored Links
Advertisement
 
post #152 of 192 Old 12-19-2016, 08:28 PM - Thread Starter
AVS Forum Special Member
 
BassThatHz's Avatar
 
Join Date: Apr 2008
Location: Northern Okan range (NW Cascades region)
Posts: 7,267
Mentioned: 74 Post(s)
Tagged: 0 Thread(s)
Quoted: 2050 Post(s)
Liked: 1587
There I got all the devices enumerated into the list.


It was as if the NAudio core was written by 3 or more different programmers (probably because it was!)
They all have their own styles of getting the device names. (Kind of a pain if you ask me, standardization people!)
Code:
            var DeviceList = new List<string>();
            //ASIO
            var ASIODevices = dsp.GetDriverNames();
            foreach (var device in ASIODevices)
            {
                DeviceList.Add("ASIO: " + device);
            }

            //DirectSound
            var DirectSoundDevices = NAudio.Wave.DirectSoundOut.Devices;
            if (DirectSoundDevices != null)
            {
                foreach (var device in DirectSoundDevices)
                {
                    if (device != null)
                    {
                        DeviceList.Add("DirectSound: " + device.Description);
                    }
                }
            }

            //WASAPI
            var enumerator = new NAudio.CoreAudioApi.MMDeviceEnumerator();
            var WASAPIDevices = enumerator.EnumerateAudioEndPoints(NAudio.CoreAudioApi.DataFlow.Render, NAudio.CoreAudioApi.DeviceState.Active);
            if (WASAPIDevices != null)
            {
                foreach (var device in WASAPIDevices)
                {
                    if (device != null)
                    {
                        DeviceList.Add("WASAPI: " + device.DeviceFriendlyName);
                    }
                }
            }

            //WaveOut
            for (int deviceId = 0; deviceId < NAudio.Wave.WaveOut.DeviceCount; deviceId++)
            {
                var capabilities = NAudio.Wave.WaveOut.GetCapabilities(deviceId);
                DeviceList.Add("WaveOut: " + capabilities.ProductName);
            }
Attached Thumbnails
Click image for larger version

Name:	5462.jpg
Views:	287
Size:	256.3 KB
ID:	1842177  

Last edited by BassThatHz; 12-19-2016 at 09:43 PM.
BassThatHz is offline  
post #153 of 192 Old 12-21-2016, 01:44 PM
AVS Forum Special Member
 
DreamWarrior's Avatar
 
Join Date: Nov 2005
Posts: 1,174
Mentioned: 13 Post(s)
Tagged: 0 Thread(s)
Quoted: 339 Post(s)
Liked: 250
Is that the input device drop-down? If so, why are there, seemingly, output devices listed therein?
DreamWarrior is online now  
 
post #154 of 192 Old 12-21-2016, 07:45 PM - Thread Starter
AVS Forum Special Member
 
BassThatHz's Avatar
 
Join Date: Apr 2008
Location: Northern Okan range (NW Cascades region)
Posts: 7,267
Mentioned: 74 Post(s)
Tagged: 0 Thread(s)
Quoted: 2050 Post(s)
Liked: 1587
Quote:
Originally Posted by DreamWarrior View Post
Is that the input device drop-down? If so, why are there, seemingly, output devices listed therein?
The computer is just doing what it was told to do.
Someone's gotta code the blue screens of death... if not me, then Who?
BassThatHz is offline  
post #155 of 192 Old 12-22-2016, 01:06 AM - Thread Starter
AVS Forum Special Member
 
BassThatHz's Avatar
 
Join Date: Apr 2008
Location: Northern Okan range (NW Cascades region)
Posts: 7,267
Mentioned: 74 Post(s)
Tagged: 0 Thread(s)
Quoted: 2050 Post(s)
Liked: 1587
A lot of people don't know this but...

you can code Assembler in C++ and you can reference C++ dll's in C#, all built in the same solution at once.


You could even use pointers if you wanted to:
Code:
    private unsafe void Add() {
        int a, b; a = 1; b = 1;
        int* y, z; y = &a; z = &b;
        int x = MathLib.Add(y, z);
    }
    public unsafe class MathLib {
        [System.Runtime.InteropServices.DllImport("MathLib.dll")]
        public static extern int Add(int* a, int* b);
    }
    extern "C" __declspec(dllexport) int __stdcall Add(int* a, int* b)
Just in case you ever really wanted to do something low-level and uber-fast.

This allows you to manipulate the L-cache memory of the CPU directly. Bare metal computation.
You can also pick and choose which language you prefer to perform a given action with.
Such as LINQ, Vertexes or CPU ID's and IRQ's.

ASM isn't very human readable, and very hard to debug, but it is as fast as it gets.
C# is very human readable and easy to use and memory management-safe, but also far slower.
C++ is somewhere in the middle, still readable and moderately fast; slightly more error prone but far easier to debug than ASM.
Attached Thumbnails
Click image for larger version

Name:	5378.jpg
Views:	248
Size:	240.0 KB
ID:	1847121  

Last edited by BassThatHz; 12-22-2016 at 02:13 AM.
BassThatHz is offline  
post #156 of 192 Old 02-16-2017, 07:46 PM - Thread Starter
AVS Forum Special Member
 
BassThatHz's Avatar
 
Join Date: Apr 2008
Location: Northern Okan range (NW Cascades region)
Posts: 7,267
Mentioned: 74 Post(s)
Tagged: 0 Thread(s)
Quoted: 2050 Post(s)
Liked: 1587
[Post Moved:]

Work has just been crazy busy lately.
I took a break from this so i don't burn out. Doing this stuff is really draining on me, especially when ASIO is so picky like it is.

This is like my 3rd variant of trying to make multi-ASIO work.
I'm pretty sure it will work this time around because I have working "example code" to glean off of. (Somehow I didn't look close enough and missed it back when I started, probably would have saved me 4 days of coding time.)
I just have to reverse engineer it into some code that actually does it in the way that I want it to.

If ASIO was easier to use I'd have been finished this app before Christmas already.

I was hoping that by now my work load would have diminished but it has only increased, with no end in sight. That's just how it is.
My car has been sucking up all my money, I need 4 new brakes and a new windshield now... this is eating into my audio budget greatly. Like $4000.
Then there was 1 other large unexpected bill that popped up in November, eating into another $1500 of my audio budget.
I've been spending money faster than I've been making it. I'm just now starting out at where I thought I would have been in early November. Another words: less than no progress at all. It's just nuts considering the amount of disposable income I have, I don't know how average people are surviving. I suppose they aren't...

Oh well, I guess I can't complain too hard, I'm still better-off than 80% of the people out there...
BassThatHz is offline  
post #157 of 192 Old 02-17-2017, 12:56 PM
AVS Forum Special Member
 
Augerhandle's Avatar
 
Join Date: Jan 2009
Location: About 25" away from my computer screen
Posts: 4,430
Mentioned: 15 Post(s)
Tagged: 0 Thread(s)
Quoted: 759 Post(s)
Liked: 658
Quote:
Originally Posted by BassThatHz View Post
[Post Moved:]

Work has just been crazy busy lately.
I took a break from this so i don't burn out. Doing this stuff is really draining on me, especially when ASIO is so picky like it is.

This is like my 3rd variant of trying to make multi-ASIO work.
I'm pretty sure it will work this time around because I have working "example code" to glean off of. (Somehow I didn't look close enough and missed it back when I started, probably would have saved me 4 days of coding time.)
I just have to reverse engineer it into some code that actually does it in the way that I want it to.

If ASIO was easier to use I'd have been finished this app before Christmas already.

I was hoping that by now my work load would have diminished but it has only increased, with no end in sight. That's just how it is.
My car has been sucking up all my money, I need 4 new brakes and a new windshield now... this is eating into my audio budget greatly. Like $4000.
Then there was 1 other large unexpected bill that popped up in November, eating into another $1500 of my audio budget.
I've been spending money faster than I've been making it. I'm just now starting out at where I thought I would have been in early November. Another words: less than no progress at all. It's just nuts considering the amount of disposable income I have, I don't know how average people are surviving. I suppose they aren't...

Oh well, I guess I can't complain too hard, I'm still better-off than 80% of the people out there...
We don't blow our money on stupid stuff like brakes and windshields, we save it for important audio visual equipment

Seriously, though, I hope the brakes and windshield didn't go in the same incident.


"The wise understand by themselves; fools follow the reports of others"-Tibetan Proverb
_____________________ http://www.scientificamerican.com/article/auger-handle/ ____________________________
Augerhandle is offline  
post #158 of 192 Old 02-17-2017, 03:49 PM
AVS Forum Special Member
 
mynym's Avatar
 
Join Date: Nov 2004
Location: Columbus, OH
Posts: 1,223
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Quoted: 27 Post(s)
Liked: 21
2 cents..

This code could be easily ported to .NET core and run on a cheap PI box running lightweight Raspien. Add a ADAU1701 (i/o) or perhaps some cheaper alternative and you got a sub $50 flexible DSP.

If you haven't already throw this on github and lets start building OpenDSP!

Last edited by mynym; 02-17-2017 at 03:53 PM.
mynym is offline  
post #159 of 192 Old 02-17-2017, 06:46 PM - Thread Starter
AVS Forum Special Member
 
BassThatHz's Avatar
 
Join Date: Apr 2008
Location: Northern Okan range (NW Cascades region)
Posts: 7,267
Mentioned: 74 Post(s)
Tagged: 0 Thread(s)
Quoted: 2050 Post(s)
Liked: 1587
Quote:
Originally Posted by Augerhandle View Post
I hope the brakes and windshield didn't go in the same incident.
Nothing bad, the brakes are the factory originals from 7.25 years ago. Just worn from general use.
BassThatHz is offline  
post #160 of 192 Old 02-17-2017, 07:07 PM - Thread Starter
AVS Forum Special Member
 
BassThatHz's Avatar
 
Join Date: Apr 2008
Location: Northern Okan range (NW Cascades region)
Posts: 7,267
Mentioned: 74 Post(s)
Tagged: 0 Thread(s)
Quoted: 2050 Post(s)
Liked: 1587
Quote:
Originally Posted by mynym View Post
2 cents..

This code could be easily ported to .NET core and run on a cheap PI box running lightweight Raspien. Add a ADAU1701 (i/o) or perhaps some cheaper alternative and you got a sub $50 flexible DSP.

If you haven't already throw this on github and lets start building OpenDSP!
But first, I would have to get it to actually work before bothering to put it on git...
No sense clogging github with useless code.


I'm not sure if it would work well with Net Core or any non-windows OS either, not so much because of my code, but because of the NAudio sound device hooks.

The buses and bi-quads and my general DSP engine would likely port cleanly without any code modifications at all.

The WinForm GUI would not port at all probably (as you'd expect), nor the NAudio stuff I already mentioned.

At the very least you would definitely want to prune the NAudio core to the bare essentials, both to increase speed and to reduce memory allocation and disk space, and ease the difficulty of porting to Core.
Pruning is easily done in .Net, it's just a matter of doing it...

I will be pruning my NAudio references prior to RTM, but right now this code isn't even RC1 or Beta 1.0, it's more like Alpha 3.0 code.

Last edited by BassThatHz; 02-17-2017 at 07:19 PM.
BassThatHz is offline  
post #161 of 192 Old 02-17-2017, 07:26 PM
AVS Forum Special Member
 
mynym's Avatar
 
Join Date: Nov 2004
Location: Columbus, OH
Posts: 1,223
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Quoted: 27 Post(s)
Liked: 21
Quote:
Originally Posted by BassThatHz View Post
But first I would have to get it to "actually work" before bothering to put it on git...
No sense clogging github with useless code.


I'm not sure if it would work well with Net Core or any non-windows OS either, not so much because of my code, but because of the NAudio sound device hooks.

The buses and bi-quads and my general DSP engine would likely port cleanly without any code modifications at all.

The GUI would not port at all probably (as you'd expect), nor the NAudio stuff I already mentioned.

At the very least you would definitely want to prune the NAudio core to the bare essentials, both to increase speed and to reduce memory allocation and disk space, and ease the difficulty of porting to Core.
Pruning is easily done in .Net, it's just a matter of doing it...

I will be pruning my NAudio references prior to RTM, but right now this code isn't even RC1 or Beta 1.0, it's more like Alpha 3.0 code.

Don't feel obligated to do all of this yourself. Use the community

FWIW I'm a developer of an Android alternative OS that is available on hundreds of devices. If I had not exposed it to the Android ROM community, it would have been only available to a handful of mobile devices.

However... If you feel like their is a monetization strategy.. That's another story.
mynym is offline  
post #162 of 192 Old 02-17-2017, 08:33 PM
AVS Forum Special Member
 
zeus33's Avatar
 
Join Date: Dec 2012
Posts: 3,326
Mentioned: 5 Post(s)
Tagged: 0 Thread(s)
Quoted: 1366 Post(s)
Liked: 1022
Quote:
Originally Posted by mynym View Post
FWIW I'm a developer of an Android alternative OS that is available on hundreds of devices.

Which ROM?
zeus33 is offline  
post #163 of 192 Old 02-18-2017, 01:18 PM - Thread Starter
AVS Forum Special Member
 
BassThatHz's Avatar
 
Join Date: Apr 2008
Location: Northern Okan range (NW Cascades region)
Posts: 7,267
Mentioned: 74 Post(s)
Tagged: 0 Thread(s)
Quoted: 2050 Post(s)
Liked: 1587
Quote:
Originally Posted by mynym View Post
Don't feel obligated to do all of this yourself. Use the community
There is no and will be no, monetization.
My goal is to actually use this in my system on a daily basis. So I do feel obligated because otherwise it won't get done, or it will be done all WRONG. hehe

Besides... NAudio has already been on the internet since 2007
https://github.com/naudio/NAudio
So... if anyone "in the community" really wanted to make what I'm making they would have long since done it by now...
there has been absolutely nothing stopping them.

The fact that they haven't tells me that they are either:
-Too lazy
-don't care about such things
-haven't thought of it yet
-are unable to.
or some combination thereof.


-Trinnov's costs more than a Tesla car
-Same with Dolby cinema-grade products
-Oppo hasn't provided a solution, neither have any major brands like Yam, H/K etc No 32-channel Atmos DSP'ing for us!
-I don't trust Emo processors (RMC-1)
-Behringer doesn't have any good high-channel count solutions
-DCX maxes out at only 3 inputs (one really noisy)
-miniDSP is rumoured to have some hiss and only supports up to 10-channels per box anyway.
-JRiver is limited to 32 channels and isn't really designed for real-time
-everything else isn't windows-based or is some bloated 50GB DAW app.
-Motu DP9 DAW app isn't very good (IMO).
-Motu doesn't support onboard XO'ing, and has limited EQ. <-- me-->SAD
-Same for an Orion32 (and it costs MORE, with less channels.)
-apo equalizer doesn't do ASIO and never will.

and so I'm forced to roll my own.

Last edited by BassThatHz; 02-18-2017 at 01:36 PM.
BassThatHz is offline  
post #164 of 192 Old 02-18-2017, 06:13 PM - Thread Starter
AVS Forum Special Member
 
BassThatHz's Avatar
 
Join Date: Apr 2008
Location: Northern Okan range (NW Cascades region)
Posts: 7,267
Mentioned: 74 Post(s)
Tagged: 0 Thread(s)
Quoted: 2050 Post(s)
Liked: 1587
Brakes are done. Did them myself. $38 per tire. Disc. Not bad.
Had I taken it to a shop they probably would have charged me $400 easy... no doubt.

Just one less non-audio thing I have to waste money on. (Which means: louder bass. LOL )

Last edited by BassThatHz; 02-19-2017 at 09:44 AM.
BassThatHz is offline  
post #165 of 192 Old 02-19-2017, 07:04 AM
AVS Forum Special Member
 
LastButNotLeast's Avatar
 
Join Date: Feb 2007
Location: 08077
Posts: 7,849
Mentioned: 33 Post(s)
Tagged: 1 Thread(s)
Quoted: 1521 Post(s)
Liked: 1127
Quote:
Originally Posted by BassThatHz View Post
-apo equalizer doesn't do ASIO and never will.
Please understand that I don't know what I'm talking about and this question comes from ignorance:
Wouldn't it be possible to modify Equalizer APO (which I happen to like a lot, BTW) to work with ASIO?
(Remember: answer needs to be in baby talk. )
Michael

Did you really need to quote that entire post in your reply?
Downloadable FREE demo discs: Demonstration Blu-Ray Discs (Independently Authored)
Welcome to AVS - Get out while you still can!
For most of the time, the here and now is neither now nor here. Graham Swift
LastButNotLeast is offline  
post #166 of 192 Old 02-19-2017, 09:25 AM - Thread Starter
AVS Forum Special Member
 
BassThatHz's Avatar
 
Join Date: Apr 2008
Location: Northern Okan range (NW Cascades region)
Posts: 7,267
Mentioned: 74 Post(s)
Tagged: 0 Thread(s)
Quoted: 2050 Post(s)
Liked: 1587
Quote:
Originally Posted by LastButNotLeast View Post
Please understand that I don't know what I'm talking about and this question comes from ignorance:
Wouldn't it be possible to modify Equalizer APO (which I happen to like a lot, BTW) to work with ASIO?
(Remember: answer needs to be in baby talk. )
Michael
The Equalizer APO developer really dropped the ball on that one.There is no good reason why he/she couldn't have added it.
Maybe you should tell them to stop being lazy and just add the feature already as it is far easier for the original developer to add it in than for another developer to add it; they are already familiar with every line of code...

All they have to do is change the Input and Output streams to allow ASIO, maybe also change where the engine is being hosted and how the GUI and APO can access it. Obviously ASIO streams wouldn't be automatic like APO, it would require manual assignment (which isn't hard to allow.) APO-Auto being the default.
Windows sounds are limited to 7.1 mostly, so only those channels would be mappable by default (which isn't a big deal.)
ASIO supports (at least) 256channels to 256channels, so that part wouldn't change.
They'd probably have to allow for greater channel-count support; I'd bet they are currently limited to 7.1 or 24 channels at-most.

Last edited by BassThatHz; 02-19-2017 at 09:41 AM.
BassThatHz is offline  
post #167 of 192 Old 02-19-2017, 07:06 PM - Thread Starter
AVS Forum Special Member
 
BassThatHz's Avatar
 
Join Date: Apr 2008
Location: Northern Okan range (NW Cascades region)
Posts: 7,267
Mentioned: 74 Post(s)
Tagged: 0 Thread(s)
Quoted: 2050 Post(s)
Liked: 1587
Just working on adding an o-scope, RTA and level-meter per channel.
The scope and level is easy the RTA is a bit more involved, I have a working example to glean off of though...
Always nice being able to have basic monitoring of the ASIO channel data.
Attached Thumbnails
Click image for larger version

Name:	234.jpg
Views:	165
Size:	164.2 KB
ID:	1981177  
BassThatHz is offline  
post #168 of 192 Old 02-20-2017, 03:20 PM
Member
 
datrumole's Avatar
 
Join Date: Apr 2008
Posts: 168
Mentioned: 1 Post(s)
Tagged: 0 Thread(s)
Quoted: 31 Post(s)
Liked: 46
Quote:
Originally Posted by BassThatHz View Post
Just working on adding an o-scope, RTA and level-meter per channel.
The scope and level is easy the RTA is a bit more involved, I have a working example to glean off of though...
Always nice being able to have basic monitoring of the ASIO channel data.
This feature sounds amazing! would this be a combined view? or per channel?

EDIT: also put me down for beta testing. my entire system runs off EAPO right now, so i potentially should be a good candidate

Last edited by datrumole; 02-20-2017 at 03:43 PM.
datrumole is online now  
post #169 of 192 Old 02-20-2017, 09:23 PM - Thread Starter
AVS Forum Special Member
 
BassThatHz's Avatar
 
Join Date: Apr 2008
Location: Northern Okan range (NW Cascades region)
Posts: 7,267
Mentioned: 74 Post(s)
Tagged: 0 Thread(s)
Quoted: 2050 Post(s)
Liked: 1587
Each channel will have its own.



Each RTA/O-Scope popping up in a separate window (fast computers only if you do many at once!)

Each window will run in it's own thread. [You know: To take advantage of that 8-socket $9000x8 24-core /w HT Xeon-8800 cpu's you are running. ]
Attached Thumbnails
Click image for larger version

Name:	64.jpg
Views:	145
Size:	184.6 KB
ID:	1983233   Click image for larger version

Name:	8.jpg
Views:	145
Size:	254.4 KB
ID:	1983241  

Last edited by BassThatHz; 02-20-2017 at 10:26 PM.
BassThatHz is offline  
post #170 of 192 Old 02-20-2017, 10:23 PM - Thread Starter
AVS Forum Special Member
 
BassThatHz's Avatar
 
Join Date: Apr 2008
Location: Northern Okan range (NW Cascades region)
Posts: 7,267
Mentioned: 74 Post(s)
Tagged: 0 Thread(s)
Quoted: 2050 Post(s)
Liked: 1587
The BassThatHz Level Meter:

Why have one subwoofer? when you can have a million subwoofers???

Yes it is scrollable too, just in case a million channels don't all fit on your 8K monitor. Because it won't... Because: never enough bass!
Attached Thumbnails
Click image for larger version

Name:	76.jpg
Views:	149
Size:	355.4 KB
ID:	1983281  

Last edited by BassThatHz; 02-20-2017 at 10:30 PM.
BassThatHz is offline  
post #171 of 192 Old 02-20-2017, 11:04 PM - Thread Starter
AVS Forum Special Member
 
BassThatHz's Avatar
 
Join Date: Apr 2008
Location: Northern Okan range (NW Cascades region)
Posts: 7,267
Mentioned: 74 Post(s)
Tagged: 0 Thread(s)
Quoted: 2050 Post(s)
Liked: 1587
There we go! Enough RTA to choke even the worlds fastest supercomputer...


Ok your computer can run Crysis, but...
Can it run my DSP app with maxed-out settings?

NOPE!
Attached Thumbnails
Click image for larger version

Name:	8769.jpg
Views:	157
Size:	427.5 KB
ID:	1983297  
BassThatHz is offline  
post #172 of 192 Old 02-21-2017, 07:47 PM - Thread Starter
AVS Forum Special Member
 
BassThatHz's Avatar
 
Join Date: Apr 2008
Location: Northern Okan range (NW Cascades region)
Posts: 7,267
Mentioned: 74 Post(s)
Tagged: 0 Thread(s)
Quoted: 2050 Post(s)
Liked: 1587
Here is a load tester for the Level Meter GUI.
This is like a worst-case scenario (5120 updates per second.)
https://drive.google.com/open?id=0Bw...klFcUZrWUo4RG8

I'll have to create a load tester app for the RTA windows next...
BassThatHz is offline  
post #173 of 192 Old 02-25-2017, 11:08 AM - Thread Starter
AVS Forum Special Member
 
BassThatHz's Avatar
 
Join Date: Apr 2008
Location: Northern Okan range (NW Cascades region)
Posts: 7,267
Mentioned: 74 Post(s)
Tagged: 0 Thread(s)
Quoted: 2050 Post(s)
Liked: 1587
I suppose I should calculate the SNR of my app!
I'm curious to know the distortion that bi-quads introduce.

In 24Bit mode, the baseline for ASIO loopback works out to be basically: -160db. Which is likely the upper-limit for 24Bits.


[REW doesn't have a 32Bit mode apparently, which in-theory, would be even lower...]
Attached Thumbnails
Click image for larger version

Name:	6342.jpg
Views:	115
Size:	275.1 KB
ID:	1992185  
BassThatHz is offline  
post #174 of 192 Old 02-25-2017, 12:57 PM - Thread Starter
AVS Forum Special Member
 
BassThatHz's Avatar
 
Join Date: Apr 2008
Location: Northern Okan range (NW Cascades region)
Posts: 7,267
Mentioned: 74 Post(s)
Tagged: 0 Thread(s)
Quoted: 2050 Post(s)
Liked: 1587
Here is JRiver in 16/44 mode:


and my app in 16/44 mode:


Both identical, and both agree that 24/48 way is better, at least when trying to aim for -1million db's.
Attached Thumbnails
Click image for larger version

Name:	JRiver 16Bit44.jpg
Views:	113
Size:	311.8 KB
ID:	1992457   Click image for larger version

Name:	BTH 16Bit44.jpg
Views:	112
Size:	328.6 KB
ID:	1992465  
BassThatHz is offline  
post #175 of 192 Old 02-25-2017, 01:19 PM - Thread Starter
AVS Forum Special Member
 
BassThatHz's Avatar
 
Join Date: Apr 2008
Location: Northern Okan range (NW Cascades region)
Posts: 7,267
Mentioned: 74 Post(s)
Tagged: 0 Thread(s)
Quoted: 2050 Post(s)
Liked: 1587
Here is JRiver in 24/44 with DSP disabled:


Here is JRiver in 24/44 with DSP enabled:


No change, which is good; whatever DSP type it uses it is adding no noise.
Attached Thumbnails
Click image for larger version

Name:	JRiver 24Bit44.jpg
Views:	109
Size:	299.6 KB
ID:	1992529   Click image for larger version

Name:	JRiver 24Bit44 DSP.jpg
Views:	109
Size:	294.9 KB
ID:	1992537  
BassThatHz is offline  
post #176 of 192 Old 02-25-2017, 02:03 PM - Thread Starter
AVS Forum Special Member
 
BassThatHz's Avatar
 
Join Date: Apr 2008
Location: Northern Okan range (NW Cascades region)
Posts: 7,267
Mentioned: 74 Post(s)
Tagged: 0 Thread(s)
Quoted: 2050 Post(s)
Liked: 1587
I see that REW now has a 64Bit FFT mode, nice!

Pretty much the same results as before, but more accurate numbers below -160db.



I tried ASIO 32Bit mode, but saw no improvements with REW, which makes me think it still has a 24Bit depth limit on it's input channels.
Doesn't really matter as this is vanishingly low distortion and noise, as-is.

Now I need to see how the Bi-Quad's fair on this test...
Attached Thumbnails
Click image for larger version

Name:	567.jpg
Views:	111
Size:	337.0 KB
ID:	1992633   Click image for larger version

Name:	456.jpg
Views:	111
Size:	338.0 KB
ID:	1992641  

Last edited by BassThatHz; 02-25-2017 at 03:46 PM.
BassThatHz is offline  
post #177 of 192 Old 02-25-2017, 02:32 PM
Member
 
Join Date: Jan 2017
Posts: 32
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Quoted: 15 Post(s)
Liked: 4
Didn´t even try any of the releases, as I´m drowning myself in other noob audio problems, but will get back to that one. Thanks buddy! your effort appreciated. Have you been thinking about some donation account? :-)
Petr Berka is online now  
post #178 of 192 Old 02-25-2017, 03:42 PM - Thread Starter
AVS Forum Special Member
 
BassThatHz's Avatar
 
Join Date: Apr 2008
Location: Northern Okan range (NW Cascades region)
Posts: 7,267
Mentioned: 74 Post(s)
Tagged: 0 Thread(s)
Quoted: 2050 Post(s)
Liked: 1587
Me thinks NAudio's implementation of Bi-Quads are defective...

That's a 2khz/48db LPF.


and here is JRiver's implementation of it:

Which appears to be correct...

Looks like I might have to abandon their DSP for a proper implementation of Bi-Quads. I'll see what I can find...
Attached Thumbnails
Click image for larger version

Name:	346.jpg
Views:	108
Size:	409.1 KB
ID:	1992761   Click image for larger version

Name:	764.jpg
Views:	107
Size:	343.3 KB
ID:	1992769  
BassThatHz is offline  
post #179 of 192 Old 02-25-2017, 04:28 PM - Thread Starter
AVS Forum Special Member
 
BassThatHz's Avatar
 
Join Date: Apr 2008
Location: Northern Okan range (NW Cascades region)
Posts: 7,267
Mentioned: 74 Post(s)
Tagged: 0 Thread(s)
Quoted: 2050 Post(s)
Liked: 1587
I found an alternative BQ implementation, http://www.earlevel.com/main/2012/11...c-source-code/
It was in C++ so I converted it to C#. Pretty easy to do because the two languages share a lot of syntactic similarities.

Code:
public class BQ
    {
        //  Created by Nigel Redmon on 11/24/12
        //  EarLevel Engineering: earlevel.com
        //  Copyright 2012 Nigel Redmon
        //
        //  For a complete explanation of the Biquad code:
        //  http://www.earlevel.com/main/2012/11/26/biquad-c-source-code/
        //
        //  License:
        //
        //  This source code is provided as is, without warranty.
        //  You may copy and distribute verbatim copies of this document.
        //  You may modify and use this source code to create binary code
        //  for your own purposes, free or commercial.
        protected BQType type;
        protected double a0, a1, a2, b1, b2;
        protected double Fc, Q, peakGain;
        protected double z1, z2;

        public enum BQType
        {
            lowpass = 0,
            highpass,
            bandpass,
            notch,
            peak,
            lowshelf,
            highshelf
        };


        public BQ()
        {
            type = BQType.lowpass;
            a0 = 1.0;
            a1 = a2 = b1 = b2 = 0.0;
            Fc = 0.50;
            Q = 0.707;
            peakGain = 0.0;
            z1 = z2 = 0.0;
        }

        public BQ(BQType type, double Fc, double Q, double peakGainDB)
        {
            setBiquad(type, Fc, Q, peakGainDB);
            z1 = z2 = 0.0;
        }

        public void setType(BQType type)
        {
            this.type = type;
            calcBiquad();
        }

        public void setQ(double Q)
        {
            this.Q = Q;
            calcBiquad();
        }

        public void setFc(double Fc)
        {
            this.Fc = Fc;
            calcBiquad();
        }

        public void setPeakGain(double peakGainDB)
        {
            this.peakGain = peakGainDB;
            calcBiquad();
        }

        public void setBiquad(BQType type, double Fc, double Q, double peakGainDB)
        {
            this.type = type;
            this.Q = Q;
            this.Fc = Fc;
            setPeakGain(peakGainDB);
        }

        public float process(float i)
        {
            double o = i * a0 + z1;
            z1 = i * a1 + z2 - b1 * o;
            z2 = i * a2 - b2 * o;
            return (float)o;
        }

        Double Sqrt2 = Math.Sqrt(2);

        protected void calcBiquad()
        {
            double norm;
            double V = Math.Pow(10, Math.Abs(peakGain) / 20.0);
            double K = Math.Tan(Math.PI * Fc);
            switch (this.type)
            {
                case BQType.lowpass:
                    norm = 1 / (1 + K / Q + K * K);
                    a0 = K * K * norm;
                    a1 = 2 * a0;
                    a2 = a0;
                    b1 = 2 * (K * K - 1) * norm;
                    b2 = (1 - K / Q + K * K) * norm;
                    break;

                case BQType.highpass:
                    norm = 1 / (1 + K / Q + K * K);
                    a0 = 1 * norm;
                    a1 = -2 * a0;
                    a2 = a0;
                    b1 = 2 * (K * K - 1) * norm;
                    b2 = (1 - K / Q + K * K) * norm;
                    break;

                case BQType.bandpass:
                    norm = 1 / (1 + K / Q + K * K);
                    a0 = K / Q * norm;
                    a1 = 0;
                    a2 = -a0;
                    b1 = 2 * (K * K - 1) * norm;
                    b2 = (1 - K / Q + K * K) * norm;
                    break;

                case BQType.notch:
                    norm = 1 / (1 + K / Q + K * K);
                    a0 = (1 + K * K) * norm;
                    a1 = 2 * (K * K - 1) * norm;
                    a2 = a0;
                    b1 = a1;
                    b2 = (1 - K / Q + K * K) * norm;
                    break;

                case BQType.peak:
                    if (peakGain >= 0)
                    {    // boost
                        norm = 1 / (1 + 1 / Q * K + K * K);
                        a0 = (1 + V / Q * K + K * K) * norm;
                        a1 = 2 * (K * K - 1) * norm;
                        a2 = (1 - V / Q * K + K * K) * norm;
                        b1 = a1;
                        b2 = (1 - 1 / Q * K + K * K) * norm;
                    }
                    else
                    {    // cut
                        norm = 1 / (1 + V / Q * K + K * K);
                        a0 = (1 + 1 / Q * K + K * K) * norm;
                        a1 = 2 * (K * K - 1) * norm;
                        a2 = (1 - 1 / Q * K + K * K) * norm;
                        b1 = a1;
                        b2 = (1 - V / Q * K + K * K) * norm;
                    }
                    break;

                case BQType.lowshelf:
                    if (peakGain >= 0)
                    {    // boost
                        norm = 1 / (1 + Sqrt2 * K + K * K);
                        a0 = (1 + Math.Sqrt(2 * V) * K + V * K * K) * norm;
                        a1 = 2 * (V * K * K - 1) * norm;
                        a2 = (1 - Math.Sqrt(2 * V) * K + V * K * K) * norm;
                        b1 = 2 * (K * K - 1) * norm;
                        b2 = (1 - Sqrt2 * K + K * K) * norm;
                    }
                    else
                    {    // cut
                        norm = 1 / (1 + Math.Sqrt(2 * V) * K + V * K * K);
                        a0 = (1 + Sqrt2 * K + K * K) * norm;
                        a1 = 2 * (K * K - 1) * norm;
                        a2 = (1 - Sqrt2 * K + K * K) * norm;
                        b1 = 2 * (V * K * K - 1) * norm;
                        b2 = (1 - Math.Sqrt(2 * V) * K + V * K * K) * norm;
                    }
                    break;

                case BQType.highshelf:
                    if (peakGain >= 0)
                    {    // boost
                        norm = 1 / (1 + Sqrt2 * K + K * K);
                        a0 = (V + Math.Sqrt(2 * V) * K + K * K) * norm;
                        a1 = 2 * (K * K - V) * norm;
                        a2 = (V - Math.Sqrt(2 * V) * K + K * K) * norm;
                        b1 = 2 * (K * K - 1) * norm;
                        b2 = (1 - Sqrt2 * K + K * K) * norm;
                    }
                    else
                    {    // cut
                        norm = 1 / (V + Math.Sqrt(2 * V) * K + K * K);
                        a0 = (1 + Sqrt2 * K + K * K) * norm;
                        a1 = 2 * (K * K - 1) * norm;
                        a2 = (1 - Sqrt2 * K + K * K) * norm;
                        b1 = 2 * (K * K - V) * norm;
                        b2 = (V - Math.Sqrt(2 * V) * K + K * K) * norm;
                    }
                    break;
            }
        }
    }

var filter = new BQ();
filter.setBiquad(BQ.BQType.lowpass, 2000 / 44100, 0.707, 0);
Now let's see if this one has the proper implementation...
BassThatHz is offline  
post #180 of 192 Old 02-25-2017, 10:30 PM - Thread Starter
AVS Forum Special Member
 
BassThatHz's Avatar
 
Join Date: Apr 2008
Location: Northern Okan range (NW Cascades region)
Posts: 7,267
Mentioned: 74 Post(s)
Tagged: 0 Thread(s)
Quoted: 2050 Post(s)
Liked: 1587
I converted the NAudio Biquad to use 64Bit and it works much better now. Much less distortion in general!


After more testing I discovered something really odd with it, when the HPF is set above 215hz the distortion goes from 0% to 200%

Correction: it happens when the Q goes above 1, which makes sense I suppose.
Attached Thumbnails
Click image for larger version

Name:	684.jpg
Views:	95
Size:	348.4 KB
ID:	1993241  

Last edited by BassThatHz; 02-25-2017 at 11:00 PM.
BassThatHz is offline  
Sponsored Links
Advertisement
 
Reply DIY Speakers and Subs

Thread Tools
Show Printable Version Show Printable Version
Email this Page Email this Page


Forum Jump: 

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