Results 1 to 16 of 16

Thread: Soundplaying problems!

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Apr 2006
    Location
    Sweden
    Posts
    173

    Unhappy Soundplaying problems!

    Hi folks!

    How do I play several sounds after eachother without any pauses?

    I've already tried building a playlist with the Windows Media Player component...but it doesn't work...I get pauses between the sound files

    Does anyone know how to do this?

    Plzd for help!

    //Alex
    Please Help Us To Save Ana

    You never fail before you stop trying!
    ______________________________
    If I manage to say something good...please reputate
    ______________________________
    ________

    Links:
    Intellithing
    Digitala.nu
    Norrköpings Goklubb
    WoW Trade Center

  2. #2
    Fanatic Member
    Join Date
    Aug 2005
    Location
    South Africa
    Posts
    760

    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)
    If I helped you out, please consider adding to my reputation!

    -- "The faulty interface lies between the chair and the keyboard" --

    VB6 Programs By Me:
    ** Dictionary, Thesaurus & Rhyme-Generator In One ** WMP Recent Files List Editor ** Pretty Impressive Clock ** Extract Firefox History **

  3. #3
    PowerPoster
    Join Date
    Feb 2002
    Location
    Canada, Toronto
    Posts
    5,803

    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.

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Apr 2006
    Location
    Sweden
    Posts
    173

    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?
    Please Help Us To Save Ana

    You never fail before you stop trying!
    ______________________________
    If I manage to say something good...please reputate
    ______________________________
    ________

    Links:
    Intellithing
    Digitala.nu
    Norrköpings Goklubb
    WoW Trade Center

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Apr 2006
    Location
    Sweden
    Posts
    173

    Re: Soundplaying problems!

    The main reason for why the pauses appear between the soundfiles using the WMP component is that it takes a second to open the soundfile and load it.

    Is there someway to maybe load the soundfile when the program starts so it's ready to play up the soundfiles at any time?

    It would be really good if anyone could help me with this!
    Please Help Us To Save Ana

    You never fail before you stop trying!
    ______________________________
    If I manage to say something good...please reputate
    ______________________________
    ________

    Links:
    Intellithing
    Digitala.nu
    Norrköpings Goklubb
    WoW Trade Center

  6. #6
    PowerPoster
    Join Date
    Feb 2002
    Location
    Canada, Toronto
    Posts
    5,803

    Re: Soundplaying problems!

    Can you specify what kind of sound files ?

  7. #7

    Thread Starter
    Addicted Member
    Join Date
    Apr 2006
    Location
    Sweden
    Posts
    173

    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 !
    Please Help Us To Save Ana

    You never fail before you stop trying!
    ______________________________
    If I manage to say something good...please reputate
    ______________________________
    ________

    Links:
    Intellithing
    Digitala.nu
    Norrköpings Goklubb
    WoW Trade Center

  8. #8

    Thread Starter
    Addicted Member
    Join Date
    Apr 2006
    Location
    Sweden
    Posts
    173

    Re: Soundplaying problems!

    If you don't have a solution for MP3 files...I can convert them to WAV files.
    Please Help Us To Save Ana

    You never fail before you stop trying!
    ______________________________
    If I manage to say something good...please reputate
    ______________________________
    ________

    Links:
    Intellithing
    Digitala.nu
    Norrköpings Goklubb
    WoW Trade Center

  9. #9
    PowerPoster
    Join Date
    Feb 2002
    Location
    Canada, Toronto
    Posts
    5,803

    Re: Soundplaying problems!

    Quote 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...

  10. #10

    Thread Starter
    Addicted Member
    Join Date
    Apr 2006
    Location
    Sweden
    Posts
    173

    Re: Soundplaying problems!

    okay..tnx, I'll check it out
    Please Help Us To Save Ana

    You never fail before you stop trying!
    ______________________________
    If I manage to say something good...please reputate
    ______________________________
    ________

    Links:
    Intellithing
    Digitala.nu
    Norrköpings Goklubb
    WoW Trade Center

  11. #11

    Thread Starter
    Addicted Member
    Join Date
    Apr 2006
    Location
    Sweden
    Posts
    173

    Question Re: Soundplaying problems!

    can't say I got much smarter of that...didn't understand a lot of that guitar-base thing...

    All I want to know is simply how to play serveral mp3 or wav files after eachother without any pause intervalls in between.

    Can anyone help me with this?
    Please Help Us To Save Ana

    You never fail before you stop trying!
    ______________________________
    If I manage to say something good...please reputate
    ______________________________
    ________

    Links:
    Intellithing
    Digitala.nu
    Norrköpings Goklubb
    WoW Trade Center

  12. #12
    PowerPoster
    Join Date
    May 2006
    Posts
    2,988

    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.

  13. #13
    PowerPoster
    Join Date
    Feb 2002
    Location
    Canada, Toronto
    Posts
    5,803

    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)

  14. #14
    PowerPoster
    Join Date
    Feb 2002
    Location
    Canada, Toronto
    Posts
    5,803

    Re: Soundplaying problems!

    Quote 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:
    1. Private DX As New DirectX8
    2. Private SEnum As DirectSoundEnum8
    3. Private DIS As DirectSound8
    4.  
    5. Private ABuff() As DirectSoundSecondaryBuffer8
    Loading the sounds:
    VB Code:
    1. Private Sub Form_Load()
    2.     Dim BuffDesc As DSBUFFERDESC
    3.     Dim K As Long    
    4.    
    5.     Set SEnum = DX.GetDSEnum
    6.     Set DIS = DX.DirectSoundCreate(SEnum.GetGuid(1))
    7.     DIS.SetCooperativeLevel Me.hWnd, DSSCL_NORMAL
    8.    
    9.     ReDim ABuff(25)
    10.     For K = 0 To 25
    11.         BuffDesc.lFlags = DSBCAPS_STATIC
    12.         FileName = App.Path & "\Wav\A-" & K & ".wav"
    13.         Set ABuff(K) = DIS.CreateSoundBufferFromFile(FileName, BuffDesc)
    14.     Next K
    Playing the sounds:
    VB Code:
    1. ABuff(Sound_Index).Play DSBPLAY_DEFAULT

  15. #15

    Thread Starter
    Addicted Member
    Join Date
    Apr 2006
    Location
    Sweden
    Posts
    173

    Re: Soundplaying problems!

    tnx, I'll try it when I have time
    Please Help Us To Save Ana

    You never fail before you stop trying!
    ______________________________
    If I manage to say something good...please reputate
    ______________________________
    ________

    Links:
    Intellithing
    Digitala.nu
    Norrköpings Goklubb
    WoW Trade Center

  16. #16
    PoorPoster iPrank's Avatar
    Join Date
    Oct 2005
    Location
    In a black hole
    Posts
    2,729

    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.
    Usefull VBF Threads/Posts I Found . My flickr page .
    "I love being married. It's so great to find that one special person you want to annoy for the rest of your life." - Rita Rudner


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width