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

New Post: compress audio input

$
0
0
A WaveProvider is a WaveStream that cannot be repositioned and whose length is unknown. So you would not normally convert, although if you wanted you could make an adapter class in which repositioning does nothing. I usually convert to PCM before putting audio into the BufferedWaveProvider. If you look at the source code in the NAudio network chat demo you'll see the Acm classes being called at a lower level to decompress the audio, eliminating the need to use WaveFormatConversionStream.

New Post: AcmNotPossible calling acmStreamOpen

$
0
0
Hi, I would like to play mp3 file using NAudio. I have tried to use MP3FileReader to open MP3 file stream. But after opening the file, it gave me the error of "AcmNotPossible calling acmStreamOpen".

This is my code to open the stream of MP3.
private WaveStream CreateInputStream(string fileName)
        {
            WaveChannel32 inputStream;
            if (fileName.EndsWith(".mp3"))
            {
                WaveStream mp3Reader = new Mp3FileReader(fileName);
                inputStream = new WaveChannel32(mp3Reader);
            }
            else
            {
                throw new InvalidOperationException("Unsupported extension");
            }
            volumeStream = inputStream;
            return volumeStream;
        }

New Post: AcmNotPossible calling acmStreamOpen

$
0
0
What OS are you using? There needs to be an ACM MP3 codec installed for this to work

New Post: Increase WasapiLoopbackCapture volume?

$
0
0
the volume of the sound that is captured by WasapiLoopbackCapture and rendered by WaveOut is lower than the actual sound (from speaker) How to increse that volume?

Thank you.

New Post: Stream from WaveIn

$
0
0
I'd like to get a Stream object from WaveIn, that can then be passed to stuff requiring a Stream.

WaveStream seems to implement this interface, but I can't find any subclass of WaveStream actually taking data from WaveIn or a WaveProfider.

How can I get a Stream from WaveIn? Does this exist already?

New Post: compress audio input

$
0
0
I saw the example of "network chat", but I have a problem ..
I capture the audio to pcm, and during the event "data_available" convert the bytes in GSM610 (for now), but:
Dim input As WaveFormat = WaveFormat.CreateCustomFormat (WaveFormatEncoding.Pcm, 8000,1,8000,1,8)
Dim output As WaveFormat = WaveFormat.CreateCustomFormat (WaveFormatEncoding.Gsm610, 8000,1,1625,65,0)
Dim encodeStream As AcmStream

//next in data_available
encodestream = New AcmStream (input, output)
I get the error "NAudio.MmException: AcmNotPossible calling acmStreamOpen"
But through the demo NAudio I saw that I installed the GSM610

Where I'm wrong?

New Post: microtuning

$
0
0
Has anyone used this library to send microtuning data out?

New Post: Increase WasapiLoopbackCapture volume?

$
0
0
Well the loopback capture should come in at the volume that was sent to the speaker. If it isn't loud enough on playback then you'd either have to boost the device volume level, or increase the sample values as they come through the audio pipeline.

New Post: Stream from WaveIn

$
0
0
you shouldn't really need a stream, just a WaveProvider, for which I suggest using BufferedWaveProvider. If you really must have a WaveStream, then I'd make an adapter class. Just make Position set do nothing, Lenght can return any value, and Position get can return the total number of bytes read so far

New Post: compress audio input

$
0
0
Your custom formats are probably not what the ACM codec is expecting. Use new Gms610WaveFormat for the outputFormat. For the inputFormat, it should be 16 bit PCM. so new WaveFormat(8000,16,1)

New Post: Echo produced when modifying tempo

$
0
0
I am using the Soundtouch engine to modify the tempo. When the tempo is modified to about 50%, the resulting audio produces an echo affect. It is more noticeable the lower you go.

Any suggestions on how to smooth out the audio, so there is no echo?

Paul

New Post: Stream from WaveIn

