Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Sound recording

TedTed Member Posts: 112
I need some help to learn how to record speech in VB 6.0, using a microphone, including saving the results as wave files. Can anyone please give me a hint?

Comments

  • MihailVDMihailVD Member Posts: 91
    Well...if I were you I would find a really big search engine like AltaVista.com, Yahoo.com, HotBot.com or Google.com and search for that kind of library.
    Well..enter one of these sites (I recommend HotBot) and type for example "Sound Recording Libraries for VB6" or something like that.
    Then tell me if you still need help.
    Mihail Dimitrov

  • phph Member Posts: 393
    : I need some help to learn how to record speech in VB 6.0, using a microphone, including saving the results as wave files. Can anyone please give me a hint?
    :

    I got this from vbsquare. i had to fix it up a bit, spelling errors and other prollems that wouldnt let it work.

    put this in a module :
    [code]
    Declare Function mciSendString Lib "winmm.dll" _
    Alias "mciSendStringA" _
    (ByVal lpstrCommand As String, _
    ByVal lpstrReturnString As String, _
    ByVal uReturnLength As Long, _
    ByVal hwndCallback As Long) As Long
    Declare Function mciGetErrorString Lib "winmm.dll" _
    Alias "mciGetErrorStringA" _
    (ByVal dwError As Long, _
    ByVal lpstrBuffer As String, _
    ByVal uLength As Long) As Long

    [/code]

    put this in the form with 2 command buttons, 1st button is record, second is playback :

    [code]

    Sub CloseSound()

    Dim Result&
    Dim errormsg%
    Dim ReturnString As String * 1024
    Dim ErrorString As String * 1024

    Result& = mciSendString("close mysound", ReturnString, 1024, 0)

    End Sub
    Sub RecordSound()
    'records sound aliased as mysound to memory for six seconds
    Dim Result&
    Dim errormsg%
    Dim ReturnString As String * 1024
    Dim ErrorString As String * 1024

    CloseSound

    Result& = mciSendString("open new type waveaudio alias mysound", ReturnString, 1024, 0)
    If Not Result& = 0 Then
    errormsg% = mciGetErrorString(Result&, ErrorString, 1024)
    MsgBox ErrorString, 0, "Error"
    Exit Sub
    End If

    Result& = mciSendString("set mysound time format ms bitspersample 8 samplespersec 11025", ReturnString, 1024, 0)
    If Not Result& = 0 Then
    errormsg% = mciGetErrorString(Result&, ErrorString, 1024)
    MsgBox ErrorString, 0, "Error"
    Exit Sub
    End If

    'Record for 60000 milliseconds
    Result& = mciSendString("record mysound to 60000", ReturnString, 1024, 0)
    If Not Result& = 0 Then
    errormsg% = mciGetErrorString(Result&, ErrorString, 1024)
    MsgBox ErrorString, 0, "Error"
    Exit Sub
    End If
    End Sub

    Sub PlayRecSound()
    'plays the recoreded sound aliased by mysound
    Dim Result&
    Dim errormsg%
    Dim ReturnString As String * 1024
    Dim ErrorString As String * 1024

    Result& = mciSendString("stop mysound", ReturnString, 1024, 0)
    If Not Result& = 0 Then
    errormsg% = mciGetErrorString(Result&, ErrorString, 1024)
    MsgBox ErrorString, 0, "Error"
    End If

    Result& = mciSendString("play mysound from 1 wait", ReturnString, 1024, 0)
    If Not Result& = 0 Then
    errormsg% = mciGetErrorString(Result&, ErrorString, 1024)
    MsgBox ErrorString, 0, "Error"
    End If

    End Sub




    Private Sub Command1_Click()
    RecordSound
    End Sub

    Private Sub Command2_Click()
    Call PlayRecSound
    End Sub

    Private Sub Form_Unload(Cancel As Integer)
    CloseSound
    End Sub
    [/code]

    as i said, it works, i tried it (in vb6). hope this is what u wanted
    [red]ph[/red][blue][/blue][red]t[/red]
    [red]http://fade.to/phet[/red]
    [blue]12d.hypermart.net[/blue]
    [red][email protected][/red]

  • Shawn CarterShawn Carter Member Posts: 0

    __ / http://forcoder.org / free ebooks and video tutorials about \ PL/SQL Assembly R C Objective-C PHP Visual Basic C++ Delphi Go Scratch C# Java Python JavaScript Visual Basic .NET Swift MATLAB Ruby Perl SAS Logo Fortran Lua Bash ABAP Hack Lisp Erlang Transact-SQL Rust D Alice Apex ML Dart Scheme Crystal Ada Prolog FoxPro Clojure Scala Julia Awk F# VBScript LabVIEW Kotlin COBOL \

Sign In or Register to comment.