1

I have encountered a strange behavior in Silverlight application and couldn't be able to resolve it after trying many hours.

  • Since I cannot access AudioFormat's internal constructor in my code (even using reflection caused silverlight security policies to raise an exception), How can I change audio format (in my class which is derived from AudioSink class. Right now, I override the method in my MemoryAudioSink class as follows:

    protected override void OnFormatChange(AudioFormat audioFormat)
    {
        if (this.audioFormat == null)
        {
            this.audioFormat = audioFormat;
        }
        else
        {
            throw new InvalidOperationException();
        }
    }  
    

    I cannot create new AudioFormat (no ctor available) and the default AudioFomat has 16000 samples per seconds which has no setter. I'd like to record and save audio, in a Mono (Channels = 1), 8 bit(Bits Per Sample = 8), 8k (Samples Per Second = 8000) format.

Also, I have used Cool Edit to record 8bit 8k audio successfully to make sure my sound card supports it.

So simply put, Can I record audio with my custom AudioFormat or should I record the audio in Silverlight, pass it to my WebApp, and convert it to my custom format using a third party library (which I'm not aware of any)?

Kamyar
  • 18,639
  • 9
  • 97
  • 171

1 Answers1

0

This link might help you: Silverlight 4 audio recording and upload to server Sry for my stupidity I dont know how to format code, in that link I gave you, look for line AudioFormat desiredAudioFormat = null; go there, you need next foreach

Nikola Gaić
  • 117
  • 1
  • 11