ttt, anyone?
↧
New Post: Different lengths of the same file (in .wav and .mp3)
↧
New Post: Insert silence at start and add silence to end
Hi everyone, i wrote this funcions to do this.
private void InsertSilence(WaveFileWriter writer, Double milliseconds)
{
Double avgBytesPerMillisecond = (Double)writer.WaveFormat.AverageBytesPerSecond / 1000F;
Int32 silenceSize = (Int32)(milliseconds * avgBytesPerMillisecond);
silenceSize = silenceSize - silenceSize % fileIn.WaveFormat.BlockAlign;
Byte[] silenceArray = new Byte[silenceSize];
writer.Write(silenceArray, 0, silenceArray.Length);
}
↧
↧
New Post: Adding some silence to an MP3
Hi Matt,
I wrote a function to insert the silence in file.
I hope that it can help you.
I wrote a function to insert the silence in file.
I hope that it can help you.
private void InsertSilence(WaveFileWriter writer, Double milliseconds)
{
Double avgBytesPerMillisecond = (Double)writer.WaveFormat.AverageBytesPerSecond / 1000F;
Int32 silenceSize = (Int32)(milliseconds * avgBytesPerMillisecond);
silenceSize = silenceSize - silenceSize % fileIn.WaveFormat.BlockAlign;
Byte[] silenceArray = new Byte[silenceSize];
writer.Write(silenceArray, 0, silenceArray.Length);
}
↧
New Post: LoopStream with WaveProvider
Sorry. It has been quite a while, but now this problem is getting acute again (I'm refactoring some old code).
Here are some values from the read methode of the
Read is called with the parameters buffer.length=2048, offset=324, count=1886
when the IndexOutOfRange-Exception happens
sourceBytesRead = 3772
sourceBytesRequired = 3772
samplesRead = 1886
in the for loop: sample = 1734, destOffset = 1029
Here are some values from the read methode of the
StereoToMonoProvider16
:Read is called with the parameters buffer.length=2048, offset=324, count=1886
when the IndexOutOfRange-Exception happens
sourceBytesRead = 3772
sourceBytesRequired = 3772
samplesRead = 1886
in the for loop: sample = 1734, destOffset = 1029
↧
New Post: LoopStream with WaveProvider
well, actually I can just add the LoopStream right after the FileReader and THEN add the StereoToMono and the other things after that. I think thats the right way to do it ;)
Like this:
Like this:
switch (Path.GetExtension(filename))
{
case ".mp3":
_noiseStream = new Mp3FileReader(filename);
break;
case ".wav":
_noiseStream = new WaveFileReader(filename);
break;
}
_noiseLoopStream = new LoopStream(_noiseStream);
_noiseStereoToMono = new StereoToMonoProvider16(_noiseLoopStream) { LeftVolume = 1, RightVolume = 1 };
_noiseW16ToFloat = new Wave16ToFloatProvider(_noiseStereoToMono);
_noiseProviderToStream = new WaveProviderToWaveStream(_noiseW16ToFloat);
↧
↧
Created Unassigned: Midi In Octaves in NoteEvents [16474]
Any simple way to resolve the octave number returned by NoteName with what my Midi Controller says it's doing? My controller documentation says it's generating an E0 event, but NoteName returns an E1?
Do Midi vendors number their octaves differently?
Do Midi vendors number their octaves differently?
↧
New Post: Upgraded NAudio from v1.3.14 to v1.7.3 which crashes at _waveIn.StartRecording();
Hi
I just upgraded the NAudio by using the latest NuGet package. Previously used NAudio source code ([http://naudio.codeplex.com/SourceControl/changeset/6993618a0fba](fixed M:B:T calculation in Audio File Inspector for MIDI )). Now it just crashes my application.
Crashes at _waveIn.StartRecording() -> OpenWaveInDevice() -> MmResult result = callbackInfo.WaveInOpen(out waveInHandle, DeviceNumber, WaveFormat, callback);
Using default device number 0 but that did not make any difference.
Any idea what is going on?
I just upgraded the NAudio by using the latest NuGet package. Previously used NAudio source code ([http://naudio.codeplex.com/SourceControl/changeset/6993618a0fba](fixed M:B:T calculation in Audio File Inspector for MIDI )). Now it just crashes my application.
Crashes at _waveIn.StartRecording() -> OpenWaveInDevice() -> MmResult result = callbackInfo.WaveInOpen(out waveInHandle, DeviceNumber, WaveFormat, callback);
Using default device number 0 but that did not make any difference.
Any idea what is going on?
_waveIn = new WaveIn(_windowHandler);
// _waveIn.BufferMilliseconds = 50;
// _waveIn.DeviceNumber = capturingDeviceNumber;
// _waveIn.WaveFormat = _codec.RecordFormat;
_waveIn.DataAvailable += OnWaveInDataAvailable;
_waveIn.StartRecording();
private void OnWaveInDataAvailable(object sender, WaveInEventArgs e)
{
try
{
// Incomplete package - recording is stopping
if (e.BytesRecorded < e.Buffer.Length)
return;
byte[] encoded = _codec.Encode(e.Buffer, 0, e.BytesRecorded);
_udpSender.Send(encoded, encoded.Length);
}
catch (SocketException socketException)
{
// Ignore
}
catch (Exception exception)
{
//LogManager.Error(exception);
}
}
Thanks↧
New Post: Upgraded NAudio from v1.3.14 to v1.7.3 which crashes at _waveIn.StartRecording();
what is the value of _windowHandler? Try calling the default WaveIn constructor, and also try using WaveInEvent instead.
↧
Commented Unassigned: Midi In Octaves in NoteEvents [16474]
Any simple way to resolve the octave number returned by NoteName with what my Midi Controller says it's doing? My controller documentation says it's generating an E0 event, but NoteName returns an E1?
Do Midi vendors number their octaves differently?
Comments: yes, unfortunately there is not consistency about which exact note octave 0 starts from.
Do Midi vendors number their octaves differently?
Comments: yes, unfortunately there is not consistency about which exact note octave 0 starts from.
↧
↧
New Post: Upgraded NAudio from v1.3.14 to v1.7.3 which crashes at _waveIn.StartRecording();
I tried the default constructor but same things happens:
No error or exception, it will just stall there.
_waveIn = new WaveIn();
I replace WaveIn with WaveInEvent and same result. It will not go pass the StartRecording method.No error or exception, it will just stall there.
↧
New Post: Upgraded NAudio from v1.3.14 to v1.7.3 which crashes at _waveIn.StartRecording();
I created minimum WPF application which is using latest NuGet package. Start and stopping the recording is working without problems (sadly :D).
This means that the other application is driving the NAudio into such state that it cannot handle the Wave In Start Recording anymore. Somehow the older library worked in that environment. I do not know how to debug it further...
This means that the other application is driving the NAudio into such state that it cannot handle the Wave In Start Recording anymore. Somehow the older library worked in that environment. I do not know how to debug it further...
↧
Commented Unassigned: Midi In Octaves in NoteEvents [16474]
Any simple way to resolve the octave number returned by NoteName with what my Midi Controller says it's doing? My controller documentation says it's generating an E0 event, but NoteName returns an E1?
Do Midi vendors number their octaves differently?
Comments: That's what I thought. If you think it's useful you might consider adding an "octaveBase" method to set a device octave offset. Default of course would be 0 offset. Overall have found integration very smooth. Great resource!
Do Midi vendors number their octaves differently?
Comments: That's what I thought. If you think it's useful you might consider adding an "octaveBase" method to set a device octave offset. Default of course would be 0 offset. Overall have found integration very smooth. Great resource!
↧
Created Unassigned: Unable to open m4a/aac/wma files in Unity [16475]
I'm currently making a music game in Unity which requires me to load arbitrary music files at runtime. I've used NAudio successfully to support mp3s; however, m4a files (and anything else that uses MediaFoundationReader) causes NAudio to hang inexplicably.
This line of code causes the problem:
var audioFileReader = new AudioFileReader(fileName);
The strange thing is that this works fine in the NAudio demo. I tried porting the Demo code straight up to Unity, but the same code that works perfectly in the demo causes a hang inside Unity.
After some debugging, I tracked it down to this function:
protected virtual IMFSourceReader CreateReader(MediaFoundationReaderSettings settings)
{
IMFSourceReader reader;
MediaFoundationInterop.MFCreateSourceReaderFromURL(file, null, out reader);
__reader.SetStreamSelection(MediaFoundationInterop.MF_SOURCE_READER_ALL_STREAMS, false);__
That last line fails to execute, Unity freezes and never resumes.
A quick lookup on MSDN has this to say:
https://msdn.microsoft.com/en-us/library/windows/desktop/dd374655(v=vs.85).aspx
Minimum supported client
Windows 7, Windows Vista and Platform Update Supplement for Windows Vista [desktop apps | Windows Store apps]
I am running Windows 8. My current fear is that Unity's Mono implementation simply doesn't support this at all and I cannot use any Media Foundation classes.
Any insight would be strongly appreciated.
Repro steps:
1. Setup an empty Unity project (I'm using Unity 5, version shouldn't matter)
2. Import NAudio
3. Have a simple script that tries to load a .m4a file using NAudio
4. Unity hangs and crashes.
This line of code causes the problem:
var audioFileReader = new AudioFileReader(fileName);
The strange thing is that this works fine in the NAudio demo. I tried porting the Demo code straight up to Unity, but the same code that works perfectly in the demo causes a hang inside Unity.
After some debugging, I tracked it down to this function:
protected virtual IMFSourceReader CreateReader(MediaFoundationReaderSettings settings)
{
IMFSourceReader reader;
MediaFoundationInterop.MFCreateSourceReaderFromURL(file, null, out reader);
__reader.SetStreamSelection(MediaFoundationInterop.MF_SOURCE_READER_ALL_STREAMS, false);__
That last line fails to execute, Unity freezes and never resumes.
A quick lookup on MSDN has this to say:
https://msdn.microsoft.com/en-us/library/windows/desktop/dd374655(v=vs.85).aspx
Minimum supported client
Windows 7, Windows Vista and Platform Update Supplement for Windows Vista [desktop apps | Windows Store apps]
I am running Windows 8. My current fear is that Unity's Mono implementation simply doesn't support this at all and I cannot use any Media Foundation classes.
Any insight would be strongly appreciated.
Repro steps:
1. Setup an empty Unity project (I'm using Unity 5, version shouldn't matter)
2. Import NAudio
3. Have a simple script that tries to load a .m4a file using NAudio
4. Unity hangs and crashes.
↧
↧
Created Unassigned: NAudio.SoundFont.InfoChunk exception [16476]
NAudio.SoundFont.InfoChunk throws an unnecesary exception if some of the information chunks are missing even though they're optional, makes it harder to load some of the SF2 files.
↧
New Post: Resample from Wavestream to Wavestream, the managed way?
Hi,
I face the Problem, that I Need to resample a Wavestream für applying effects to it. I Carefully read this post: http://mark-dot-net.blogspot.de/2014/05/how-to-resample-audio-with-naudio.html, and to be sure that it is running on all Systems I Need the full managed way.
Unfortunately, WdlResamplingSampleProvider resamples to sampleprovider. Any ideas? I can post a short snippet to demonstrate if you want.
Thank you.
I face the Problem, that I Need to resample a Wavestream für applying effects to it. I Carefully read this post: http://mark-dot-net.blogspot.de/2014/05/how-to-resample-audio-with-naudio.html, and to be sure that it is running on all Systems I Need the full managed way.
Unfortunately, WdlResamplingSampleProvider resamples to sampleprovider. Any ideas? I can post a short snippet to demonstrate if you want.
Thank you.
↧
New Post: LoopStream with WaveProvider
Loopstream Needs a Wavestream as Input, because it uses the Position Property for Looping (which a sampleprovider doesn´t supply).
↧
New Post: Resample from Wavestream to Wavestream, the managed way?
why do you need a WaveStream? Try putting the resampler later in your signal chain
↧
↧
New Post: Same format - Mixing WAV channels
Hey guys,
I am mixing two WAV files, one has 32 BitsPerSample and the other one has 16 BitsPersSample. WaveMixerStream32 is giving me an error:
Can you help me how to ensure the same bps for both files?
I am mixing two WAV files, one has 32 BitsPerSample and the other one has 16 BitsPersSample. WaveMixerStream32 is giving me an error:
An unhandled exception of type 'System.ArgumentException' occurred in NAudio.dll
Additional information: All incoming channels must have the same format
I have one 32 WAV and one MP3 which I convert to WAV. The converted MP3to WAV has 16bps.Can you help me how to ensure the same bps for both files?
↧
New Post: Resample from Wavestream to Wavestream, the managed way?
I Need a Wavestream for my Effectstream that I borrowed from your Skype voice changer source. Putting it later, would be useless, as I couldn´t apply effects then.
↧
New Post: Same format - Mixing WAV channels
You can´t mix files with different wave Format directly.
Ensure the following:
1) Same Samplerate -> Resample with Mediafoundationresampler, WaveFormatConversionStream etc.
2) Same bit depth -> Use a Sampleprovider for your conversion, e.g. WaveToSampleProvider etc.
3) Same channel Count -> Use a Sampleprovider for your conversion, e.g. MonoToStereoSampleProvider etc.
4) Same Format tag (I think this is optional as it doesn´t affect the data directly)
Conclusion: Better work with sampleproviders for Mixing purpose. Hope this Points you in the right direction.
Ensure the following:
1) Same Samplerate -> Resample with Mediafoundationresampler, WaveFormatConversionStream etc.
2) Same bit depth -> Use a Sampleprovider for your conversion, e.g. WaveToSampleProvider etc.
3) Same channel Count -> Use a Sampleprovider for your conversion, e.g. MonoToStereoSampleProvider etc.
4) Same Format tag (I think this is optional as it doesn´t affect the data directly)
Conclusion: Better work with sampleproviders for Mixing purpose. Hope this Points you in the right direction.
↧