문제

I have a short[] array filled with 16-bit pcm values.

I want to be able to play it without adding any header, and without saving any files to my memory.

I know that I might need a class that gives parameters like bit rate and stuff like that - but I want to do it all in my program without and files.

I am working in C#.

Thanks ahead, Ofek

도움이 되었습니까?

해결책

Install CSCore through nuget. Then write all your shorts into a memorystream (you can use the binarywriter to do that). After that use the CSCore.Codecs.RAW.RawDataReader to create an audiosource from your memorystream by specifing the format (16 bit, pcm, samplerate, channelcount). After that you can use for example the CSCore.SoundOut.WasapiOut class to playback the stream. You can take a look at the little sample on codeplex (bottom of the page). http://cscore.codeplex.com/

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top