4

I'm trying to play OGG file stream with NVorbis and NAudio, as described in the documention i'm trying to access VorbisWaveReader class, without success, here is my code:

using System;
using System.Collections.Generic;
using System.Text;
using NVorbis;
using NAudio;

namespace Paradise
{
    class Program
    {
        static void Main(string[] args)
        {
            using (var vorbis = new NVorbis.NAudioSupport.VorbisWaveReader(@"C:\PATH\TO\OGG\FILE.ogg"))
            using (var waveOut = new NAudio.Wave.WaveOut())
            {
            waveOut.Init(vorbis);
            waveOut.Play();
            }
        }
    }
}

I'm getting the following error:

type or namespace name 'VorbisWaveReader' does not exist in the namespace 'NVorbis.NAudioSupport'

It looks very basic and should work, i can see in the source code that VorbisWaveReader is present in the code, can you help me go thorugh that?

Thanks!

Shai Katz
  • 1,113
  • 9
  • 18
  • Did you use the DLLs or the sources? – TaW Jul 08 '14 at 15:22
  • 1
    Make sure you have referenced both NVorbis.dll and NVorbis.NAudioSupport.dll in your project (and NAudio.dll, obviously). Also, waveOut.Play() is async, so you won't actually hear anything (except maybe a pop or two) with this code. You'll have to delay somehow before exiting the using clause. – ioctlLR Jul 08 '14 at 15:31

1 Answers1

3

NVorbis.NAudioSupport change into NAudio.Vorbis

in Package-Manager Console type this:

Install-Package NAudio.Vorbis

Pradeep
  • 3,174
  • 1
  • 19
  • 34
Hossein Shahabi
  • 187
  • 1
  • 1
  • 12
  • 1
    Hi @Hossein Is it possible to cut the OGG audio file using NVorbis Library to the required timeslots? – Yeni Havu Dec 23 '20 at 14:34