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

New Post: compress audio input

$
0
0
hi
i'm doing a project which concerns an audio chat, but not understand how to do some things:
I capture the audio through microphone with "wavein" into the buffer type "BufferedWaveProvider", but I need that the file is lightweight, because I should send it.
how i do it ??, how compress it ??
sorry for my english.
Dim inp As WaveIn
Dim sampleRate As integer = 8000
Dim channels As Integer = 1
Dim bitrate As Integer = 16
Dim wav As New WaveFormat(sampleRate,bitrate,channels)
Dim buffer As New BufferedWaveProvider(wav)

//here start recording
inp=New WaveIn()
inp.DeviceNumber=0
inp.WaveFormat = New WaveFormat(sampleRate,bitrate,channels)
AddHandler inp.DataAvailable, AddressOf upd
inp.StartRecording()

New Post: Netwok stream of loopback recording

New Post: FFT results

$
0
0
The WPF demo shows one way of visualising the output of an FFT. To understand what the output of an FFT means, I recommend you visit some maths/dsp sites. It can take a while to get your head round the subject, so it's worth spending some time on.

The aggregator returns maximum values after every 882 samples. This helps you draw a waveform with the desired number of points per second.

New Post: Which way is best for sampling both left and right channels?

$
0
0
yes, although quite often if I am drawing one waveform for a stereo signal I just cheat and draw one of the two channels.

New Post: Increase only low bit section of a song

$
0
0
Probably a low shelving filter would be what you want, allowing you to boost low frequencies. NAudio does not include one out of the box, so you'd need to find an algorithm and port it to C# as an implementation of ISampleProvider

New Post: How to get maximum DB value of a section in a mp3 song?

$
0
0
NAudio allows you access to the raw samples of an MP3 file using MP3FileReader. It is then up to you to decide what period of time you are going to measure peak signal values over. Having done that you can convert the maximum signal value to DB using the standard formula.

New Post: Naudio Playing problem

$
0
0
there is not enough information here for me to help. What output model are you using? When you say stuck, do you mean the audio stops playing?

New Post: compress audio input


New Post: Increase only low bit section of a song

$
0
0
i write the code on SimpleCompressorStream class.like that:

public override int Read(byte[] array, int offset, int count)
    {
        lock (this)
        {
            if (Enabled)
            {
                if (sourceBuffer == null || sourceBuffer.Length < count)
                    sourceBuffer = new byte[count];
                int sourceBytesRead = sourceStream.Read(sourceBuffer, 0, count);
                int sampleCount = sourceBytesRead / (bytesPerSample * channels);
                double right1 = Decibels.LinearToDecibels(Math.Abs(BitConverter.ToDouble(sourceBuffer, 0)));
                if (right1 < -450.0  )
                {
                    if (MakeUpGain < 20)
                        MakeUpGain += 1;
                }
                else if (right1 > -450.0 && right1 < -300.0)
                {
                    if (MakeUpGain < 10)
                    {
                        MakeUpGain += 1.0;
                    }
                    else
                    {
                        MakeUpGain -= 1.0;
                    }
                }
                else if (right1 > -300.0 )
                {
                    if (MakeUpGain < 1)
                    {
                        MakeUpGain += 1.0;
                    }
                    else
                    {
                        MakeUpGain -= 1.0;
                    }
                }
                else
                {
                    if (MakeUpGain != 1)
                    {
                        MakeUpGain -= 1.0;
                    }
                    else
                    {
                        MakeUpGain += 1.0;
                    }
                  //  MakeUpGain = -3;
                }
                //if (right1 > -850.0 && right1 < -440 && MakeUpGain < 8)
                //{
                //    for (int i = 0; i > right1; i++) 
                //    {

                //    }
                //}
                for (int sample = 0; sample < sampleCount; sample++)
                {
                    int start = sample * bytesPerSample * channels;
                    double in1;
                    double in2;

                    ReadSamples(sourceBuffer, start, out in1, out in2);
                    simpleCompressor.Process(ref in1, ref in2);
                    WriteSamples(array, offset + start, in1, in2);

                }
                return count;
            }
            else
            {
                return sourceStream.Read(array, offset, count);
            }
        }

    }
But problem is that when low bit instantly increase high bit then a noise arise. otherwise it will be worked.

New Post: Mixdown multiple WAVs to a single file - solved

$
0
0
Hi i used this code works fine but after mixdown two wav files i cant delete them i have IO error file is in use.

New Post: PlaybackStopped not called with MemoryStream

$
0
0
Trying to play an mp3 from a byte[], but OnPlaybackStopped is never called.

mNPlayer = new WaveOut();
MemoryStream ms = new MemoryStream(bytes);
WaveStream ws = new Mp3FileReader(ms);
ws = new WaveChannel32(ws);
WaveChannel32 wc32 = new WaveChannel32(ws);
wc32.PadWithZeroes = false;
mNPlayer.PlaybackStopped += OnPlaybackStopped;
mNPlayer.Init(wc32);
mNPlayer.Play();

New Post: PlaybackStopped not called with MemoryStream

$
0
0
Removed the

ws = new WaveChannel32(ws);

and it works now.

New Post: Mixdown multiple WAVs to a single file - solved

$
0
0
Solved :)
            foreach (WaveFileReader wave in inputs)
            {
                wave.Close();
            }

New Post: Mp3 volume tags? (MP3Gain volume normalization)

$
0
0
I've used MP3Gain to set all of my mp3s to 89db, but it sounds like it doesn't modify the mp3, but sets some kind of tag which NAudio doesn't appear to respect. Anyone know how to handle this?

New Post: Mp3 volume tags? (MP3Gain volume normalization)

$
0
0
I have no idea how MP3Gain works, but NAudio simply passes on the MP3 frames to the ACM decompressor that comes with Windows.

New Post: compress audio input

$
0
0
thanks for the reply.
I want a format suitable for speech coding, I thought a gsm or advise me.

I had already seen that article, but I do not understand how to compress the same, can you do me a simple example please?

it is possible to capture the audio already compressed, or do I have to catch it in pcm and then compress it?

New Post: Mp3 volume tags? (MP3Gain volume normalization)

$
0
0
Grass,

You are correct, MP3Gain uses ReplayGain, which is just a tag indicating how much to attenuate (or boost) the decoded audio to reach the specified average level. The spec explains it pretty well (it's just some math), and at the end you should have a linear scaling factor (multiply each sample by scaling_factor to get the correct volume level). Reading the ReplayGain tag is an exercise left to the reader (see the spec!).

The simplest way to support it is with a VolumeSampleProvider wrapper around the MP3 decoder. Set the volume to the calculated scaling factor for each track and everything should "just work".

New Post: Increase only low bit section of a song

$
0
0
anyone can help me.I want the code .pls help me.

New Post: compress audio input

$
0
0
You will have to capture the audio in uncompressed form. Afterwards you can use the WaveFormatConversionStream to apply compression on the captured steam.

I can recommend the use of Speex for compressing audio. On the website (http://speex.org/) you will find a download for the acm driver that is needed for the WaveFormatConversionStream.

New Post: compress audio input

$
0
0
ok, but I do not understand how to convert from "BufferedWaveProvider" to "WaveStream," how I do it?
Viewing all 5831 articles
Browse latest View live


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