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

New Post: simple example to control volume using NAudio

$
0
0
First, AudioFileReader already has a Volume property, so no need for an additional VolumeSampleProvider.
Second, I recommend WaveOutEvent instead of WaveOut when working on non GUI threads.

New Post: VolumeSampeProvider and Wave volume

$
0
0
The volumesampleprovider is actually adjusting the value of the samples being sent to the soundcard, whilst waveOutSetVolume is adjusting whatever volume control your soundcard provider offers. For many pro audio soundcards, you don't adjust a volume on the device, you simply control the level of the samples you send to it/

New Post: Recording trouble

$
0
0
Are you driving the input to clipping? a 15 bit range is just -6bB off full scale. I wouldn't worry about this at all.
Also, your numbers for 8 bit don't make any sense, as each sample will be 1 byte, and therefore cannot have a value greater than 256

New Post: Capture stream to memory and play

$
0
0
Yes, you can output the Microsoft speech synthesizer to a MemoryStream. Flush it, but don't dispose it when it's done. Then you can simply set the Position of that MemoryStream back to 0, and pass it into a WaveFileReader.

New Post: Play from Line-In?

$
0
0
Yes, you can capture with WaveInEvent, write the audio to a BufferedWaveProvider, pass that through any effects you have, and play it out of a WaveOutEvent

New Post: Preparing audio for using HTML 5 audio element

$
0
0
Great, thanks for sharing your findings. I'm afraid I haven't done any really low latency encoding myself with those codecs. You'd probably need a lower-level library so you could encode in smaller chunks.

New Post: Seting WaveOut buffersize directly to a number of samples

$
0
0
Well if you need exact control of the buffer sizes, then I suggest working with ASIO, which is much easier to control.

New Post: simple example to control volume using NAudio

$
0
0
Thank you for the quick response - I have a lot to learn. So I eliminated the VolumeSampleProvider and seem to have the same results by setting the volume of the AudioFileReader with less complexity. Also, I have changed to WaveOutEvent and the problem with the background thread also seems to have been solved.

Thanks so much for the help.

New Post: WinRT playback recorded microphone audio

New Post: Wrong filterCount for WdlResamplingSampleProvider?

$
0
0
The WdlResamplingSampleProvider is created with const filterCount = 2.

Since one filter has a filterorder of 2, it produces a transferfunction of order 2x2 = 4.
I have rebuild the filter in Matlab and the bodeplot would look like this:

https://www.dropbox.com/s/dzxahfr5h5sqof1/BodeFilt2x2.jpg?dl=0

Fs = 44100 Hz
FsDown = 14700 Hz

I think the filterorder is to slow. For example if you have a quantization of 16 bit, then a good antialiasing-filter should have an attenuation of 6.02 * N_QuantBit = 96dB.

To get this 96 dB, the correct filterCount would be 12.
This would look like this:

https://www.dropbox.com/s/tt0qln2lpe1v6sq/BodeFilt12x2.jpg?dl=0

I would suggest to calculate the dynamic filterCount in the constructor:

int filterCount = (int) Math.Floor(6.02*source.WaveFormat.BitsPerSample/8)/2;
resampler.SetMode(true, filterCount, false);

So do I missed something or what is your opinion?

New Post: Wrong filterCount for WdlResamplingSampleProvider?

$
0
0
The NAudio code is a straightforward port of the original C++ code from the WDL library, used with permission. If you have questions about the implementation, I suggest you ask them over at the WDL forums on the cockos site.

New Post: Wrong filterCount for WdlResamplingSampleProvider?

$
0
0
markheath wrote:
The NAudio code is a straightforward port of the original C++ code from the WDL library, used with permission. If you have questions about the implementation, I suggest you ask them over at the WDL forums on the cockos site.
Yeah I know, they helped me out with some information about the filters.

But the filterCount is set by WdlResamplingSampleProvider and not the WDLResampler itself. So I thought it's kinda NAudio-thing. Anyway, I thought it would be interesting for you to know.

New Post: Wrong filterCount for WdlResamplingSampleProvider?

$
0
0
OK, thanks. I'll try to take another look at this.

New Post: EncodeToAAC

$
0
0
Everytime I try to encode to AAC using MediaFoundationEncoder from a bufferdwaveprovider I get the following error.
The request is invalid because Shutdown() has been called. (Exception from HRESULT: 0xC00D3E85)

Any idea what could be causing this?

Thanks,
Dan

New Post: How to get what is playing from speakers

$
0
0
Hi, I just want to get what my speakers is playing and record it. For example, i am playing music from browser. May anybody help me?

New Post: How to get what is playing from speakers

$
0
0
WasapiLoopbackCapture is what you are looking for. Available since win win xp/vista if i remember correctly.

New Post: Capture stream to memory and play

$
0
0
Mark,

In general I know what should be done but I can't make it working. Any link to working example would be appreciated.

New Post: Adjust wav file amplitude and frequency

$
0
0
Hello,

I am working on a project where I am simulating the ground run of a jet engine. For this, I'm playing various sounds using NAudio and they all work fine. My problem is that when the engine is running and I adjust the throttle position I need to also adjust the amplitude and frequency of the EngineRunning sound. Is there a way to do this in NAudio? Failing that, is there a simple way to adjust the sound volume while it's playing? I had a quick look into using WaveChannel32 and adjusting the volume through that but I couldn't seem to get it to work. I am currently playing sounds using WaveOut and LoopStream as I need the sounds to keep playing until I change something in the simulation:
WaveFileReader mAudio = new WaveFileReader(mMap.GetFile(soundName));
LoopStream loop = new LoopStream(mAudio);
WaveOut mPlayer = new WaveOut(WaveCallbackInfo.FunctionCallback());
mPlayer.Init(loop);
mPlayer.Play();
Any help would be greatly appreciated.

Martin

New Post: Adjust wav file amplitude and frequency

$
0
0
A few bits of advice, first use WaveOutEvent instead of function callbacks which are prone to deadlocks. Second, you could use AudioFileReader which would give you a nice simple way to set the Volume. Note that the volume is not modified per sample, but per block of samples sent to the soundcard, so if you wanted to do gradual fades, it wouldn't be ideal. For that you'd want to create your own custom ISampleProvider.
You can also adjust the volume on the WaveOut / WaveOutEvent directly.

New Post: Adjust wav file amplitude and frequency

$
0
0
Hey Mark,

Thanks for the quick response.

I've adjusted my code per your advice and it successfully plays at half volume:
AudioFileReader mAudio = new AudioFileReader(mMap.GetFile(soundName));
mAudio.Volume = 0.5f;
LoopStream loop = new LoopStream(mAudio);
WaveOutEvent mPlayer = new WaveOutEvent();
mPlayer.Init(loop);
mPlayer.Play();
Just to clarify, is there any way to adjust the wav file amplitude or frequency? My volume solution works but I think that being able to adjust these values according to the movement of the throttle would give me a more representative application.

Thanks,

Martin
Viewing all 5831 articles
Browse latest View live


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