add a millisecond of silence to a sound?
7 views (last 30 days)
Show older comments
i do create a white noise sound and i want to add a milliseconds of silence moment to it. how to do that? and how to customize the location of the silence and the duration? this is the code:
% clc;clear all;close all;
sf = 44100;
d= input('total duration of stimulus (in sec) = ');
n = sf * d;
noise = randn(1, n);
noise = noise / max(abs(noise));
disp('WhiteNoise');
sound(noise, sf);
x = linspace(0, d, n);
plot(x,noise);
xlabel('time (s)');
title('sound: noise');
grid on;
thank you.
0 Comments
Answers (1)
Image Analyst
on 15 Sep 2018
Use zeros() to insert zero, something like
signal = [signal(1:index), ones(1, numSamples), signal(index+1:end)]
Vary index and numSamples, and variable names to achieve what you want.
0 Comments
See Also
Categories
Find more on Speech Recognition 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!