LeTay
asked on
Produce a sound in Delphi
I would like to produce a sound, says one note of music, for several seconds in Delphi
Is there an easy way to do it ?
Is there an easy way to do it ?
ASKER
I tried your sample, but no sound came out
Let's say I want to have a specific music note played for 3 seconds.
What should I code ?
Let's say I want to have a specific music note played for 3 seconds.
What should I code ?
turning your volume up might help
if you can't get that tiny sample to work, why look further ?
if you can't get that tiny sample to work, why look further ?
ASKER
Volume is ok, thanks for the advice
It works for windowslogon, but this is not the purpose
I want a music note played for several seconds, not just a beep, blabla, bing, bong or boum
Thanks
It works for windowslogon, but this is not the purpose
I want a music note played for several seconds, not just a beep, blabla, bing, bong or boum
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I tried, setting the duration to 5000 msec but on sndPlaySound (put a breakpoint), no sound comes out and it does not last for the 5 seconds (its immediately terminated)
Strange, because works to me (win7 + Delphi 6). You use win 10 and Delphi xx?
ASKER
Use Windows 7 and Delphi XE2
Code is unbelievably more complex than in the years 1970 !
I remember I coded entire music partition with text file input (notes, durations etc...) very simply
Shell I use .wav files instead ?
Code is unbelievably more complex than in the years 1970 !
I remember I coded entire music partition with text file input (notes, durations etc...) very simply
Shell I use .wav files instead ?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Will try that ...
example: RiffId: string = 'RIFF'; goes to RiffId: AnsiString = 'RIFF';
but that might sound a little like roundrunner ... via the pc speaker
or via uses MMSystem and PlaySound
Open in new window
a list of what system sounds can be played is in HKCU/AppEvents/EventLabels
Other eventlabels instead of 'Open':
'WindowsLogon', 'WindowsLogoff', etc ...