Click here to Skip to main content
15,435,848 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
I'm facing a issue to sote the voice in my local db and folder please help me out in this i'm new for this plz help me plz

Can you give me the code to write in computer class

What I have tried:

C#
[DllImport("winmm.dll", EntryPoint = "mciSendStringA", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
    private static extern int mciSendString(string lpstrCommand, string lpstrReturnString, int uReturnLength, int hwndCallback);

 protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            Computer computer = new Computer();
            //computer.Audio.Play("c:\\Mere Bina.mp3", AudioPlayMode.WaitToComplete);
        }

    }

    protected void btnRecord_Click(object sender, EventArgs e)
    {
        // record from microphone
        mciSendString("open new Type waveaudio Alias recsound", "", 0, 0);
        mciSendString("record recsound", "", 0, 0);

    }

    protected void btnStop_Click(object sender, EventArgs e)
    {
        // stop and save
        mciSendString("save recsound E:\\Railways\\Sound\\record.wav", "", 0, 0);
        mciSendString("close recsound ", "", 0, 0);
        Computer c = new Computer();
        c.Audio.Stop();


        //mciSendString("save recsound E:\\Railways\\Sound\\record.wav", "", 0, 0);
        //DateTime.Now.ToString("yyyyMMddHHmmssfff") + ".wav", "" , 0, 0);
        //mciSendString("close recsound ", "", 0, 0);
        //Computer c = new Computer();
        //c.Audio.Stop();
    }

    protected void btnRead_Click(object sender, EventArgs e)
    {
        Computer computer = new Computer();
        computer.Audio.Play("E:\\Railways\\Sound\\record.wav", AudioPlayMode.Background);



    }

And also getting the error on AudioPlayMode Plz help me asap
Posted
Updated 21-Jul-22 22:41pm
v2
Comments
F-ES Sitecore 30-Jul-18 5:22am    
You won't get this code working, your aps.net code runs on the server, not the client, so it has no access to client hardware like microphones etc. It might seem to work on your local machine because the server and client are the same machine but when it is published it will stop working. You'll need to look for a client-based way of capturing audio using html5 maybe, or some kind of browser plug-in.
Member 10230348 30-Jul-18 5:25am    
can u please provide me link or code plz help me im new in this

1 solution

 
Share this answer
 
Comments
Member 10230348 30-Jul-18 5:33am    
and how to store in database and folder
Mehdi Gholam 30-Jul-18 5:38am    
You can't expect a solution for no work, that's the easy part and up to you.
Member 10230348 30-Jul-18 5:40am    
kk thank u sir
[no name] 21-Mar-19 8:14am    
Not Okay Sir
[no name] 22-Mar-19 2:32am    
Hai Brother This Code is Micro Phone Using But Not Database Save Properly on database

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900