Question
Dear Community, I would like to print a sinewave with volume automation in mathlab. I am already able to print a stereo wave file with a fixed amplitude. Is it possible to set time points with corresponding amplitude values? fs = 44100; i=1/fs; t = 0:i:2; phi = 0; A = 1; f = 220.0000; x = A*sin((2*pi*f*t) + phi); f = 220.0000; y = A*sin((2*pi*f*t) + phi); stereo_mtx = [x(:), y(:)]; audiowrite('stereo sound 3.wav', stereo_mtx, fs); Any help is much appreciated! Thanks
Expert Answer
John Williams
PhD Expert
Answered Aug 12, 2026
this is my suggestion
fs = 44100;
dt=1/fs;
t = 0:dt:2;
phi = 0;
A = 1;
f = 220.0000;
x = A*sin((2*pi*f*t) + phi);
f = 220.0000;
y = A*sin((2*pi*f*t) + phi);
% define volume envelopp by time index + amplitude set points
tt = [0 0.5 1.5 2];
yt = [0 1 0.75 0]; % linear fade in / fade out demo
w = interp1(tt,yt,t); % create window of same length as signal
y = y.*w; % apply window
stereo_mtx = [x(:), y(:)];
audiowrite('stereo sound 3.wav', stereo_mtx, fs);
100% Run Guarantee
3-Hour Fast-Track Delivery
Need a Custom Version or Complete Simulation for This Problem?
Our 500+ PhD engineers build, debug, and optimize working MATLAB scripts and Simulink (.slx) models tailored to your exact assignment rubrics with zero plagiarism.
Tested on MATLAB R2024b / R2026a
Turnitin 0% Plagiarism Report
Free 7-Day Revisions Guarantee
Have a different question? Ask here
Related automation Questions & Solutions
Browse All →
Explore similar technical troubleshooting questions and verified MATLAB solutions:
Ready-to-Run MATLAB & Simulink Projects
Browse All Projects →