alert sound

9 ビュー (過去 30 日間)
hajer
hajer 2011 年 12 月 20 日
コメント済み: Benjamin Wong 2020 年 11 月 6 日
Hi , i have if condition in my code and i want to produce alert sound in wrong case. can i do that ????

採用された回答

Daniel Shub
Daniel Shub 2011 年 12 月 20 日
What about
sound(randn(4096, 1), 8192)

その他の回答 (5 件)

Jan
Jan 2011 年 12 月 20 日
WarnWave = [sin(1:.6:400), sin(1:.7:400), sin(1:.4:400)];
Audio = audioplayer(WarnWave, 22050);
play(Audio);
  4 件のコメント
Min Son
Min Son 2019 年 6 月 28 日
Cool sound!
v k
v k 2020 年 10 月 26 日
Need something similar to this, which gives a sound when the Whatsapp message comes, or an incoming SMS. A whooshing or a swishing sound.
What structure of WarnWave will give such a notification sound?

サインインしてコメントする。


Jan
Jan 2011 年 12 月 20 日
Data = load('handel.mat');
sound(Data.y, Data.Fs)
  4 件のコメント
Daniel Shub
Daniel Shub 2011 年 12 月 20 日
I agree, but for alerts you never know.
Benjamin Wong
Benjamin Wong 2020 年 11 月 6 日
this is absolutely briliant

サインインしてコメントする。


Jan
Jan 2011 年 12 月 20 日
This calls the message sound of the operating system:
beep
  2 件のコメント
Daniel Shub
Daniel Shub 2011 年 12 月 20 日
I had forgotten about beep.
Paul Hoffrichter
Paul Hoffrichter 2020 年 10 月 16 日
beep beep beep
Nice and succinct. Thanks.

サインインしてコメントする。


Daniel Shub
Daniel Shub 2011 年 12 月 20 日
So here is an absolutely ugly Windows XP hack that gets the SystemExclamation sound from the registry and replaces environment variables with the correct values and then plays the sound.
[~, tempStr] = system('reg query HKEY_CURRENT_USER\AppEvents\Schemes\Apps\.Default\SystemExclamation\.Current');
[~, valueStart] = regexp(tempStr, 'REG_EXPAND_SZ ');
soundStr = tempStr(valueStart+1:(end-1));
envVarSymbol = strfind(soundStr, '%');
while length(envVarSymbol) >= 2
soundStr = [soundStr(1:(envVarSymbol(1)-1)), ...
getenv(soundStr((envVarSymbol(1)+1):(envVarSymbol(2)-1))), ...
soundStr((envVarSymbol(2)+1):end)];
envVarSymbol = strfind(soundStr, '%');
end
[x, Fs] = wavread(soundStr);
sound(x, Fs)
I need to think about this idea more. Interfaces really should be playing system sounds (yuk, who actually has system sounds set to on) at the appropriate times.
  2 件のコメント
v k
v k 2020 年 10 月 26 日
'wavread' incorrect.
v k
v k 2020 年 10 月 26 日
replaced by 'audioread'.

サインインしてコメントする。


hajer
hajer 2011 年 12 月 20 日
thank you everyone . i have alert sound but my problem how i can call it . Now knew the solution .I'm happy to help me.

カテゴリ

Help Center および File ExchangeAudio 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