|
-
May 29th, 2006, 10:54 AM
#1
Thread Starter
Addicted Member
-
May 29th, 2006, 11:17 AM
#2
Fanatic Member
Re: Soundplaying problems!
It should work if you use the PlaySound API.
I think you will probably have to play the sounds Syncronously unless you can find a way to detect when the sound has finished playing (possibly use a timer if the time of the sound is constant)
-
May 29th, 2006, 11:30 AM
#3
Re: Soundplaying problems!
If the sounds are WAVe files, then you can use DirectSound to play the sounds.
Also, you can append all files into one, then you can play them in any player.
-
May 29th, 2006, 12:14 PM
#4
Thread Starter
Addicted Member
Re: Soundplaying problems!
It isn't possible to append all files into one since the program uses different soundfiles different times.
How do I use this DirectSound thing? Can it really play several soundfiles without any pause interval at all in between?
Where do I find this PlaySound API?
-
May 29th, 2006, 12:22 PM
#5
Thread Starter
Addicted Member
-
May 29th, 2006, 12:30 PM
#6
Re: Soundplaying problems!
Can you specify what kind of sound files ?
-
May 29th, 2006, 12:32 PM
#7
Thread Starter
Addicted Member
Re: Soundplaying problems!
Short MP3 files...just a second or two. It's for a text-to-speech program and I don't want it to pause between every letter.
Plz help !
-
May 29th, 2006, 12:33 PM
#8
Thread Starter
Addicted Member
Re: Soundplaying problems!
If you don't have a solution for MP3 files...I can convert them to WAV files.
-
May 29th, 2006, 12:53 PM
#9
Re: Soundplaying problems!
 Originally Posted by cyber_alex
Short MP3 files...just a second or two. It's for a text-to-speech program and I don't want it to pause between every letter.
Plz help  !
See if you have said that from the beginning, things would be much more clear.
OK, so the best way is to load the MP3's into memory (though I don't know how to do it with MP3, only with WAV)
You can load all in memory, then just play each one when the time comes.
Take a look at this thread because it is simmilar:
http://www.vbforums.com/showthread.php?t=376046
It loads all the sounds into an array, then plays them...
-
May 29th, 2006, 12:57 PM
#10
Thread Starter
Addicted Member
Re: Soundplaying problems!
okay..tnx, I'll check it out
-
May 29th, 2006, 01:29 PM
#11
Thread Starter
Addicted Member
-
May 29th, 2006, 01:40 PM
#12
PowerPoster
Re: Soundplaying problems!
here's another example ... sample uses 2 windows media wave sounds, ding and chord, you can suppliment them with your own .. sample works on the letter a and b .. but obviously you can alter all that part ..
Attached the sample project.
Last edited by rory; May 29th, 2006 at 01:44 PM.
-
May 29th, 2006, 01:56 PM
#13
Re: Soundplaying problems!
To tell you the truth, even if you make the program play the sounds without pause in between, it will still not sound right.
You are trying to make a text-to-speech program. Human voice is more complex than just playing the same sounds in different order (the letters in the word).
You need to MIX the sounds (the ending of previous letter with beginning of current letter), even then it won't sound right, but it will be closer to what you want.
You need to learn more about sound before you start making your text-to-speech program.
Let me take a look in that program (the link I gave you in previous post), and extract the code where it loads the sounds, and plays them. It will take me a little while (I'm at work now)
-
May 29th, 2006, 02:44 PM
#14
Re: Soundplaying problems!
 Originally Posted by CVMichael
Let me take a look in that program (the link I gave you in previous post), and extract the code where it loads the sounds, and plays them. It will take me a little while (I'm at work now)
Actually the code is so simple, you can't get any easier than this...
Anyways...
The initializations:
VB Code:
Private DX As New DirectX8
Private SEnum As DirectSoundEnum8
Private DIS As DirectSound8
Private ABuff() As DirectSoundSecondaryBuffer8
Loading the sounds:
VB Code:
Private Sub Form_Load()
Dim BuffDesc As DSBUFFERDESC
Dim K As Long
Set SEnum = DX.GetDSEnum
Set DIS = DX.DirectSoundCreate(SEnum.GetGuid(1))
DIS.SetCooperativeLevel Me.hWnd, DSSCL_NORMAL
ReDim ABuff(25)
For K = 0 To 25
BuffDesc.lFlags = DSBCAPS_STATIC
FileName = App.Path & "\Wav\A-" & K & ".wav"
Set ABuff(K) = DIS.CreateSoundBufferFromFile(FileName, BuffDesc)
Next K
Playing the sounds:
VB Code:
ABuff(Sound_Index).Play DSBPLAY_DEFAULT
-
May 30th, 2006, 08:30 AM
#15
Thread Starter
Addicted Member
Re: Soundplaying problems!
tnx, I'll try it when I have time
-
May 30th, 2006, 10:45 AM
#16
Re: Soundplaying problems!
Downloading SAPI SDK and making your own voice engine may be another option.
It is not hard to make a voice, but it is not one man's job.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|