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/ButterComp2/ButterComp2.cpp | 18 ++++------- .../christopherjohnson.pbxuser | 22 +++++++------- .../christopherjohnson.perspectivev3 | 35 ++++++++++------------ 3 files changed, 32 insertions(+), 43 deletions(-) (limited to 'plugins/MacAU/ButterComp2') diff --git a/plugins/MacAU/ButterComp2/ButterComp2.cpp b/plugins/MacAU/ButterComp2/ButterComp2.cpp index e85626f..ec45914 100755 --- a/plugins/MacAU/ButterComp2/ButterComp2.cpp +++ b/plugins/MacAU/ButterComp2/ButterComp2.cpp @@ -317,23 +317,15 @@ void ButterComp2::ButterComp2Kernel::Process( const Float32 *inSourceP, flip = !flip; - //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/ButterComp2/ButterComp2.xcodeproj/christopherjohnson.pbxuser b/plugins/MacAU/ButterComp2/ButterComp2.xcodeproj/christopherjohnson.pbxuser index e13714b..9bf558f 100755 --- a/plugins/MacAU/ButterComp2/ButterComp2.xcodeproj/christopherjohnson.pbxuser +++ b/plugins/MacAU/ButterComp2/ButterComp2.xcodeproj/christopherjohnson.pbxuser @@ -49,13 +49,13 @@ PBXFileDataSource_Warnings_ColumnID, ); }; - PBXPerProjectTemplateStateSaveDate = 559960504; - PBXWorkspaceStateSaveDate = 559960504; + PBXPerProjectTemplateStateSaveDate = 569590507; + PBXWorkspaceStateSaveDate = 569590507; }; perUserProjectItems = { 8B42FD41216050B10092969A /* PBXTextBookmark */ = 8B42FD41216050B10092969A /* PBXTextBookmark */; - 8B42FD83216056480092969A /* PBXTextBookmark */ = 8B42FD83216056480092969A /* PBXTextBookmark */; - 8B42FD84216056480092969A /* PBXTextBookmark */ = 8B42FD84216056480092969A /* PBXTextBookmark */; + 8B79289621F34318006E9731 /* PBXTextBookmark */ = 8B79289621F34318006E9731 /* PBXTextBookmark */; + 8B79289B21F34328006E9731 /* PBXTextBookmark */ = 8B79289B21F34328006E9731 /* PBXTextBookmark */; 8BE6255F2157A02A00E4E476 /* PlistBookmark */ = 8BE6255F2157A02A00E4E476 /* PlistBookmark */; }; sourceControlManager = 8BD3CCB8148830B20062E48C /* Source Control */; @@ -72,32 +72,32 @@ vrLen = 214; vrLoc = 5453; }; - 8B42FD83216056480092969A /* PBXTextBookmark */ = { + 8B79289621F34318006E9731 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8BA05A660720730100365D66 /* ButterComp2.cpp */; name = "ButterComp2.cpp: 252"; rLen = 0; rLoc = 10778; rType = 0; - vrLen = 265; + vrLen = 180; vrLoc = 10712; }; - 8B42FD84216056480092969A /* PBXTextBookmark */ = { + 8B79289B21F34328006E9731 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8BA05A660720730100365D66 /* ButterComp2.cpp */; name = "ButterComp2.cpp: 252"; rLen = 0; rLoc = 10778; rType = 0; - vrLen = 265; + vrLen = 180; vrLoc = 10712; }; 8BA05A660720730100365D66 /* ButterComp2.cpp */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {586, 4498}}"; + sepNavIntBoundsRect = "{{0, 0}, {558, 4329}}"; sepNavSelRange = "{10778, 0}"; - sepNavVisRange = "{10712, 265}"; - sepNavWindowFrame = "{{864, 45}, {816, 833}}"; + sepNavVisRange = "{10712, 180}"; + sepNavWindowFrame = "{{496, 45}, {816, 833}}"; }; }; 8BA05A690720730100365D66 /* ButterComp2Version.h */ = { diff --git a/plugins/MacAU/ButterComp2/ButterComp2.xcodeproj/christopherjohnson.perspectivev3 b/plugins/MacAU/ButterComp2/ButterComp2.xcodeproj/christopherjohnson.perspectivev3 index c95d3a7..22a4926 100755 --- a/plugins/MacAU/ButterComp2/ButterComp2.xcodeproj/christopherjohnson.perspectivev3 +++ b/plugins/MacAU/ButterComp2/ButterComp2.xcodeproj/christopherjohnson.perspectivev3 @@ -256,8 +256,6 @@ Layout - BecomeActive - ContentConfiguration PBXBottomSmartGroupGIDs @@ -326,7 +324,7 @@ 288 RubberWindowFrame - 662 164 841 654 0 0 1440 878 + 456 186 841 654 0 0 1440 878 Module PBXSmartGroupTreeModule @@ -354,12 +352,12 @@ _historyCapacity 0 bookmark - 8B42FD84216056480092969A + 8B79289B21F34328006E9731 history 8BE6255F2157A02A00E4E476 8B42FD41216050B10092969A - 8B42FD83216056480092969A + 8B79289621F34318006E9731 SplitCount @@ -373,18 +371,18 @@ GeometryConfiguration Frame - {{0, 0}, {531, 126}} + {{0, 0}, {531, 109}} RubberWindowFrame - 662 164 841 654 0 0 1440 878 + 456 186 841 654 0 0 1440 878 Module PBXNavigatorGroup Proportion - 126pt + 109pt Proportion - 482pt + 499pt Tabs @@ -398,9 +396,7 @@ GeometryConfiguration Frame - {{10, 27}, {531, 455}} - RubberWindowFrame - 662 164 841 654 0 0 1440 878 + {{10, 27}, {531, 472}} Module XCDetailModule @@ -454,7 +450,9 @@ GeometryConfiguration Frame - {{10, 27}, {531, 393}} + {{10, 27}, {531, 472}} + RubberWindowFrame + 456 186 841 654 0 0 1440 878 Module PBXBuildResultsModule @@ -482,11 +480,11 @@ TableOfContents - 8B42FD85216056480092969A + 8B79289C21F34328006E9731 1CA23ED40692098700951B8B - 8B42FD86216056480092969A + 8B79289D21F34328006E9731 8BD7274A1D46E5A5000176F0 - 8B42FD87216056480092969A + 8B79289E21F34328006E9731 1CA23EDF0692099D00951B8B 1CA23EE00692099D00951B8B 1CA23EE10692099D00951B8B @@ -659,7 +657,7 @@ StatusbarIsVisible TimeStamp - 559961672.53862405 + 569590568.39095497 ToolbarConfigUserDefaultsMinorVersion 2 ToolbarDisplayMode @@ -676,11 +674,10 @@ 5 WindowOrderList - 8B42FD88216056480092969A /Users/christopherjohnson/Desktop/MacAU/ButterComp2/ButterComp2.xcodeproj WindowString - 662 164 841 654 0 0 1440 878 + 456 186 841 654 0 0 1440 878 WindowToolsV3 -- cgit v1.2.3