$
0
0
Well in this case I need to pass audio to another component that wants a Stream. I ended up writing my own code to fill in a stream that can be read asynchronously, but it seems like it might be a pretty common use case.

New Post: How to extract raw data from Byte Buffer and transform it into object

$
0
0
Hey all! I am currently participating in a project that involves Message Brokers, and one of the projects that use such is Simultaneous Audio and Video Streaming. In order for my audio data to be transferred and processed to the Messaging System, in which I am using ActiveMQ, It must be transformed to an object. The point in my code that performs this is here:

private void button2_Click(object sender, EventArgs e)
{
    stream = new NAudio.Wave.WaveIn();
    stream.DeviceNumber = 0;
    stream.WaveFormat = new NAudio.Wave.WaveFormat(44100, 1);
    stream.DataAvailable += new EventHandler<NAudio.Wave.WaveInEventArgs>(anyue);
    stream.StartRecording();
}

private void anyue(object sender, NAudio.Wave.WaveInEventArgs e)
{     
    e.buffer // How to extract raw audio data here?
}
My question is, how do you extract raw data from the buffer and transform it into an object? Thanks! Sample codes will be greatly helpful! I owe you a lot!

New Post: Get data from a playing wav file

$
0
0
Hello,
I need to get data from a playing wav file in order to encode them and send them to a voip server. I managed to do this while recording myself using the dataavailable callback.
void wi_DataAvailable(object sender, WaveInEventArgs e)
Can i do the same with a wav file?
Thank you :)

New Post: Create 16bit Wav with data section zeroed

$
0
0
Greetings,
First of all hats of the author of such an amazing library, thank you for sharing your hard work for all these years.

I'm trying to create a 16bit wav file that is X minutes long, and has zeros in the data section that I will later record to. Is that possible with CreateWaveFile16?
This is what I tried:
WaveFormat wform = new WaveFormat(pSampleRate, pBitsPerSample, 1);
IWaveProvider waveProvider = new NullWaveStream(wform, 248724044); // 47 minute sample
IWaveProvider wp2 = new Wave16ToFloatProvider(waveProvider);
ISampleProvider sp2 = new WaveToSampleProvider(wp2);
           WaveFileWriter.CreateWaveFile16(pFilename,sp2);
However I can't seem to record to the file later, it always plays back as just a very quick "clicking" noise less than a second long. I think I am doing something wrong when creating the file.

Any thoughts? and thanks again!

New Post: Get data from a playing wav file

$
0
0
I don't think you can do this with WaveIn() unless you are streaming from a device. You may be able to create a virtual device with DirectShow that plays back files, and then uses WaveIn() to intercept the virtual device.

Would it not work with your needs to read the bytes out of the wav file in to a stream and then send those bytes to your server?

New Post: How to extract raw data from Byte Buffer and transform it into object

$
0
0
Try the WaveIn event handler DataAvailable like this:
stream.DataAvailable += WaveIn_DataAvailable;

 private void WaveIn_DataAvailable(object sender, WaveInEventArgs e)
        {
// use WaveInEventArgs to access the buffer
// maybe use a MemoryStream
}

New Post: How to use NAudio with video file !

$
0
0
I can not open your solution in source code. Because it is in newer version. My version Visual is 2010.

What version of Visual did you use to do it ?

New Post: Get data from a playing wav file

$
0
0
Would it not work with your needs to read the bytes out of the wav file in to a stream and then send those bytes to your server?
Maybe, How can get the bytes from a wav file? I need to convert them to speex 8 or 16khz(or celt) before sending them so does it means i need the WaveFormat to be 8 or 16Khz? How can i do this?

Thank you :)

New Post: compress audio input

$
0
0
really thanks, now it works.
I preferred the GSM6.10 because it is lighter in terms of cpu.
I have another problem, how can I increase the volume of input devices?
for those in the output:
waveout.volume = 100
Viewing all 5831 articles
Browse latest View live


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