0
Reply

audio recording problem in web based application with mciExecute() ( vb.net application)

kiranmayi

kiranmayi

Oct 26 2007 2:18 AM
5.4k

I am developing a web application in that I need to record audio, for that I am importing "winmm.dll" and using mciExecute function.(the following code is in vb.net). If I have posted in irrelavent forum please let me know where should I post questions related to audio and video (for web development).
<code>
Imports System.Runtime.InteropServices
Imports Microsoft.VisualBasic
Imports Microsoft.VisualBasic.Devices

Partial Class audioRec
    Inherits System.Web.UI.Page
    <DllImport("winmm.dll", EntryPoint:="mciExecute", CharSet:=CharSet.Ansi, SetLastError:=True, ExactSpelling:=True)> Private Shared Function mciExecute(ByVal lpstrCommand As String) As Boolean
    End Function

    Protected Sub BtnStart_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles BtnStart.Click
       
        mciExecute("open new Type waveaudio Alias recsound1")
        mciExecute("set recsound1 time format ms bitspersample 16 channels 1 samplespersec 11025")
        mciExecute("record recsound1")
   End Sub

    Protected Sub BtnStop_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles BtnStop.Click
        mciExecute("save recsound1 c:\\record.wav")
        mciExecute("close recsound1 ")
       
        Dim c As New Computer
        c.Audio.Stop()
    End Sub

    Protected Sub BTNplay_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles BTNplay.Click
        Dim computer As New Computer
        computer.Audio.Play("c:\\record.wav", AudioPlayMode.Background)
    End Sub
End Class
</code>
but when I am clicking the start button "the order in which you are passing parameters is invalid please correct the order" msg is getting displayed. I need to to record an audio file in "8khz, 16 bit, mono" format. How can I meet this requirement.

i will be thankful for ur suggestions..

with regards,
kiran