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

New Post: Trouble With Speed Optimization. Any Advice?

$
0
0
Thank you for replying! It seems if I don't resample then nothing works. The line containing wasapiOut.Init(bufferedWaveProvider); throws the following exception if a waveformat of 16bit PCM, 8kHz, 1 channels is passed in. I've included all the code in a zipped dropbox link. Please let me know what I'm doing wrong. I'm coupling the Exacq audio API with the NAudio API. If you need any other information let me know. Do you have a paypal? I'll donate to get this to work.

{System.NotSupportedException: Can't find a supported format to use
at NAudio.Wave.WasapiOut.Init(IWaveProvider waveProvider) in c:\GDIT\Source Code\C#\Kinect Mirror Training\Audio\NAudio\Wave\WaveOutputs\WasapiOut.cs:line 326
at MiddleTier.Audio.AudioPlayer_PcmRaw.<>c__DisplayClass2.<Start>b__0() in c:\GDIT\Source Code\C#\Kinect Mirror Training\MiddleTier.Audio\AudioPlayer_PcmRaw.cs:line 165}

https://www.dropbox.com/s/2khjqx9syg7t22g/ForMarkHeath.zip?dl=0

New Post: Decoding *.spx files for playback

$
0
0
Another interesting project I found on the web that could help you with the MediaFoundation translation:

Link

New Post: DSP SimpleCompressor to WaveStream

$
0
0
Hi,
I am newbie in NAudio library. I want to add simplecompressor and other DSP plugins to WaveStream. After that with WaveOut i want to play the WaveStream.
So far i just was able to apply an eq.
Hope some one will help me and provide me a code for my problem.

Thanks

New Post: Using MP3 from project resources

$
0
0
I have made a small little software as practice, where I used .wav files at first. They were way to big and using mp3 would shrink the files by up to 80%. Now, using the code displayed on the FAQ worked fine;
            IWavePlayer waveOutDevice;
            AudioFileReader audioFileReader;
            waveOutDevice = new WaveOut();
            audioFileReader = new AudioFileReader("test.mp3");
            waveOutDevice.Init(audioFileReader);
            waveOutDevice.Play();
However, changing the audioFileReader to;
            audioFileReader = new AudioFileReader(Properties.Resources.test);
would give an exception saying it cannot convert System.IO.UnmanagedMemoryStream to a string.
So I went on Google and found some examples, which I could not get working and currently I have in my project this:
private void clickButton(object sender, RoutedEventArgs e)
        {
            var song = Properties.Resources.test;
            WaveOut = new WaveOut();
            StreamResourceInfo resource = Application.GetResourceStream(new Uri("test.mp3", UriKind.Relative));
            WaveStream MainOutputStream = CreateInputStream(resource.Stream);

        }
        public WaveStream CreateInputStream(byte[] resource)
        {
            WaveChannel32 inputStream;

            using (MemoryStream ms = new MemoryStream(resource))
            {
                WaveStream mp3Reader = new Mp3FileReader(ms);
                inputStream = new WaveChannel32(mp3Reader);
            }

            return inputStream;
        }
It did not work if I replaced test.mp3 with either the var "song", or the Properties.Resources.test.
It gives an exception on this line where it says resource.Stream cannot be converted from IO.Stream to Byte array.
WaveStream MainOutputStream = CreateInputStream(resource.Stream);
How would I go on solving this? I would very much prefer having the files inside the exe file for portability instead of having folders required.

New Post: I need, only graph for .wav file.

$
0
0
I am new in NAudio. I am doing this first time, I am not getting for to retrieve only graph for a given .wav file, give me some direction so i can do it easy.

please help me out..

thank

New Post: Audio in and sound analysis

$
0
0
Hi,
for a personal project, I would like to know if I could use Naudio to analyse real time audio arriving from "Audio In", and do real time analysis (sound output level, other kind of analysis).
can we do such real time analysis ?
thanks !

New Post: I need, only graph for .wav file.

$
0
0
i need only Audio graph on inputing .wav file.
Any one know please guide me or sent that code

Created Unassigned: Not getting running audio wave in gui. [16481]

$
0
0
hi i am new in naudio
and don't know more about the code.
I implement some functionality to my project
but actual result i am not getting

I need running audio wave in gui.
but unable to find and implement the code
please help me and show the path how to do this. :)

New Post: Mpeg layer 2 audio.

$
0
0
Hi.

Layer 2 is not implement in Naudio, isn't? (I get the comException error when trying to decode it) So i wonder if there is a simple way to decode the Layer 2 stream and passing it to Naudio in PCM... or do you have a better idea? Layer 2 is still a very popular format in broadcasting, and thus, there's a lot of files compressed in that layer.

Thank you!

New Post: Using MP3 from project resources

