I use to play nuget NVorbis and NAudio. But when creating a VorbisWaveReader, an error occurs:

Could not determine container type! 

listing

 private static string demoStr = @"https://text-to-speech-demo.mybluemix.net/api/synthesize?text=Conscious+of+its+spiritual+and+moral+heritage%2C+the+Union+is+founded+on+the+indivisible%2C+universal+values+of+human+dignity%2C+freedom%2C+equality+and+solidarity%3B+it+is+based+on+the+principles+of+democracy+and+the+rule+of+law.+It+places+the+individual+at+the+heart+of+its+activities%2C+by+establishing+the+citizenship+of+the+Union+and+by+creating+an+area+of+freedom%2C+security+and+justice.&voice=en-US_AllisonVoice&download=true"; static void Main(string[] args) { using (var wb = new WebClient()) { var res = wb.DownloadData(demoStr); File.WriteAllBytes("1.ogg", res); var response = wb.DownloadString(demoStr); var file = File.OpenRead("1.ogg"); using (var vorbis = new NAudio.Vorbis.VorbisWaveReader("1.ogg")) using (var waveOut = new NAudio.Wave.WaveOut()) { waveOut.Init(vorbis); waveOut.Play(); } } } 

What could be the error or how else can ogg be reproduced?

    1 answer 1

    Used the com library Windows Media Player

     using WMPLib; { ... WindowsMediaPlayer wmp = new WindowsMediaPlayer(); wmp.URL = @"1.ogg"; wmp.controls.play(); ... } 
    • one
      Just keep in mind that WindowsMediaPlayer by default cannot play ogg-files. Looking for additional codecs. - Alexander Petrov
    • @Alexander Petrov thanks, I will consider. Apparently I already had them - user2455111