I encountered unusual behavior in a Silverlight application and could not solve it after trying many hours.
Since I canβt access the internal AudioFormat constructor in my code (even using reflection caused by Silverlight security policies to throw an exception), How do I change the audio format (in my class, which is derived from the AudioSink class Now I redefine the method in the MemoryAudioSink class in the following way:
protected override void OnFormatChange(AudioFormat audioFormat) { if (this.audioFormat == null) { this.audioFormat = audioFormat; } else { throw new InvalidOperationException(); } }
I cannot create a new AudioFormat (there are no ctor available), and AudioFomat by default has 16000 samples per second that have no settings. I would like to record and save audio in Mono format (Channels = 1), 8 bits (sample bit = 8), 8k (samples per second = 8000).
In addition, I used Cool Edit to record 8 bit 8k sound to make sure my sound card supports it.
Is it so simple to put, can I record audio using my custom AudioFormat or do I need to record audio in Silverlight, transfer it to my WebApp and convert it to my custom format using a third-party library (which I don't know about)?
source share