class Timer { public: typedef double diff_type; Timer(): start(std::clock()), elapsed(0) {} diff_type last() const { return elapsed; } void begin() { start = std::clock(); elapsed = 0; } diff_type end(); diff_type getCurrent(); private: std::clock_t start; diff_type elapsed; }; Timer::diff_type Timer::end() { elapsed = (diff_type)std::clock() - start; elapsed /= CLOCKS_PER_SEC; return elapsed; } Timer::diff_type Timer::getCurrent() { elapsed = (diff_type)std::clock() - start; return elapsed; } fourierAnalysis.m % Import wav audio files, make sure they are same length [control controlFs] = wavread('500HzControl.wav', 50000); [test testFs] = wavread('500Hztest.wav', 50000); % perform fft of signals Xcontrol = fft(control); Xtest = fft(test); % Compute frequency for x axis nControl = length(control) - 1; nTest = length(test) - 1; fControl = 0:controlFs / nControl:controlFs; fTest = 0:testFs / nControl:testFs; % Plot Data figure(1) plot(fControl,abs(Xcontrol))
class Timer { public: typedef double diff_type; Timer(): start(std::clock()), elapsed(0) {} diff_type last() const { return elapsed; } void begin() { start = std::clock(); elapsed = 0; } diff_type end(); diff_type getCurrent(); private: std::clock_t start; diff_type elapsed; }; Timer::diff_type Timer::end() { elapsed = (diff_type)std::clock() - start; elapsed /= CLOCKS_PER_SEC; return elapsed; } Timer::diff_type Timer::getCurrent() { elapsed = (diff_type)std::clock() - start; return elapsed; } fourierAnalysis.m % Import wav audio files, make sure they are same length [control controlFs] = wavread('500HzControl.wav', 50000); [test testFs] = wavread('500Hztest.wav', 50000); % perform fft of signals Xcontrol = fft(control); Xtest = fft(test); % Compute frequency for x axis nControl = length(control) - 1; nTest = length(test) - 1; fControl = 0:controlFs / nControl:controlFs; fTest = 0:testFs / nControl:testFs; % Plot Data figure(1) plot(fControl,abs(Xcontrol))
FinalReportDesignTeam1.docx