Skip to content

Commit

Permalink
feat: Added two new liveprog scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
timschneeb committed Nov 5, 2022
1 parent 0448fe8 commit ae85b56
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 0 deletions.
26 changes: 26 additions & 0 deletions app/src/main/assets/Liveprog/butterworth3Band.eel
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
desc: Butterworth 3 bands (Equalization example)

@init
iirBPS = 0;
reqSize = IIRBandSplitterInit(iirBPS, srate, 4000, 12000);
iirBPS2 = iirBPS + reqSize; // Shift the pointer
reqSize = IIRBandSplitterInit(iirBPS2, srate, 4000, 12000);
low1 = 0;
mid1 = 0;
high1 = 0;
eqGain = iirBPS2 + reqSize; // Shift pointer again
eqGain[0] = 1;
eqGain[1] = 0;
eqGain[2] = 1;

@sample
IIRBandSplitterProcess(iirBPS, spl0, low1, mid1, high1);
IIRBandSplitterProcess(iirBPS, spl1, low2, mid2, high2);
low1 *= eqGain[0];
mid1 *= eqGain[1];
high1 *= eqGain[2];
low2 *= eqGain[0];
mid2 *= eqGain[1];
high2 *= eqGain[2];
spl0 = low1 + mid1 + high1;
spl1 = low2 + mid2 + high2;
33 changes: 33 additions & 0 deletions app/src/main/assets/Liveprog/butterworth8Band.eel
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
desc: Butterworth 8 bands (Equalization example)

@init
iirBPS = 0;
reqSize = IIRBandSplitterInit(iirBPS, srate, 180, 800, 1600, 2700, 5600, 6500, 10000);
iirBPS2 = iirBPS + reqSize; // Shift the pointer
reqSize = IIRBandSplitterInit(iirBPS2, srate, 180, 800, 1600, 2700, 5600, 6500, 10000);
subbandLeft = iirBPS2 + reqSize; // Subband temp buffer, shift pointer again
subbandRight = subbandLeft + 8; // Subband temp buffer, shift pointer again, subbandLeft has 8 elements
eqGain = subbandRight + 8; // Shift pointer again, subbandRight has 8 elements
eqGain[0] = 1;
eqGain[1] = 0;
eqGain[2] = 1;
eqGain[3] = 1;
eqGain[4] = 0;
eqGain[5] = 1;
eqGain[6] = 0;
eqGain[7] = 1;

@sample
IIRBandSplitterProcess(iirBPS, spl0, subbandLeft[0], subbandLeft[1], subbandLeft[2], subbandLeft[3], subbandLeft[4], subbandLeft[5], subbandLeft[6], subbandLeft[7]);
IIRBandSplitterProcess(iirBPS2, spl1, subbandRight[0], subbandRight[1], subbandRight[2], subbandRight[3], subbandRight[4], subbandRight[5], subbandRight[6], subbandRight[7]);
sumLeft = 0;
sumRight = 0;
i = 0;
loop(8,
subbandLeft[i] *= eqGain[i];
subbandRight[i] *= eqGain[i];
sumLeft += subbandLeft[i];
sumRight += subbandRight[i];
i += 1);
spl0 = sumLeft;
spl1 = sumRight;

0 comments on commit ae85b56

Please sign in to comment.