Multiply sound by pulse
Show older comments
How do I make a pulse and make the time of the pulse match the audio file time? For the pulse I would like the period to be 2 seconds, and amp of 1, and a duty cycle of 50%. I would then like to multiply the pulse by the audio file.
1 Comment
Image Analyst
on 30 Mar 2020
You shouldn't have completely replaced your original question with a new question. Now our answers below don't make much sense anymore. Anyway, you can see in my answer where I compute the audioTime. If your pulse (both 1 and 0 parts) was the length of that file, then you can't have a period of 2 seconds (unless the audio time was 2 seconds also).
Accepted Answer
More Answers (1)
Ameer Hamza
on 29 Mar 2020
Try this
load handel.mat
sound(y, Fs); % original sound
pause(9)
time_tot = numel(y)/Fs;
mod_signal = gensig('square', 1, time_tot-1/Fs, 1/Fs);
mod_sound = y.*mod_signal;
sound(mod_sound, Fs); % modulated sound
Categories
Find more on Audio I/O and Waveform Generation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!