Skip to content

Commit

Permalink
Add fixedpointprecision definitions.
Browse files Browse the repository at this point in the history
  • Loading branch information
sletz committed Apr 7, 2021
1 parent 7c67bc8 commit 4cd48b9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
3 changes: 3 additions & 0 deletions maths.lib
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ E = 2.71828182845904523536;
singleprecision EPSILON = 1.192092896e-07;
doubleprecision EPSILON = 2.2204460492503131e-016;
quadprecision EPSILON = 2.2204460492503131e-016;
fixedpointprecision EPSILON = 2.2204460492503131e-016;


//---------------------------------`(ma.)MIN`---------------------------------------
Expand All @@ -135,6 +136,7 @@ quadprecision EPSILON = 2.2204460492503131e-016;
singleprecision MIN = 1.175494351e-38;
doubleprecision MIN = 2.2250738585072014e-308;
quadprecision MIN = 2.2250738585072014e-308;
fixedpointprecision MIN = 2.2250738585072014e-308;


//---------------------------------`(ma.)INFINITY`------------------------------
Expand All @@ -149,6 +151,7 @@ quadprecision MIN = 2.2250738585072014e-308;
singleprecision INFINITY = 3.402823466e+38;
doubleprecision INFINITY = 1.7976931348623158e+308;
quadprecision INFINITY = 1.7976931348623158e+308;
fixedpointprecision INFINITY = 1.7976931348623158e+308;


//---------------------------------`(ma.)FTZ`---------------------------------------
Expand Down
13 changes: 10 additions & 3 deletions quantizers.lib
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,12 @@ with{
noteRatio(n,oct) = _ <: (ba.take(n,nl)<=((_/oct)/rf))*findValue(n,oct)+
(ba.take(n,nl)>((_/oct)/rf))*(noteRatio(n-1,oct));

findValue(n,oct) = _<: (n<nN)*
findValue(n,oct) = _<: (n<nN)*
(((_/oct)/rf)-ba.take(n,nl))/((ba.take(min(n+1,nN)-(n==nN),nl)-ba.take(n,nl)))
+(n==nN)*
(((_/oct)/rf)-ba.take(n,nl))/(2-ba.take(n,nl)):
qSmooth : //smoothing curve
_*(
(n<nN)*(ba.take(min(n+1,nN)-(n==nN),nl)-ba.take(n,nl))+
_*((n<nN)*(ba.take(min(n+1,nN)-(n==nN),nl)-ba.take(n,nl))+
(n==nN)*(2-ba.take(n,nl))
)+ba.take(n,nl);
};
Expand All @@ -129,6 +128,7 @@ with{
//-------------------------------------------------------------
ionian = (1,pow(2,2/12),pow(2,4/12),pow(2,5/12),pow(2,7/12),pow(2,9/12),pow(2,11/12));


//---------------------`(qu.)dorian`--------------------------
// List of the frequency ratios of the notes of the dorian mode.
//
Expand All @@ -143,6 +143,7 @@ ionian = (1,pow(2,2/12),pow(2,4/12),pow(2,5/12),pow(2,7/12),pow(2,9/12),pow(2,11
//-------------------------------------------------------------
dorian = (1,pow(2,2/12),pow(2,3/12),pow(2,5/12),pow(2,7/12),pow(2,8/12),pow(2,10/12));


//---------------------`(qu.)phrygian`--------------------------
// List of the frequency ratios of the notes of the phrygian mode.
//
Expand All @@ -157,6 +158,7 @@ dorian = (1,pow(2,2/12),pow(2,3/12),pow(2,5/12),pow(2,7/12),pow(2,8/12),pow(2,10
//-------------------------------------------------------------
phrygian = (1,pow(2,1/12),pow(2,3/12),pow(2,5/12),pow(2,7/12),pow(2,8/12),pow(2,10/12));


//---------------------`(qu.)lydian`--------------------------
// List of the frequency ratios of the notes of the lydian mode.
//
Expand All @@ -171,6 +173,7 @@ phrygian = (1,pow(2,1/12),pow(2,3/12),pow(2,5/12),pow(2,7/12),pow(2,8/12),pow(2,
//-------------------------------------------------------------
lydian = (1,pow(2,2/12),pow(2,4/12),pow(2,6/12),pow(2,7/12),pow(2,9/12),pow(2,11/12));


//---------------------`(qu.)mixo`--------------------------
// List of the frequency ratios of the notes of the mixolydian mode.
//
Expand All @@ -185,6 +188,7 @@ lydian = (1,pow(2,2/12),pow(2,4/12),pow(2,6/12),pow(2,7/12),pow(2,9/12),pow(2,11
//-------------------------------------------------------------
mixo = (1,pow(2,2/12),pow(2,4/12),pow(2,5/12),pow(2,7/12),pow(2,9/12),pow(2,10/12));


//---------------------`(qu.)eolian`--------------------------
// List of the frequency ratios of the notes of the eolian mode.
//
Expand All @@ -199,6 +203,7 @@ mixo = (1,pow(2,2/12),pow(2,4/12),pow(2,5/12),pow(2,7/12),pow(2,9/12),pow(2,10/1
//-------------------------------------------------------------
eolian = (1,pow(2,2/12),pow(2,3/12),pow(2,5/12),pow(2,7/12),pow(2,8/12),pow(2,10/12));


//---------------------`(qu.)locrian`--------------------------
// List of the frequency ratios of the notes of the locrian mode.
//
Expand Down Expand Up @@ -273,6 +278,7 @@ natural = (1,9/8,5/4,4/3,3/2,5/3,15/8);
//-------------------------------------------------------------
dodeca = (1,pow(2,1/12),pow(2,2/12),pow(2,3/12),pow(2,4/12),pow(2,5/12),pow(2,6/12),pow(2,7/12),pow(2,8/12),pow(2,9/12),pow(2,10/12),pow(2,11/12));


//---------------------`(qu.)dimin`--------------------------
// List of the frequency ratios of the notes of the diminished scale.
//
Expand All @@ -287,6 +293,7 @@ dodeca = (1,pow(2,1/12),pow(2,2/12),pow(2,3/12),pow(2,4/12),pow(2,5/12),pow(2,6/
//-------------------------------------------------------------
dimin = (1,pow(2,1/12),pow(2,3/12),pow(2,4/12),pow(2,6/12),pow(2,7/12),pow(2,9/12),pow(2,10/12));


//---------------------`(qu.)penta`--------------------------
// List of the frequency ratios of the notes of the minor pentatonic scale.
//
Expand Down

0 comments on commit 4cd48b9

Please sign in to comment.