Pregunta

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

¿Fue útil?

Solución

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/

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top