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

New Post: Fading to to 50%

$
0
0

The FadeInOutSampleProvider is close to what you want but not exactly right. You could copy the source code and modify it to fade to just 50%. I guess a configurable fade-out value would be a good additional feature for this class.


New Post: Fading to to 50%

New Post: Volume Meter

$
0
0

This means you have no ACM codec installed on your computer that can perform the requested conversion. You need to tell me what WaveFormat you are using (the most important thing is the Encoding).

For a detailed explanation, please read my article on CodeProject:

http://www.codeproject.com/Articles/501521/How-to-convert-between-most-audio-formats-in-NET

Mark

New Post: Need a function urgently

$
0
0

Is there a way to get a sound card to perform it's own mixdown? Or is mixdown always performed on the PC?

New Post: Need a function urgently

$
0
0

some types of output model (e.g. WaveOut) let you open the same device multiple times, and so Windows performs the mixing. But with ASIO, you can only open the device once and must mix yourself.

It also depends if you need perfect syncrhonization. If you opened the soundcard twice, you'd have troubles keeping the two playback streams exactly in sync.

New Comment on "Convert a MP3 to WAV"

$
0
0
@D1mex: This is a partial class of a WinForms form. It is assumed that you have a form that contains a Label called txtLocation, a Button called cmbOpen and Button called cmbConvert. The Click events of those buttons are linked to cmbOpen_Click and cmbConvert_Click respectively.

New Post: Modifying the audio rendering speed (?)

$
0
0

Greetings,

    I'm studying this project, and I've read any your response into other discussion about BPM... but I'd like to know if it's possible to increase or decrease the audio rendering speed.

If at the moment isn't possible, are there any future develops about that?

Thank you

New Post: Fading to to 50%

$
0
0

Hi,

Thanks for pointing me in the right direction, I ended up rewriting the FadeInOutSampleProvider, fading down to 50% could be done changing the mupliplier and fading up in the middle of the track by adding a few more states and checking the total time converted to samples.

Fading down: 1.0F - 0.5F * (fadeSamplePosition / CSng(fadeSampleCount))

Fading up:  0.5F + 0.5F * (fadeSamplePosition / CSng(fadeSampleCount))

Though I have a problem knowing how to get the result into the mixer.

Dim wave_song As WaveStream = New AudioFileReader("c:\samples\song.mp3")Dim song_isample As ISampleProvider = New WaveToSampleProvider(wave_song)Dim fader As myFadeInOutSampleProvider
fader = New myFadeInOutSampleProvider(song_isample)
fader.setfade(5000, 20000) Dim waveprovider As SampleToWaveProvider = New SampleToWaveProvider(fader)Dim mixer As WaveMixerStream32
mixer = New WaveMixerStream32()' Doesnt work
mixer.AddInputStream(waveprovider)
mixer.AddInputStream(wave2) ' From above snippet' Works
WaveFileWriter.CreateWaveFile("c:\samples\test2.wav", waveprovider)

 

How can I convert back to a wavestream from my fader Isampleprovider so i can put it in the mixer.

Karl

 


New Post: Fading to to 50%

$
0
0

use MixingSampleProvider instead of WaveMixerStream32. Then use sampleToWaveProvider at the very end (probably you want SampleToWaveProvider16).

New Post: AcmStreamHeader dispose was not called

New Post: NAudio can't play some mp3 streaming

Commented Issue: Playing Short Audio Files [16377]

$
0
0
I'm writing a game and I'd like to use NAudio to add sound to it. I followed a few examples and was rather pleased with NAudio's API and performance.

I ran into the following issue: NAudio will not play short audio files. I've used WaveChannel32.Length to get the following numbers.
Files with length 755712 or less will not play.
Files with length 5935104 do play.
I'm not sure where the exact limit is. There are no exceptions thrown. I was hoping to use NAudio to play files of about 1 second long. Is anyone else having this issue? Is there a fix? Do I need to find a different library?
Comments: what output driver are you using? I wonder if it reaches the end of the input stream before it finishes filling the initial buffer. A quick workaround would be to make an IWaveProvider that puts a bit of trailing silence on the end.

New Post: Modifying the audio rendering speed (?)

$
0
0

Not really. One trick is to use a Resampler to adjust the sample rate, but a pitch shift will also occur at the same time.

Mark

New Post: How to uniquely identify audio capture device?

$
0
0

Hello everyone,

I observed that using NAudio.CoreAudioApi.MMDevice.ID property we can uniquely identify the audio capture device. But I cannot create an instance of WaveIn using MMDevice. The only way to associate WaveIn object with the audio capture device is its device index. But device index may change if we plug/unplug audio capture device.

Using MMDevice we can create an instance of WasapiCapture and capture audio from it but is not supported on XP.

I want to preserve the selected audio device ID somewhere (like database) so that my application can capture audio from that device when it launches for the next time. Is there any solution?

Thanks.

New Post: How to uniquely identify audio capture device?

$
0
0

hello,

Saving the driver name.Recall of the application or driver do a search type:


// Save CurrentDriverName
string CurrentDriverName = WaveIn.GetCapabilities(Convert.ToInt16(idCurrent)).ProductName

privateint SearchByName(string drivername)
{
	for (int id = 0; id < WaveIn.DeviceCount; id++)
	{
		if (drivername == WaveIn.GetCapabilities(Convert.ToInt16(id)).ProductName)
	        return id;
	}

	return -1; // erreur 
}

New Post: How to uniquely identify audio capture device?

$
0
0

May be that Mark can add this type of feature in WaveIn, WaveOut, ...

New Post: How to uniquely identify audio capture device?

$
0
0

Hi Manu,

Thanks for your reply. I thought of using ProductName but I doubt that it may give incorrect result if two or more devices have same name. Is it possible that two devices can have same name? I am going to try plugging two web cams (of exactly same model) if those become available for me. I'll post my observation later...

New Post: How to uniquely identify audio capture device?

$
0
0

The WaveIn/WaveOut APIs are particularly poor for this and may not be able to tell the difference between two instances of the same soundcard. I'd remember the name and the device id, and so if the device with the same id still has the same name, you can assume that things haven't changed since the last run of the program.

New Post: How to uniquely identify audio capture device?

$
0
0

I found one more problem for me! Actually I am going to record the captured video and audio in a WMV file. For which I need to know few properties of the audio format like bits per sample, sample rate, etc.. I am getting these properties using MMDevice.AudioClient.MixFormat but again this will not work on XP! What could be the solution?

Thanks.

New Post: How to uniquely identify audio capture device?

$
0
0

Normally, "productName" is increment of "(1) .. (2)." but this is not guaranteed.

It's like MIDI interfaces.

I had a computer with twice the same "ProductName" (microphone) of two different manufacturers, so I added the property ManufacturerID for ProductId and distinguished.

Viewing all 5831 articles
Browse latest View live


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