Skip to content

Instantly share code, notes, and snippets.

@Enchufa2
Created March 29, 2016 19:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Enchufa2/394b72acb0eac979a642b03b3af04265 to your computer and use it in GitHub Desktop.
Save Enchufa2/394b72acb0eac979a642b03b3af04265 to your computer and use it in GitHub Desktop.
Simulation of the chirp echo created in the staircases of Mesoamerican pyramids
clap = audioread('clap.wav');
fs = 96e3; % sampling frequency
N = 40; % steps
ssize = 0.15; % step size
delay = ssize * 2 / 340;
samples = round(delay * fs);
stairs = zeros(samples * N + length(clap) + N, N);
for i = 1:N
samples = samples + 1;
indexes = (i-1)*samples+1 : length(clap)+(i-1)*samples;
stairs(indexes, i) = clap;
end
stairs = sum(stairs, 2);
audioplayer(clap, fs).play();
audioplayer(stairs, fs).play();
figure;
ax1(1) = subplot(2, 2, 1);
plot((1:length(clap))/fs, clap);
ax2(1) = subplot(2, 2, 2);
periodogram(clap);
ax1(2) = subplot(2, 2, 3);
plot((1:length(stairs))/fs, stairs);
ax2(2) = subplot(2, 2, 4);
periodogram(stairs);
set(ax2, 'xscale', 'log');
@PabRod
Copy link

PabRod commented Apr 19, 2016

Would you please share the clap.wav file you used?

Thanks ;)

@Enchufa2
Copy link
Author

Enchufa2 commented Mar 2, 2018

I don't know if I keep that file, but there are few things as easy and cheap as recording a clap. ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment