Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

force playsound code to play the full length of sound

Status
Not open for further replies.

Tessadear

Technical User
Mar 7, 2006
26
BB
I used Audacity to record the sound, placed the code into a module and called the code from a command button. My problem is that when I click on the command button the sound plays but stops before the sound is finished. The sound file which is a wav file plays through to the end if I just click on it and play from windows media player.

Is there code I can use to make the sound play to the end using the command button to call the sound. Plays ok by just running the wav file from storage eg. desktop. But when I call the code from the command button the sound ends halfway.
 
How are ya Tessadear . . .

Don't know about [blue] Audacity[/blue] but windows [blue]Sound Recorder[/blue] plays-back well, responds well, is very light on resources and comes with every version of windows. If I need to play a [blue].wav[/blue] file I use the following:
Code:
[blue]Public Sub PlayWav(usrFile As String)
   Dim SndRec As String, FullPath As String
   Dim DQ As String, rtn
   
   DQ = """"
   SndRec = "c:\windows\sndrec32.exe" [green][b]'Your path to Sound Recorder[/b][/green]
   FullPath = DQ & SndRec & DQ & " " & DQ & usrFile & DQ & " -play -close"
   
On Error GoTo GotErr
   rtn = Shell(FullPath, vbMinimizedNoFocus)
   Exit Sub
   
GotErr:
    MsgBox Err.Description

End Sub[/blue]
Just call the routine with full drive/path/filename spec:
Code:
[blue]   Call PlayWav("Drive:\Path . . . \YourFileName.wav")[/blue]
If its still cutoff using sound recorder then I'd have to say your recording is cutoff . . .

[blue]Let me know how ya make out! . . .[/blue]

Calvin.gif
See Ya! . . . . . .
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top