WavReader 和 FlacWriter 需要什么 using 语句?
What using statement do I need for WavReader and FlacWriter?
到目前为止,我有这些使用语句:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Net;
using Newtonsoft.Json;
using System.Threading;
using NAudio.Wave;
using System.Diagnostics;
using System.Threading.Tasks;
using System.Runtime.InteropServices;
using Alvas.Audio;
我正在尝试编写一个 wav 到 flac 转换器。
这是函数:
public static void flac_converter()
{
string inputFile = Path.Combine("wav ", input);
string outputFile = Path.Combine("flac", Path.ChangeExtension(input, ".flac"));
if (!File.Exists(inputFile))
throw new ApplicationException("Input file " + inputFile + " cannot be found!");
WavReader wav = new WavReader(inputFile);
using (var flacStream = File.Create(outputFile))
{
FlacWriter flac = new FlacWriter(flacStream, wav.BitDepth, wav.Channels, wav.SampleRate);
// Buffer for 1 second's worth of audio data
byte[] buffer = new byte[wav.Bitrate / 8];
int bytesRead;
do
{
bytesRead = wav.InputStream.Read(buffer, 0, buffer.Length);
flac.Convert(buffer, 0, bytesRead);
} while (bytesRead > 0);
flac.Dispose();
flac = null;
}
}
但是我得到这个错误:"The Type of Namespace 'WavReader' cannot be found"
我也收到此错误:"The Type or Namespace 'FlacWriter' cannot be found"
我知道我必须做两件事,下载适当的库,然后将所有 DLL 文件添加到项目的引用中,并添加 "using blahBlah;"
但是,我不知道我需要什么 DLL,或者我需要什么 using 语句来消除这些错误。有人知道吗?
将 wavreader 的拼写改为 wavereader。它应该解决。
到目前为止,我有这些使用语句:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Net;
using Newtonsoft.Json;
using System.Threading;
using NAudio.Wave;
using System.Diagnostics;
using System.Threading.Tasks;
using System.Runtime.InteropServices;
using Alvas.Audio;
我正在尝试编写一个 wav 到 flac 转换器。 这是函数:
public static void flac_converter()
{
string inputFile = Path.Combine("wav ", input);
string outputFile = Path.Combine("flac", Path.ChangeExtension(input, ".flac"));
if (!File.Exists(inputFile))
throw new ApplicationException("Input file " + inputFile + " cannot be found!");
WavReader wav = new WavReader(inputFile);
using (var flacStream = File.Create(outputFile))
{
FlacWriter flac = new FlacWriter(flacStream, wav.BitDepth, wav.Channels, wav.SampleRate);
// Buffer for 1 second's worth of audio data
byte[] buffer = new byte[wav.Bitrate / 8];
int bytesRead;
do
{
bytesRead = wav.InputStream.Read(buffer, 0, buffer.Length);
flac.Convert(buffer, 0, bytesRead);
} while (bytesRead > 0);
flac.Dispose();
flac = null;
}
}
但是我得到这个错误:"The Type of Namespace 'WavReader' cannot be found" 我也收到此错误:"The Type or Namespace 'FlacWriter' cannot be found"
我知道我必须做两件事,下载适当的库,然后将所有 DLL 文件添加到项目的引用中,并添加 "using blahBlah;"
但是,我不知道我需要什么 DLL,或者我需要什么 using 语句来消除这些错误。有人知道吗?
将 wavreader 的拼写改为 wavereader。它应该解决。