 |
|
 |
i want to play a file with extension .mp3 ... how is that
and if that is imposible so how could i get a wav file i want to create a wav file ?!?
thnx
|
|
|
|
 |
|
 |
may i know how to change the sound? because i have changed but yet it still plays the same sound. pls help.
|
|
|
|
 |
|
 |
Just an FYI to those interested. I just found this out from a web search.
Launch a process in .NET to run the following command:
sndrec32 /play /close pathToWaveFile
"A good scientist is a person with original ideas. A good engineer is a person who makes a design that works with as few original ideas as possible." - Freeman Dyson
|
|
|
|
 |
|
 |
Has anybody encountered this? I'll probably have to try compiling on other computers to see what happens.
I made use of tony sound library per instructions in the article. After compilation, it fails to play wave file. I get silence. It's even worse on console applications, it hangs trying to play the wave file.
I originally used it for a console application (built with SharpDevelop 2.0). When that didn't work, I tried the same thing on Visual Studio 2003. When that didn't work, tried builing a GUI app on Visual Studio 2003. When that didn't work, tried using the provided demo application and source files to test.
The demo ran fine. The source ran fine after compiling. Modified the source to play a different wave file, and that worked too.
My system is running Windows XP SP2, with .NET v1.1, v2.0, Visual Studio 2003, SharpDevelop 2.0. I verified I have winmm.dll on my system as well.
My code is roughly the same as the provided demo, I have no idea what the heck's going on. I wish the compile would fail with an message or that the running the app would give a runtime error. Too bad all it does is "nothing" or hang. Guess I'll try analyzing with a debugger when I have some time.
btw, be nice if someone could compile a console app that takes an argument for the path to a wave file to play. That's what I was originally trying to do.
"A good scientist is a person with original ideas. A good engineer is a person who makes a design that works with as few original ideas as possible." - Freeman Dyson
|
|
|
|
 |
|
 |
.... how can you do that??
|
|
|
|
 |
|
 |
hi,
i found out that this program does not support other audio files other than .wav files. Do you have anything that allows the application to play other audio formats such as MP3s or WMAs?
|
|
|
|
 |
|
 |
If I try to play a file that is on the hard drive, the program still plays the same unique sound... why?
CeliSoft
|
|
|
|
 |
|
 |
look at http://republika.pl/dailybuilds/waveform.html
.net library to access wave devices and resources.
Testing your code against performance will keep you running with good scalability and maintenance for years.
NTime.exe - the free tool for real developers of high scalability applications!
|
|
|
|
 |
|
 |
How about Record Audio?
lamkas
|
|
|
|
 |
|
 |
Anyone know how to record audio into a wav file using a microphone. please help,.
|
|
|
|
 |
|
 |
yes i know, but from API not from tools.
|
|
|
|
 |
|
 |
how about trying the following?
www.codeproject.com/cs/media/cswavrec.asp
|
|
|
|
 |
|
 |
SND_SYNC = 0x0000, /* play synchronously (default) */ SND_ASYNC = 0x0001, /* play asynchronously */ SND_NODEFAULT = 0x0002, /* silence (!default) if sound notfound */ SND_LOOP = 0x0008, /* loop the sound until nextsndPlaySound */ SND_NOSTOP = 0x0010, /* don't stop any currently playingsound */ SND_NOWAIT = 0x00002000, /* don't wait if the driver is busy */ SND_FILENAME = 0x00020000, /* name is file name */ SND_RESOURCE = 0x00040004 /* name is resource name or atom */ I want to understand these flags and to add more usefull in my programs. In many of my programs i need to pause wave sound for example.
|
|
|
|
 |
|
 |
hi, my problem is that how you can know about the methods provided by winmm.dll library.
actually i want the procedure to know about the methods provided by the library, their parameter list, description of method and the return type.
plz help me in such a way or provide some links about it.
|
|
|
|
 |
|
 |
look at http://republika.pl/dailybuilds/waveform.html
.net library to access wave devices and resources.
As you asked you should look forward to Platform SDK at www.microsoft.com - see msdn section and download Platform sdk, there is all that stuff about win32 API and libraries with full documentation
Testing your code against performance will keep you running with good scalability and maintenance for years.
NTime.exe - the free tool for real developers of high scalability applications!
|
|
|
|
 |
|
 |
I took a look at your code and I have some suggestions. I rewrote your tonysound.cs class like so:
using System;
using System.Runtime.InteropServices;
namespace tonysound {
public class Sound {
public static void Play( string strFileName, PlaySoundFlags soundFlags) {
PlaySound( strFileName, IntPtr.Zero, soundFlags);
}
[DllImport("winmm.dll")] //inports the winmm.dll used for sound
private static extern bool PlaySound( string szSound, IntPtr hMod, PlaySoundFlags flags );
}
[Flags] //enumeration treated as a bit field or set of flags
public enum PlaySoundFlags: int {
SND_SYNC = 0x0000, /* play synchronously (default) */
SND_ASYNC = 0x0001, /* play asynchronously */
SND_NODEFAULT = 0x0002, /* silence (!default) if sound notfound */
SND_LOOP = 0x0008, /* loop the sound until nextsndPlaySound */
SND_NOSTOP = 0x0010, /* don't stop any currently playingsound */
SND_NOWAIT = 0x00002000, /* don't wait if the driver is busy */
SND_FILENAME = 0x00020000, /* name is file name */
SND_RESOURCE = 0x00040004 /* name is resource name or atom */
}
}
then to call the Play method you would do something like this:
Sound.Play("sound.wav", PlaySoundFlags.SND_FILENAME | PlaySoundFlags.SND_ASYNC | PlaySoundFlags.SND_LOOP | PlaySoundFlags.SND_NOSTOP);
There are a few reasons to implement these changes. You don't have to know what strings to pass in to the Play method, you don't have to pass any more flags in than you actually need, and you don't have to do string comparisons (yuck!).
Mark Pitman
|
|
|
|
 |
|
 |
Thanks.
You have a very good point about the string comparison part. I never even thought about it that way. I will change the source code to make these changes for I actually like it better myself. This is one of the main reasons I posted this article. So I can learn how to make my code better from individuals like yourself and also share something useful to others.
Thanks again. When I get a chance I will recompile test and update my version on here. It shouldn't be any later than tonight.
You can tell I'm new at this but hey we all start somewhere
Win32newb
"Making windows programs worse than they already are"
|
|
|
|
 |
|
 |
Tonysound, Great Windows API wrapper for playing sound files. Simple and easy to use. Would be cool if you explained more about the wrapper classes and their purpose.
Chatbot! - Hexbot.com - Natural Language Search Engine Chat Bot
|
|
|
|
 |