关于 windows phone 7 中的语音(音频)录制,我面临以下问题。
我正在使用 Microsoft.Xna.Framework.Audio 命名空间中可用的 Microphone 类录制声音。这是代码 -
变量声明:
private Microphone mic = Microphone.Default;
private MemoryStream stream;
private const string FILE_NAME = "recording.mp3";
byte[] buffer;
录制按钮点击代码-
mic.BufferDuration = TimeSpan.FromSeconds(1);
buffer = new byte[mic.GetSampleSizeInBytes(mic.BufferDuration)];
// Create the event handler. I could have done an anonymous
// delegate here if I had so desired.
mic.BufferReady += new EventHandler<EventArgs>(mic_BufferReady);
stream = new MemoryStream();
mic.Start();
缓冲区就绪事件代码 ----------
void mic_BufferReady(object sender, EventArgs e)
{
mic.GetData(buffer);
// Write buffer to stream
stream.Write(buffer, 0, buffer.Length);
}
按钮停止代码 -
private void btnStop_Click(object sender, RoutedEventArgs e)
{
dt.Stop();
btnStop.IsEnabled = false;
btnPlayRecording.IsEnabled = true;
mic.Stop();
//Writing stream into Storage
writeFile(stream);
}
private void writeFile(MemoryStream s, string name)
{
try
{
using (var userStore = IsolatedStorageFile.GetUserStoreForApplication())
{
if (userStore.FileExists(name))
{
userStore.DeleteFile(name);
}
using (var file = userStore.OpenFile(name, FileMode.CreateNew))
{
s.WriteTo(file);
}
}
}
catch (Exception ee)
{
}
}
一旦我将流保存到隔离存储并播放它,音量非常低,质量也不好。
所以
- 我们可以放大音量吗?
- 我们可以提高比特率吗?
- 我们可以做 Fadin-Fadout 吗?
如果这三个在 windows phone 7 中都不可能,那么是否有任何第三方 API 可用于执行所有这些操作?
提前致谢