Produce sound from 1 Hz to 1000hz

조회 수: 4 (최근 30일)
Karthik Brs
Karthik Brs 2015년 11월 20일
댓글: Nneka Onubogu 2021년 5월 13일
Hello Everyone! How can I produce sound from 1 Hz to 1000 Hz for a duration of 20 secs? I'm using the following code for the generation of sound for 100Hz.
amp=0.5;
fs=20500; % sampling frequency
filename = 'CampbellAudio.wav';
duration=20;
freq=100; %I want the frequency here to be from 1 to 1000
values=0:1/fs:duration;
a=amp*sin(2*pi* freq*values);
sound(a)
audiowrite(filename,a,fs);

답변 (2개)

Walter Roberson
Walter Roberson 2015년 11월 20일

Image Analyst
Image Analyst 2015년 11월 20일
Do you have the Signal Processing Toolbox?
y = chirp(t,f0,t1,f1) generates samples of a linear swept-frequency cosine signal at the time instances defined in array t, where f0 is the instantaneous frequency at time 0, and f1 is the instantaneous frequency at time t1. f0 and f1 are both in hertz. If unspecified, f0 is e-6 for logarithmic chirp and 0 for all other methods, t1 is 1, and f1 is 100.
  댓글 수: 4
Image Analyst
Image Analyst 2021년 5월 13일
I don't know what instantaneous means in this context. Do you want to plot it immediately after every element is assigned?
Nneka Onubogu
Nneka Onubogu 2021년 5월 13일
Thanks for your reply. I actually want the modulation frequency (fpump) to change after a particular time, lets say after every 5 secs. And i also want to plot the time domain of the signal at every frequency

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Audio I/O and Waveform Generation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by