naudio

LameMP3FileWriter: Unsupported encoding format MuLaw Parameter name: format

回眸只為那壹抹淺笑 提交于 2019-12-25 03:33:24
问题 Trying to convert a 12 year old wav file to mp3, 8K, 8bit, Mono-channel, Mu-Law format, WAV and I am getting this error in LameMP3FileWriter line: LameMP3FileWriter: Unsupported encoding format MuLaw Parameter name: format static void Main(string[] args) { string wavFilePath = @"C:\temp\Message.wav"; string mp3FilePath = @"C:\temp\Message.mp3"; if (!File.Exists(mp3FilePath)) { byte[] bytearrwav = File.ReadAllBytes(wavFilePath); byte[] bytearrmp3 = ConvertWavToMp3(bytearrwav); File

AAC stream resampled incorrectly

折月煮酒 提交于 2019-12-25 03:05:32
问题 I do have a very particular problem, I wish I could find the answer to. I'm trying to read an AAC stream from an URL (online streaming radio e.g. live.noroc.tv:8000/radionoroc.aacp) with NAudio library and get IEEE 32 bit floating samples. Besides that I would like to resample the stream to a particular sample rate and channel count (rate 5512, mono). Below is the code which accomplishes that: int tenSecondsOfDownloadedAudio = 5512 * 10; float[] buffer = new float[tenSecondsOfDownloadedAudio]

implementing FftPitchDetector in C#

爷,独闯天下 提交于 2019-12-25 02:39:05
问题 I've added FftPitchDetector.cs into my project, but I'm not sure how to use it. My code: private void sourceStream_DataAvailable(object sender, NAudio.Wave.WaveInEventArgs e) { if (waveWriter == null) return; byte[] buffer = e.Buffer; float sample32 = 0; int bytesRecorded = e.BytesRecorded; float[] floats = new float[buffer.Length]; waveWriter.Write(buffer, 0, bytesRecorded); for (int index = 0; index < e.BytesRecorded; index += 2) { short sample = (short)((buffer[index + 1] << 8) | buffer

Howplay mp4 songs using NAudio

断了今生、忘了曾经 提交于 2019-12-25 02:16:39
问题 Can we play mp4 songs using NAudio? Please provide some code to play mp4 songs I need a c# code that will help me play mp4 songs 回答1: You can play .mp4 files using NAudio, there is a demo in the official page. Donwload the Demo-Apps and look for the "Media Foundation Demo". The C# code of the demo can be found at the Source Code of NAudio. Link to Demo-Apps Link to Source Code The implementation is in the WasapiOutGuiThread class: WasapiOutGuiThread : IWavePlayer 回答2: Update: NAudio can now

How to relate audio data to time

断了今生、忘了曾经 提交于 2019-12-24 22:24:15
问题 Lets say I would like to read 1 millisecond of sound data from an Mp3 file and present it. Something like this: var stream = NAudio.WaveStream.Mp3FileReader(filename); int intervalInMilliseconds = someInterval; int bytesPerInterval = ???; for(int i = 0; i < bytesPerInterval;i++) { Console.WriteLine(stream.GetByte()); } What do I need to do to solve for bytesPerInterval? Is this even possible to do accurately? (Note:NAudio is not a requirement here, just what I am currently using.) Or if I

Play audio to two different Audiodevices simultaneously with Naudio

久未见 提交于 2019-12-24 11:55:58
问题 I'm trying to figure out how to play music to two different audiodevices at the same time. What I've done is to create a class that makes life easier for me when programming with Naudio, it has play mp3 & wav's, pause, stop etc etc. What I'd love to have is the ability to chose what playback device the audiostream should be outputted to. Is there some way I can incorporate it like this: Play to: Realtek HD audio 2nd output and Speakers (if it was plugged in) Here's the "Play" function I

Possible to get the length of a WMA file without using Windows Media Player?

£可爱£侵袭症+ 提交于 2019-12-24 10:54:07
问题 I need to find a way to get the length of a WMA file without using any of the Windows Media Player(WMP) dlls. I found way to do it using WMP dlls, which you can see here, but due to another issue, I'd rather find a way where I don't have to use WMP. One promising method that use NAudio and works with MP3s can be seen below: double GetMediaDuration(string MediaFilename) { double duration = 0.0; using (FileStream fs = File.OpenRead(MediaFilename)) { Mp3Frame frame = Mp3Frame.LoadFromStream(fs);

Will NAudio support Mac OSX

痞子三分冷 提交于 2019-12-24 08:23:09
问题 Now I am trying to use NAudio to play .wav and .mp3 files in my application for Windows Operating system. Will this NAudio support Mac OS X? 回答1: NAudio contains a lot of interop wrappers for Windows functions. You are likely to be using WaveOut (which uses the Windows waveOut APIs) and WaveFormatConversionStream (which uses the Windows ACM APIs) if you are playing MP3 files with NAudio, so the answer is no, this won't work on MacOS, even if you use Mono. You would be better off finding a

unwanted silence parts in NAudio recording

為{幸葍}努か 提交于 2019-12-24 03:25:54
问题 I try to write an application that records the sound from the microphone and send it directly to the speakers. For testing I use a headset to avoid an acoustic feedback. I found this tutorial https://markheath.net/post/how-to-record-and-play-audio-at-same . Since I had a problem in my final application with this, I created a small test app to make sure that the cause of my problem isn't some side effect. I create a small test program with 2 buttons (start&stop) to test it. But for some reason

WaveOut versus WaveOutEvent

无人久伴 提交于 2019-12-24 03:08:24
问题 I'm using NAudio with WaveOutEvent Klangwiedergabegeraet; private void Play(string Dateiname) { Klangwiedergabegeraet = new WaveOutEvent(); Klangwiedergabegeraet.DeviceNumber = comboBox1.SelectedIndex; ISampleProvider StueckchenHalter = null; StueckchenHalter = CreateInputStreamS(Dateiname); Klangwiedergabegeraet.Init(new SampleToWaveProvider(StueckchenHalter)); Klangwiedergabegeraet.Play(); } private void Cancel() { if (Klangwiedergabegeraet != null) { Klangwiedergabegeraet.Stop();