Click here to Skip to main content
15,885,847 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
i want exactly a program like "How to play and record sounds[^]". but in c#.thank you for your help :)
Posted

If you don't want to dig deeper in the API, you can use NAudio[^]. Here is a demonstration of what you want: https://voicerecorder.codeplex.com/[^]
 
Share this answer
 
Comments
[no name] 10-Oct-15 9:35am    
+5 for the faster ;)
Zoltán Zörgő 10-Oct-15 9:35am    
thanks :)
Oğuzhan Kalsın 10-Oct-15 13:21pm    
NAudio is much more complicated then what i want.and i need c# codes
Zoltán Zörgő 10-Oct-15 15:05pm    
NAudio is complicated??? Wait to see the API...
Oğuzhan Kalsın 10-Oct-15 15:20pm    
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;



namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
[DllImport("winmm.dll", EntryPoint = "mciSendStringA", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
private static extern int record(string lpstrCommand, string lpstrReturnString, int uReturnLength, int hwndCallback);
public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
record("open new Type waveaudio Alias recsound", "", 0, 0);
record("record recsound", "", 0, 0);
}

private void button2_Click(object sender, EventArgs e)
{
record("save recsound C:\\Users\\oguzhan\\Desktop\\ddd.wav", "", 0, 0);
record("close recsound", "", 0, 0);
axWindowsMediaPlayer1.URL = "C:\\Users\\oguzhan\\Desktop\\ddd.wav";
axWindowsMediaPlayer1.Ctlcontrols.play();

}
}
}
this is my code but it cant record my voice second time.i have to close it and open it again for recording new voice.
You allready answered your question... why do you not following your link?

There are a lot of examples in WWW and also at CP. One I can suggest is:Practical Sound Recorder with Sound Activation[^]
 
Share this answer
 
Comments
Oğuzhan Kalsın 10-Oct-15 13:15pm    
i want it in c#.
[no name] 10-Oct-15 13:51pm    
And what you found in the link? Is it not c#?
Oğuzhan Kalsın 10-Oct-15 14:29pm    
i mean u first said why do you not following your link but that one is not c#
I would recomend using CSCore rather than NAudio. I used NAudio for a while, I got many issues when using it.

You can find it on github: [^]
Here's a sample of audio recording (using CSCore including graph visualization):
[^]

Good Luck - CCB
 
Share this answer
 
v2

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