Change Impulse in a 3D Wave Simulation.

Hi! I'm working on a 3D wave propagation project and I've designed an impulse response, but I would like to change it to an audio file source. Problem is, I'm having a hard time conceiving how to do so.
% Desired Impluse
[impulse, fs] = audioread('snare.wav');
% Current Method
u = zeros(nx+1, ny+1, nz+1);
uNext = zeros(nx+1, ny+1, nz+1);
u(floor(nx/2), floor(ny/2), floor(nz/2)) = 1; % Impulse
u((3:9), (3:9), (3:9)) = hann3D(7); % Displacement
uPrev = u;
% 3D Wave Equation
uNext(x,y,z) = (2 * u(x,y,z) - uPrev(x,y,z) ...
+ lambdaSq * (u(x+1,y,z) + u(x,y+1,z) + u(x,y,z+1)...
- 6*u(x,y,z) + u(x-1,y,z) + u(x,y-1,z) + u(x,y,z-1)));
Please let me know if you need the full code to understand what I'm attempting to do.

Answers (0)

Categories

Find more on Simulation, Tuning, and Visualization in Help Center and File Exchange

Asked:

on 8 Jun 2021

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!