From 966f2d253cd2ee6ce140ad68095a20a9d2b63052 Mon Sep 17 00:00:00 2001 From: Chris Johnson Date: Sun, 27 Jan 2019 21:13:54 -0500 Subject: Floating Point Dither For All --- plugins/MacAU/DubSub/DubSub.cpp | 19 +++--------- .../DubSub.xcodeproj/christopherjohnson.pbxuser | 36 +++++++++++----------- .../christopherjohnson.perspectivev3 | 36 ++++++++++------------ 3 files changed, 40 insertions(+), 51 deletions(-) (limited to 'plugins/MacAU/DubSub') diff --git a/plugins/MacAU/DubSub/DubSub.cpp b/plugins/MacAU/DubSub/DubSub.cpp index 3d375c7..49a371b 100755 --- a/plugins/MacAU/DubSub/DubSub.cpp +++ b/plugins/MacAU/DubSub/DubSub.cpp @@ -523,23 +523,14 @@ void DubSub::DubSubKernel::Process( const Float32 *inSourceP, bflip++; if (bflip < 1 || bflip > 3) bflip = 1; - - //noise shaping to 32-bit floating point - Float32 fpTemp = inputSample; - fpNShape += (inputSample-fpTemp); - inputSample += fpNShape; - //for deeper space and warmth, we try a non-oscillating noise shaping - //that is kind of ruthless: it will forever retain the rounding errors - //except we'll dial it back a hair at the end of every buffer processed - //end noise shaping on 32 bit output + //32 bit dither, made small and tidy. + int expon; frexpf((Float32)inputSample, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSample += (dither-fpNShape); fpNShape = dither; + //end 32 bit dither *destP = inputSample; sourceP += inNumChannels; destP += inNumChannels; } - fpNShape *= 0.999999; - //we will just delicately dial back the FP noise shaping, not even every sample - //this is a good place to put subtle 'no runaway' calculations, though bear in mind - //that it will be called more often when you use shorter sample buffers in the DAW. - //So, very low latency operation will call these calculations more often. } diff --git a/plugins/MacAU/DubSub/DubSub.xcodeproj/christopherjohnson.pbxuser b/plugins/MacAU/DubSub/DubSub.xcodeproj/christopherjohnson.pbxuser index 1b78563..0bf9966 100755 --- a/plugins/MacAU/DubSub/DubSub.xcodeproj/christopherjohnson.pbxuser +++ b/plugins/MacAU/DubSub/DubSub.xcodeproj/christopherjohnson.pbxuser @@ -49,43 +49,43 @@ PBXFileDataSource_Warnings_ColumnID, ); }; - PBXPerProjectTemplateStateSaveDate = 560565055; - PBXWorkspaceStateSaveDate = 560565055; + PBXPerProjectTemplateStateSaveDate = 569602135; + PBXWorkspaceStateSaveDate = 569602135; }; perUserProjectItems = { - 8B42FE3E21698BC50092969A /* PBXTextBookmark */ = 8B42FE3E21698BC50092969A /* PBXTextBookmark */; - 8B42FE3F21698BC50092969A /* PBXTextBookmark */ = 8B42FE3F21698BC50092969A /* PBXTextBookmark */; + 8B792B7521F3708C006E9731 /* PBXTextBookmark */ = 8B792B7521F3708C006E9731 /* PBXTextBookmark */; + 8B792B7A21F3709C006E9731 /* PBXTextBookmark */ = 8B792B7A21F3709C006E9731 /* PBXTextBookmark */; }; sourceControlManager = 8BD3CCB8148830B20062E48C /* Source Control */; userBuildSettings = { }; }; - 8B42FE3E21698BC50092969A /* PBXTextBookmark */ = { + 8B792B7521F3708C006E9731 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8BA05A660720730100365D66 /* DubSub.cpp */; name = "DubSub.cpp: 521"; rLen = 0; rLoc = 22045; rType = 0; - vrLen = 160; - vrLoc = 21949; + vrLen = 68; + vrLoc = 21996; }; - 8B42FE3F21698BC50092969A /* PBXTextBookmark */ = { + 8B792B7A21F3709C006E9731 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8BA05A660720730100365D66 /* DubSub.cpp */; name = "DubSub.cpp: 521"; rLen = 0; rLoc = 22045; rType = 0; - vrLen = 160; - vrLoc = 21915; + vrLen = 68; + vrLoc = 21996; }; 8BA05A660720730100365D66 /* DubSub.cpp */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {663, 7241}}"; + sepNavIntBoundsRect = "{{0, 0}, {554, 7072}}"; sepNavSelRange = "{22045, 0}"; - sepNavVisRange = "{21915, 160}"; - sepNavWindowFrame = "{{749, 66}, {1145, 812}}"; + sepNavVisRange = "{21996, 68}"; + sepNavWindowFrame = "{{1, 41}, {1145, 812}}"; }; }; 8BA05A670720730100365D66 /* DubSub.exp */ = { @@ -108,16 +108,16 @@ uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {1098, 767}}"; sepNavSelRange = "{2869, 0}"; - sepNavVisRange = "{68, 2869}"; + sepNavVisRange = "{49, 2888}"; sepNavWindowFrame = "{{295, 66}, {1145, 812}}"; }; }; 8BC6025B073B072D006C4272 /* DubSub.h */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {824, 2392}}"; - sepNavSelRange = "{3332, 0}"; - sepNavVisRange = "{2519, 1677}"; - sepNavWindowFrame = "{{832, 72}, {608, 806}}"; + sepNavIntBoundsRect = "{{0, 0}, {824, 2756}}"; + sepNavSelRange = "{6097, 1035}"; + sepNavVisRange = "{6232, 1033}"; + sepNavWindowFrame = "{{26, 54}, {608, 806}}"; }; }; 8BD3CCB8148830B20062E48C /* Source Control */ = { diff --git a/plugins/MacAU/DubSub/DubSub.xcodeproj/christopherjohnson.perspectivev3 b/plugins/MacAU/DubSub/DubSub.xcodeproj/christopherjohnson.perspectivev3 index 5e22a02..b95829d 100755 --- a/plugins/MacAU/DubSub/DubSub.xcodeproj/christopherjohnson.perspectivev3 +++ b/plugins/MacAU/DubSub/DubSub.xcodeproj/christopherjohnson.perspectivev3 @@ -256,8 +256,6 @@ Layout - BecomeActive - ContentConfiguration PBXBottomSmartGroupGIDs @@ -324,7 +322,7 @@ 185 RubberWindowFrame - 625 371 810 487 0 0 1440 878 + 412 359 810 487 0 0 1440 878 Module PBXSmartGroupTreeModule @@ -352,10 +350,10 @@ _historyCapacity 0 bookmark - 8B42FE3F21698BC50092969A + 8B792B7A21F3709C006E9731 history - 8B42FE3E21698BC50092969A + 8B792B7521F3708C006E9731 SplitCount @@ -369,18 +367,18 @@ GeometryConfiguration Frame - {{0, 0}, {603, 117}} + {{0, 0}, {603, 69}} RubberWindowFrame - 625 371 810 487 0 0 1440 878 + 412 359 810 487 0 0 1440 878 Module PBXNavigatorGroup Proportion - 117pt + 69pt Proportion - 324pt + 372pt Tabs @@ -394,9 +392,7 @@ GeometryConfiguration Frame - {{10, 27}, {603, 297}} - RubberWindowFrame - 625 371 810 487 0 0 1440 878 + {{10, 27}, {603, 345}} Module XCDetailModule @@ -450,7 +446,9 @@ GeometryConfiguration Frame - {{10, 27}, {603, 414}} + {{10, 27}, {603, 345}} + RubberWindowFrame + 412 359 810 487 0 0 1440 878 Module PBXBuildResultsModule @@ -478,11 +476,11 @@ TableOfContents - 8B42FE4021698BC50092969A + 8B792B7B21F3709C006E9731 1CA23ED40692098700951B8B - 8B42FE4121698BC50092969A + 8B792B7C21F3709C006E9731 8BE6256A2157A03900E4E476 - 8B42FE4221698BC50092969A + 8B792B7D21F3709C006E9731 1CA23EDF0692099D00951B8B 1CA23EE00692099D00951B8B 1CA23EE10692099D00951B8B @@ -635,7 +633,7 @@ StatusbarIsVisible TimeStamp - 560565189.36784196 + 569602204.74752998 ToolbarConfigUserDefaultsMinorVersion 2 ToolbarDisplayMode @@ -652,11 +650,11 @@ 5 WindowOrderList - 8B42FE4321698BC50092969A + 8B792B7E21F3709C006E9731 /Users/christopherjohnson/Desktop/MacAU/DubSub/DubSub.xcodeproj WindowString - 625 371 810 487 0 0 1440 878 + 412 359 810 487 0 0 1440 878 WindowToolsV3 -- cgit v1.2.3