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

New Post: Creating a mixed file of 4 sounds. How can I achieve that?

$
0
0
Could you explain a little more?
I don't understand about signal chain.

Thanks

New Post: How can I position an mp3 streaming?

$
0
0
I tried to do it with provider but it doesnt supports or contains setting position method. Is it necessary to buffer all frames or is it enough to buffer frames that just contains a specific time?

New Post: How can I position an mp3 streaming?

$
0
0
markheath wrote:
You'd need to buffer all the MP3 frames somehow (in memory or to a file), and then when a reposition occurs, move back to the frame that contains that time.
I tried to do it with provider but it doesnt supports or contains setting position method. Is it necessary to buffer all frames or is it enough to buffer frames that just contains a specific time?

New Post: How to concatenate two Wave files in memory to play

$
0
0
Ok, I see. Thanks for the suggestion: we'll make sure we run that at least once.
Kind regards

The BrainCrumbz team

New Post: How to concatenate two Wave files in memory to play

$
0
0
Apart from all this (preliminary problems?) we still have issues with the core of the this: the IWaveProvider that joins WAV files in memory. Initially it seemed to work ok, but now we're trying with 5 or 6 short clips (a start tone, some spoken letters or numbers from a code, an ending tone) and we can hear that the final clips are somehow cut, or not played to the end anyway.

As from the initial gist linked before, the core is represented by the following code blocks:
// Code invoking the provider and saving WMA
private static int JoinToWmaFile(string outputPathName, MediaType wmaMediaType, IEnumerable<MediaFoundationReader> waveReaders)
{
    // ...
    IWaveProvider joiningWaveProvider  = new JoiningWaveProvider(waveReaders);

    using (MediaFoundationEncoder wmaEncoder = new MediaFoundationEncoder(wmaMediaType))
    {
        wmaEncoder.Encode(outputPathName, joiningWaveProvider);
    }

}
// The actual provider
public JoiningWaveProvider(IEnumerable<MediaFoundationReader> inputFileReaders)
{
    // ...
    private int _readIndex = 0;
    // ...
        public int Read(byte[] buffer, int offset, int count)
        {
            int startIndex = _readIndex;
            int currentOffset = offset;
            int totalRead = 0;
            int remaining = count;

            for (_readIndex = startIndex; _readIndex < _inputFileReaders.Count && remaining > 0; _readIndex++)
            {
                MediaFoundationReader currentReader = _inputFileReaders[_readIndex];

                int readNow = currentReader.Read(buffer, currentOffset, remaining);

                currentOffset += readNow;
                totalRead += readNow;
                remaining -= readNow;
            }

            return totalRead;
        }
}
We put some Debug logs (not shown in code) and here are some info about the read invocations, although they're not very clear to us:
Common format: 16 bit PCM: 44kHz 1 channels
Saving to WMA with explicit encoder
Read, offset: 0, count: 352800
  - readIndex: 0, currentOffset: 0, remaining: 352800
  - readIndex: 1, currentOffset: 117340, remaining: 235460
  - readIndex: 2, currentOffset: 147132, remaining: 205668
  - readIndex: 3, currentOffset: 172316, remaining: 180484
  - readIndex: 4, currentOffset: 232060, remaining: 120740
  - readIndex: 5, currentOffset: 261852, remaining: 90948
  - totalRead: 352800
Read, offset: 0, count: 352800
  - readIndex: 6, currentOffset: 0, remaining: 352800
  - totalRead: 133468
Read, offset: 0, count: 352800
  - totalRead: 0

New Post: Supported formats for playing

$
0
0
Hi all,
I'm looking for a list of supported formats by default by NAudio. In my computer I've tested it can play wav, mp3 and m4a (aac), but I don't know if this formats are supported by default or through codecs, and I don't know which others formats are supported by NAudio.
If NAudio, besides the defaults formats, support others formats through codecs, how can I get programmatically (VB.NET or C#) a complete list of supported formats in the particular system that is running NAudio?

Thank you all :)

New Post: Supported formats for playing

