Skip to content

Instantly share code, notes, and snippets.

/speakerTuning.m Secret

Created August 30, 2017 05:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/d18e9786acdd9dac888f72436f5ef4e4 to your computer and use it in GitHub Desktop.
Save anonymous/d18e9786acdd9dac888f72436f5ef4e4 to your computer and use it in GitHub Desktop.
%Speaker Tuning
%I apologize in advance because this is poorly commented. When I wrote this, I knew what it all meant.
%It's now 3 years later and I can't seem to recall what some of this means... I'm sorry.
%This is why you should always comment your code with useful information.
%Use this site if this is unclear, I believe it uses the same equation:
% https://www.ajdesigner.com/phpsubwoofervented/port_length_equation_k.php
innerHeight = (8.5*2.54); %cm
innerWidth = (6.00*2.54); %cm
innerDepth = (8.5*2.54); %cm
Fs = 50; %Hz
Qts = 0.34;
Qms = 6.71;
Qes = 0.36;
Mms = 10.8; %g
Vas = 11.2; %L
const = 2.35625e4;
innerVol = innerHeight * innerWidth * innerDepth; %cm^3
innerVolLiters = innerVol / 1000; %L
portDia = 1.375*2.54; %cm
Vb = 20 * Vas * Qts ^ 3.3; %Target Box Volume in liters
disp(['Target Volume = ', num2str(Vb); 'Actual Volume = ', num2str(innerVolLiters)]);
Fb = Fs * 0.42 * Qts ^(-0.96); %Tune Frequency
disp(['Tune to this frequency: ', num2str(Fb), ' Hz']);
Lv = (const*(portDia)^2)/(innerVolLiters*Fb^2) - 0.732*portDia; %k = 0.732 because 1 free end and one flanged end
disp(['Port length should be: ' num2str(Lv) ' cm!']);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment