Quantcast
Channel: NAudio
Viewing all 5831 articles
Browse latest View live

New Post: Naudio wave from plot with time.

$
0
0
Hi ,

Am created simple music player using Naudio in C# winfrom application. In that i wave to display wave form with duration , plot wave from its working fine. but add timing also . So please help me to this.

Thanks in Advance.

New Post: PCM streaming with WASAPI

$
0
0
markheath wrote:
You seem to be trying to use a very low sample rate. WASAPI typically requires either 44.1kHz or 48kHz and IEEE float samples, so it's a little surprising that you get past Init successfully.

Playback will stop when BufferedWaveProvider returns 0 from Read, which shouldn't happen with a BufferedWaveProvider. So I would subscribe to the PlaybackStopped event of the WasapiOutRT and check the Exception property to see if there is a problem that is causing it to stop.
Hi Mark

Thanks for getting back to me. It seems that the Init method succeeds somewhat because the data in the BufferedWaveProvider ends up resampled. After I call the play method and the buffer is filled, the resamplerNeeded property becomes true (I can see that the outputFormat parameter contains 32-bit samples at 48 kHz). What's odd is that the audioClient object is null which makes me think something could be failing in the Activate() call. Regardless, I am able to get a sound played, albeit only for the duration of the latency parameter.

I took your advice and subscribed to the PlaybackStopped event. The exception thrown is an InvalidOperation exception that says "Timed out waiting for event." This is thrown immediately after calling play. Looking at the source, it seems that this comes from a windows API call (line 117 in WasapiOutRT.cs). Again, everything seems to be going fine because sound plays after this exception is thrown. Once the sound stops playing, the playback state is still set to "Playing" (likely because there's still plenty of data in the BufferedWaveProvider). Do you have any ideas on how to proceed at this point?

Thanks!

New Post: PCM streaming with WASAPI

$
0
0
not sure what's going on I'm afraid. The Win 10 WASAPI support in NAudio is still quite ropey. I've been looking at the new UWP AudioGraph API recently, which I suspect will be a much better option for most people on Win 10 moving forwards. Hopefully I'll find some time to create some demos of how to integrate it with NAudio.

New Post: Naudio wave from plot with time.

$
0
0
I'm afraid I don't have a sample of doing this that I can share, but essentially you're writing your own custom user control overriding paint and using the GDI wrappers in .NET to draw the time markers in the appropriate places.

New Post: Audio file locked by WaveViewer

$
0
0
you'd need to dispose the WaveStream that was passed to it. To be honest, the WaveViewer should really be moved to the samples part of NAudio as it was just a quick demo of how to do waveform rendering

New Post: Can NAudio do audio Quantization?

$
0
0
Can NAudio do quantization?

By quantization or audio sync I mean, that the audio waves will be "remaped" to match the time signature/tempo and not just to "move" the audio to start at another point in time.. the duration of the audio clip doesn't change, but its content does.

Quantization like all the "Digital Audio Workstation" programs have..

Thanks in advance for your help :)

New Post: Can NAudio do audio Quantization?

$
0
0
No, that's quite a complex algorithm I'm afraid and you'd need to write it yourself.

New Post: Can NAudio do audio Quantization?

$
0
0
Thanks for the quick response, I've tried looking for straight forward information about this, but couldn't find any, would you have any leads for me? :)

New Post: Can NAudio do audio Quantization?

$
0
0
A lot of the DAWs license the technology from elastique to do this. It's quite advanced DSP, so you'd need to be an expert to do this yourself

New Post: My program gets very slow to respond/stuck while fft is calculated

$
0
0
FFT calculation is CPU intensive, so performance can be an issue. There might be some performance optimisations available when adding to the sample aggregator. You could try running a profiler over it. Also consider running in release mode.

Commented Unassigned: AsioOut dispose() - keep signal [16500]

$
0
0
Hello,
I'm reading some wave files using AsioOut and a WaveMixerStream32. Everything works great but I noticed that sometimes (1 time on 5) when I close and start again my program, I have a loud signal playing in the output of my audiocard and I have to restart the app to delete the signal and come back to normal.

I'm thinking it's the asioOut which stays open or something like that.
When i close the app, I'm doing the following :
1. I remove all the input stream in my audio mixer and I stop the asioOut
_asioOut.Stop();

2. After 0.5s, I dispose all the mixer, the channels and asioOut and set them to null.

Am I doing something wrong here?
How can I get rid of the loud signal ?

(My audio card is a Komplete Audio 6 and it's compatible asio driver)

Thanks for your help !
Comments: I resolved the problem using a MultiplexingWaveProvider with silent sound on the output I don't want sound on.

Commented Unassigned: AsioOut dispose() - keep signal [16500]

$
0
0
Hello,
I'm reading some wave files using AsioOut and a WaveMixerStream32. Everything works great but I noticed that sometimes (1 time on 5) when I close and start again my program, I have a loud signal playing in the output of my audiocard and I have to restart the app to delete the signal and come back to normal.

I'm thinking it's the asioOut which stays open or something like that.
When i close the app, I'm doing the following :
1. I remove all the input stream in my audio mixer and I stop the asioOut
_asioOut.Stop();

2. After 0.5s, I dispose all the mixer, the channels and asioOut and set them to null.

Am I doing something wrong here?
How can I get rid of the loud signal ?

(My audio card is a Komplete Audio 6 and it's compatible asio driver)

Thanks for your help !
Comments: great, glad you found a solution

Closed Unassigned: AsioOut dispose() - keep signal [16500]

$
0
0
Hello,
I'm reading some wave files using AsioOut and a WaveMixerStream32. Everything works great but I noticed that sometimes (1 time on 5) when I close and start again my program, I have a loud signal playing in the output of my audiocard and I have to restart the app to delete the signal and come back to normal.

I'm thinking it's the asioOut which stays open or something like that.
When i close the app, I'm doing the following :
1. I remove all the input stream in my audio mixer and I stop the asioOut
_asioOut.Stop();

2. After 0.5s, I dispose all the mixer, the channels and asioOut and set them to null.

Am I doing something wrong here?
How can I get rid of the loud signal ?

(My audio card is a Komplete Audio 6 and it's compatible asio driver)

Thanks for your help !

Commented Unassigned: Clicking noise when concatenating/joining two or more WAV files [16492]

$
0
0
Hey folks,

I am working on a project where I need to join several WAV files. My Code works totally fine,
but you hear clearly a clicking noise between two joined WAV files. That is an huge issue.

I am an audio engineer. When I work, with e.g. consecutive samples in a DAW (Digital Audio Workstation) and I want to prevent this clicking noise between two WAV samples then I have to create a crossover fade (basically this is a fadeout on the first sample and a fade in on the next sample).

Therefore my question would be if I can create such a crossover fade while concatenating two WAV files.

I provide my C# code below how I concatenate WAV files. This works for WAV files which are in the same "format". I found this piece of Code on (http://stackoverflow.com/questions/6777340/how-to-join-2-or-more-wav-files-together-programatically).

Thank you for advice and a solution.

Best regards,
Alex

```
public static void Concatenate(string outputFile, IEnumerable<string> sourceFiles)
{
byte[] buffer = new byte[1024];
WaveFileWriter waveFileWriter = null;

try
{
foreach (string sourceFile in sourceFiles)
{
using (WaveFileReader reader = new WaveFileReader(sourceFile))
{
if (waveFileWriter == null)
{
// first time in create new Writer
waveFileWriter = new WaveFileWriter(outputFile, reader.WaveFormat);
}
else
{
if (!reader.WaveFormat.Equals(waveFileWriter.WaveFormat))
{
throw new InvalidOperationException("Can't concatenate WAV Files that don't share the same format");
}
}

int read;
while ((read = reader.Read(buffer, 0, buffer.Length)) > 0)
{
waveFileWriter.WriteData(buffer, 0, read);
}
}
}
}
finally
{
if (waveFileWriter != null)
{
waveFileWriter.Dispose();
}
}

}
```
Comments: There isn't an easy way to do this at the moment, but the `FadeInOutSampleProvider` could help here, or at least point you in the right direction

New Post: PCM streaming with WASAPI

$
0
0
Hi Mark

I decided to place the source code directly into my project so that I could debug easier. One thing that I've noticed is that my WaveProvider is being transformed into a SampleToWaveProvider due to the fact that resampling is needed. It seems that when this occurs, I lose the BufferedWaveProvider capability that I want. Is there an NAudio or WASAPI method that will resample a byte buffer for me so that WasapiOutRT won't replace the WaveProvider on initialization?

New Post: PCM streaming with WASAPI

$
0
0
WASAPI likes to play IEEE float so that's why internally it will turn it to a SampleProvider. The WdlResampler is entirely managed so it will work on any platform. Off the top of my head I can't remember whether I managed to get the Media Foundation resampler working on Win 10. I seem to remember I was calling some disallowed APIs to instantiate the MFT.

New Post: How to show the MIDI note name when the note is playing?

$
0
0
I want to update the label with the relevant MIDI note name when the MIDI file is playing. Please give me an idea to do this using NAudio or are there any examples for it?

New Post: My program gets very slow to respond/stuck while fft is calculated

$
0
0
Yeah. I move it to a background thread. Now it's working. Thanks Mark.

I have a small issue. I used both FFT and harmonic product spectrum (using FFT) to get fundamental frequency value of A4 note (440Hz) to see which one has the more accurate result. But they give results as ;

HPS : 443.3594 FFT: 441.2985Hz
HPS : 445.3125 FFT: 886.5023Hz
HPS : 443.3594 FFT: 888.455Hz
HPS : 441.4063 FFT: 443.2512Hz

I want to use HPS but can you suggest me a way to improve the frequency resolution?

New Post: My program gets very slow to respond/stuck while fft is calculated

New Post: How to show the MIDI note name when the note is playing?

$
0
0
what are you using to play the MIDI file?
Viewing all 5831 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>