rise/fall time
現在この質問をフォロー中です
- フォローしているコンテンツ フィードに更新が表示されます。
- コミュニケーション基本設定に応じて電子メールを受け取ることができます。
エラーが発生しました
ページに変更が加えられたため、アクションを完了できません。ページを再度読み込み、更新された状態を確認してください。
古いコメントを表示
0 投票
Hi, can anyone help me to generate 2 sounds of 500 and 1000 Hz with 25 ms duration with ISI of 30 ms and rise/fall time of 10 ms with Fs of 44100 and I want to 500 Hz be 10 dB less than 1000 Hz
採用された回答
Shae Morgan
2020 年 7 月 31 日
編集済み: Shae Morgan
2020 年 7 月 31 日
%set-up parameters
fs=44100; %CD quality - also conveniently divisible by 30 and 25
stim_dur=.025; %duration in seconds
ISI_dur=.030; %ISI duration in seconds
ramp_dur=.010; %ramp duration in seconds
t=0:1/fs:stim_dur-1/fs;
f1=500;
f2=1000;
%create signals
xt1=sin(2*pi*f1*t);
xt2=sin(2*pi*f2*t);
%setup ramp
rampSamps = floor(fs*ramp_dur);
window=hanning(2*rampSamps)'; %hanning window is cosine^2 this will change depending on the kind of ramp you want
w1=window(1:ceil((length(window))/2)); %use the first half of hanning function for onramp
w2=window(ceil((length(window))/2)+1:end); %use second half of hanning function of off ramp
w1 = [w1 ones(1,length(xt1)-length(w1))];
w2 = [ones(1,length(xt1)-length(w2)) w2];
%ramp stimuli
xt1_ramped = xt1.*w1.*w2;
xt2_ramped = xt2.*w1.*w2;
%generate ISI
ISI=zeros(ISI_dur*fs,1);
%final stimulus
out=[xt1_ramped';ISI;xt2_ramped'];
plot(out)
9 件のコメント
Shae Morgan
2020 年 7 月 31 日
Edited for transposition to allow concatenation*
I hope this is what you're looking for!
Parisa
2020 年 7 月 31 日
Thank you very much,you helped me alot. but how can I hear this sound?
Shae Morgan
2020 年 7 月 31 日
See below
sound(out,fs) %play the sound
audiowrite('filename.wav',out,fs) %save it
If this answer works for you, please accept! :)
Parisa
2020 年 7 月 31 日
Im so grateful. thanks again
Parisa
2020 年 8 月 2 日
I am sorry but I have another question, what if I want to 500 Hz signal to be 10 dB more than 1000 Hz?
Shae Morgan
2020 年 8 月 3 日
編集済み: Shae Morgan
2020 年 8 月 3 日
sure,
so the amplitude of each sine wave is a multiplier added to the sin function
amp = 1 by default, but since we added a ramp to these stimuli, their total average loudness will vary - so the question is, do you want the peak (after the ramp on but before the ramp off) to be 10 dB louder? or do you want the overall ramped stimulus to be 10 dB louder?
%% option 1
% %scale stimuli and then ramp
amp1=1;
amp2=10^(-10/20);
%create signals
xt1=amp1*sin(2*pi*f1*t);
xt2=amp2*sin(2*pi*f2*t);
%check
rms1=rms(xt1);
rms2=rms(xt2);
dB_diff=20*log10(rms1/rms2);
%proceed with th rest of the code and perform the ramping
%% option 2
%ramp stimuli and then scale
rms_xt1_ramped=rms(xt1_ramped); %check the average intensity of the ramped 500 Hz signal
amp2_10dB=10^(-10/20)*rms_xt1_ramped; %find the new amplitude that is 10 dB lower
%normalize the xt2_ramped stimulus and then scale to -10 dB
xt2_ramped_norm=xt2_ramped./rms(xt2_ramped);
xt2_ramped_10dB=xt2_ramped_norm.*amp2_10dB;
%check
rms_xt2_ramped=rms(xt2_ramped_10dB);
20*log10(rms_xt1_ramped/rms_xt2_ramped)
Parisa
2020 年 8 月 3 日
once again you helped me, thank you so so much for your help
Hi dear Shae
I asked another question but nobody answered it. can you see if you can answer me please?
I want to replace 500 Hz to a 200 ms 950 to 1050 Hz noise with 10 ms rise/ fall time and 10 dB SNR with 10 ms ISI
Generating pure tone and noise
Shae Morgan
2020 年 8 月 7 日
I looked at your question and submitted an answer - there you asked for a 20 ms ISI, so I answered the question you asked there, not here. Please update the question if it isn't what you need and I'll be happy to submit an answer.
If the solution works, please choose to accept my answer! It helps me a lot as I try to help you!
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Logical についてさらに検索
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の MathWorks のサイトは、お客様の地域からのアクセスが最適化されていません。
南北アメリカ
- América Latina (Español)
- Canada (English)
- United States (English)
ヨーロッパ
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