$
0
0
AudioFileReader is just a container class that uses Mp3FileReader, WaveFileReader etc. based on the filename,
[if filename.endswith(".mp3")] and so on....
So, actually it doesn´t seem to support streams and you have 2 possibilities to choose:

1) Copy the AudioFileReader.cs class from NAudio source and adjust it for stream support
2) Assign readers yourself, as I have done e.g. here: Url

I´d recommend using option 1, as it is an easier approach for beginners. You also have to look up if your used readers can handle streams, e.g. Mp3FileReader can read from a stream.

New Post: mp3 starting point

$
0
0
Combine Mp3FileReader with OffsetSampleProvider

New Post: What does the WaveInProvider class do? What is it used for?

$
0
0
Hovering over the class gives me a short definition: Buffered WaveProvider taking source data from WaveIn.

It's a little too general so I'm not sure of its uses. I'm looking at some code from a sample project I found on youtube to try and understand this library better. But what I'm trying to achieve and what the original person who wrote the code were trying to achieve differ somewhat along the way.

So I just want to know a bit about this class, and then I can see if it has a place within my project.

New Post: Mpeg layer 2 audio.

$
0
0
Hi Knob
can u help me out

i am implementing some part of Naudio project
but i am unable to approach to the code

I need only graph in my project
i am getting every thing but graph is not running
what method to implement and how can u guide me



Regard
zafar

New Post: Mpeg layer 2 audio.

$
0
0
Hi.

That is a very general question. What you do you want to do? what's the final idea? winforms or WPF? what code are you using?

See you.

New Post: Mpeg layer 2 audio.

$
0
0
Hi

I want wave graph for .wav file when it play .
in winform

i have done every thing but i am not getting final out put
Audio wave graph.

New Post: Mpeg layer 2 audio.

$
0
0
Hi.

Have you tried the demo? It's in the zip. You have to run Naudiodemo, and select AudioPlaybackDemo. Inside that form you will find the control that displays the waveform.
The code for represent the wave graph there is:


private ISampleProvider CreateInputStream(string fileName)
    {
        this.audioFileReader = new AudioFileReader(fileName);

        var sampleChannel = new SampleChannel(audioFileReader, true); --> true to force it stereo.
        sampleChannel.PreVolumeMeter+= OnPreVolumeMeter; //--> This creates the event for draw the graph before any change made later to the amplitude of the original sound (volume i.e.). Follow the method below...
        this.setVolumeDelegate = (vol) => sampleChannel.Volume = vol;
        var postVolumeMeter = new MeteringSampleProvider(sampleChannel);
        postVolumeMeter.StreamVolume += OnPostVolumeMeter;

        return postVolumeMeter;
    }

    void OnPreVolumeMeter(object sender, StreamVolumeEventArgs e)
    {
        // we know it is stereo
        waveformPainter1.AddMax(e.MaxSampleValues[0]); //--> Waveform graph for L channel
        waveformPainter2.AddMax(e.MaxSampleValues[1]);  //--> Waveform graph for R channel
    }
As soon as you initialize WaveOut.Init(sampleChannel); and fire WaveOut.Play; it will begin to draw.

New Post: Mpeg layer 2 audio.

$
0
0
i had create a form.

        public Form1([ImportMany]IEnumerable<IOutputDevicePlugin> outputDevicePlugins)
        {
              InitializeComponent();
            LoadOutputDevicePlugins(outputDevicePlugins);
        
        }
How to call this constructor on page loading.

Created Unassigned: Mp3FileReader ReadNextFrame supposed to increment position? [16482]

$
0
0
I believe in 1.7.3 on nuget, ReadNextFrame results in Position and CurrentTime increasing.

After the below commit, this looks like it's no longer the case. Is that a bug?

https://github.com/naudio/NAudio/commit/1dbc29cdb539cbed794f7daec803bf10f431022f

New Post: Device Name Truncation with WaveOut.GetCapabilities

$
0
0
Hi theserus

I am having the same issue with two identical USB sound cards connected the PC would have the same truncated name in NAudio.

I'll be trying this workaround pretty soon.

New Post: Device Name Truncation with WaveOut.GetCapabilities

$
0
0
fouchette,
FYI, If your computer Windows OS is NOT XP (ie it is Vista or higher), you can get full names (not truncated) with this code. However, the this code will cause an error exception on XP.
 if (IsOSWindowsVistaOrHigher)
{
    MMDeviceEnumerator DevEnum = new MMDeviceEnumerator();
    // DataFlow.All gets all devs mics, speakers and mixer
    // DataFlow.Render is just output devices
    MMDeviceCollection devColl = DevEnum.EnumerateAudioEndPoints(DataFlow.Render, DeviceState.Active);
}
Viewing all 5831 articles
Browse latest View live


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