The concept behind this program I am trying to make is a novelty audio encryption application. I have very little experience in using the audio libraries within C#. I am trying to record sound which will then be converted to a byte[] in order to undergo some encryption. This will then be saved in a .wav format. I will then need to read in the encrypted audio file and convert this to a byte array to decrypt and then play the decrypted byte array. I know it would be easier to save the file first before performing the encryption/decryption but I don't want an unencrypted version to be saved.
What is the best way/libraries in order to firstly convert the recorded audio to the byte[] and then save. Finally what is the best way to go about playing the decrypted byte[]. Any code / pseudo code would be appreciated.
Thanks
You can use SoundPlayer
class to play audio, and you can provide the data to it using a stream. For your case a MemoryStream
would be appropriate solution.
I'll write this by heart:
// Get your sound buffer
byte[] sound = GetMySounds();
// Place the data into a stream
using (MemoryStream ms = new MemoryStream(sound))
{
// Construct the sound player
SoundPlayer player = new SoundPlayer(ms);
player.Play();
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With