Play wave files

Posted on 2001-07-12
Last Modified: 2010-04-06
Hello all,
How can I play some sounds without actually creating and using wave files in disk?
I tried to pack the wave files together with the EXE.  However, when I need to use them, I have to write the wave files to disk first and load them afterwards.
In other words, how can I play wave files without the involvement of the disk at all.

Thanks in advance.

PS. I can't use third-party components due to some reasons.
Question by:nyt

Expert Comment

ID: 6276345
Can you stream your WAV data into a TMemoryStream? You can then play them from there like this:

  wave : TMemoryStream;
  wave := TmemoryStream.Create;
  sndPlaySound(wave.Memory, snd_Memory + snd_Sync);

You'll need to get the data into the memorystream but the above code will play that no problem (just make sure you have mmSystem in your uses clause)

The Neil =:)
LVL 22

Accepted Solution

Mohammed Nasman earned 50 total points
ID: 6276371

  Read this article, I think it will be useful for you

Inside the EXE


Author Comment

ID: 6278170
Great...the webpage shows the way step by step.  I got it work easily.
Thank you.

Featured Post

Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question