$
0
0
hi, NAudio can use MediaFoundation (Windows Vista and above) and ACM (all supported Windows versions) for codecs. However, ACM is just codecs, it doens't understand file formats, so the ACM codecs on your system will only allow you to play WAV files containing compressed audio (e.g. ADPCM, G.711 etc)

Media Foundation is a different matter. The Media Foundation reader can read various audio file types (including MP3, WMA, MP4/ AAC etc) and it can read the audio out of video files too. However, finding out exactly what formats are available might be a bit tricky. I recommend you look at the source code for the WPF NAudio Demo (part of the overall source code) and look in particular at the enumerating Media Foundation transforms code. This will help you discover what decoders are present on your system. I suspect that what is really needed is some kind of way to discover what Media Foundation "source readers" are supported. I'm afraid I don't know how that is done.

New Post: Supported formats for playing

$
0
0
So it's more easy to program using Media Foundation and declare Vista as a minimum requirement, true?

New Post: Supported formats for playing

New Post: Supported formats for playing

$
0
0
yeah that looks about right. Remember that MF stuff isn't installed by default on server editions of Windows though.

New Post: Supported formats for playing

$
0
0
So I should verify that Media Foundation is installed... I look around about this.

New Post: How can I position an mp3 streaming?

$
0
0
well if you need to reposition to anywhere, you'd need to buffer it all to memory or disk. Look at the source code for Mp3FileReader and you'll see how it builds a table of contents of MP3 Frames, and uses that for repositioning

New Post: Creating a mixed file of 4 sounds. How can I achieve that?

$
0
0
A signal chain is where you connect together IWaveProviders and ISampleProviders. So for example pass two AudioFileReaders into a MixingSampleProvider, and then pass that into a SavingWaveProvider and then pass that into Init of a WaveOut device. If you have access to Pluralsight, I go into this in a lot of detail in my NAudio course

New Post: Process audio data without saving a file

Released: NAudio 1.7.3 (mars 05, 2015)

$
0
0
Bugfix release.
Support for more core audio interfaces

Created Release: NAudio 1.7.3 (Mar 05, 2015)

$
0
0
Bugfix release.
Support for more core audio interfaces

New Post: AsioOut ret ComException

$
0
0
Hello.
My question is the next.
I use NAudio in my C# console application. When i try to create AsioOut like this:
var asioDevice = new AsioOut(deviceName);
then i've got the error: System.Runtime.InteropServices.COMException: Unable to instantiate ASIO. Check if STAThread is set...

Why? What's the problem?

When i check asio drivers using AsioOut.GetDriverNames() i've got 2 drivers: "ASIO4ALL v2" and "Saffire".

New Post: Using multichannel soundcard

$
0
0
Hello!
I have the next question.
I have a multichannel soundcard. It about 10 output lines.
How can i send sound in selected output line? Is it possible using NAudio? What i must use (it maybe ASIO)?

Thanks!

Created Unassigned: [Window Store Apps] Construct MediaFoundationReader from StorageFile [16471]

$
0
0
In WinRT, files are better identified by a StorageFile object rather than a path string. This is due to the reasons that 1. non-conventional file systems (such as cloud drives) are supported and 2. file access rights are much more restrictive compared to desktop applications. E.g. trying to open an arbitrary file on the file system usually causes a UnauthorizedAccessException. However, if that same file was obtained by a FileOpenPicker control, it is possible to open that file - but only by using the obtained StorageFile object.

It would be great if the MediaFoundationReader supports that, too. I.e. just supply a StorageFile instead of a path to its constructor. A viable alternative would be to open the file in the App and to supply some IRandomAccessStream instead,

New Post: No sound while playing an mp3 file from disk using WaveOut

$
0
0
These days I am working a project mp3 streaming and I have a problem with playing a specific mp3 with WaveOut and Mp3FileReader. I tried it after mp3 file is downloaded and the problem occured again.I don't know why this happened
Mp3 props: 128 Kbps 44 khz Stereo
Viewing all 5831 articles
Browse latest View live


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