platform audio library for .NET

Requirements:

  • Get raw input from a microphone in real time
  • Play that raw input back in real time
  • I can't seem to find much from Googling about it. Has anyone used something like that?

    I'm using C#, and it needs to work on Windows, Linux, and Mac, the latter two with Mono.

    I might be willing to use p/invoke, but I'm not especially familiar with native code and it would be tough. If someone can suggest a native library, I'll give it a shot.


    ManagedBass is new .NET Cross-Platform wrapper for un4seen Bass library with MIT license. It's not only wrapper - it has also objective API. Take a look at this blog post.

    Here's example of playing file using wrapper API:

    using ManagedBass;
    
    class Program
    {
        static void Main()
        {
            Bass.Init(); // Initialize with default options.
    
            int handle = Bass.CreateStream("YOUR_FILE.mp3");
    
            Bass.ChannelPlay(handle); // Begin Playback.
    
            Console.ReadKey(); // Wait till user presses a Key.
    
            Bass.ChannelStop(handle); // Stop Playback.
    
            Bass.ChannelFree(handle); // Free the Stream.
    
            Bass.Free(); // Free the device.
        }
    }
    

    Here's the same using objective API:

    using ManagedBass;
    
    class Program
    {
        static void Main()
        {
            using (var Player = new MediaPlayer()) // Create a Player.
            {
                Player.Load("YOUR_FILE.mp3"); // Load a file.
    
                Player.Start(); // Begin Playback.
    
                Console.ReadKey();
            }
        }
    }
    

    BASS.NET is supposed to be cross-platform with mono, and you can do what you're asking using it, as in this SO answer: https://stackoverflow.com/a/6796571/2208058

    http://bass.radio42.com/

    链接地址: http://www.djcxy.com/p/70490.html

    上一篇: 如何在Windows 8现代应用程序中从视频流中抓取帧?

    下一篇: 用于.NET的平台音频库