locked
AudioGraph fails with FileOutputNode plus FrameOutputNode RRS feed

  • Question

  • Hi

    I am trying to create an AudioGraph with Mircophone as input (DeviceInputNode) and with 2 outgoing connections to FileOutputNode and FrameOutputNode

    Both Input and Output Audio profile is Pcm with sampleRate = 16000, Channel = 1 (Mono), bitsPerSample = 2

    However, with 2 output nodes, audioGraph fails to start with an exception

    My underlying intention is to display an oscillator graph and hence I am adding FrameOutputNode to capture raw PCM data and convert that into a graph

    Appreciate your help

    Thanks
    Prajwal

    Thursday, July 13, 2017 11:38 PM

All replies

  • Hi Prajwala Prabhakar,

    When I create 2 outgoing connections to FileOutputNode and FrameOutputNode without setting the profile, it does not throw any exception. If you do not set the profile, is there any exception? Could you tell us more detail about your exception?

    There is an official document to Audio frame input node and Audio frame output node, please refer it in this link.


    Best Regards,

    Jayden Gu


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, July 14, 2017 7:58 AM
  • Hi Jayden

    Thanks for looking into my issue. Agree, if I don't set profile on both DeviceInputNode (microphone) and 2 output nodes (File and Frame) then there is no exception.

    However, in my case, I need specific wav format as posted in my first post (i.e. PCM sampleRate = 16000, Channel = 1 (Mono), bitsPerSample = 2)

    Is there anyway I can record audio from microphone and generate WAV audio with this specific profile ?

    PS: I am able to use above profile if I only have one of either FileOutputNode or FrameOutputNode. But it throws exception if I have both output nodes on the DeviceInputNode

    The exception I get is:

    at Windows.Media.Audio.AudioDeviceInputNode.AddOutgoingConnection(IAudioNode destination)at AudioRecorder10.Recorder.<StartAudioGraph>d__23.MoveNext()

    Appreciate your help

    Regards
    Prajwal

    Saturday, July 15, 2017 2:14 AM
  • Hi Prajwala Prabhakar,

    It seems we can not set 2 to the bitsPerSample, it will throw the exception.

    Please try to use MediaEncodingProfile.CreateWav to create an instance of MediaEncodingProfile for WAV. We can set the AudioEncodingQuality to it. Then we can use MediaEncodingProfile.Audio to get AudioEncodingProperties.

    For example:

    var inProfile = MediaEncodingProfile.CreateWav(AudioEncodingQuality.Low);
    AudioEncodingProperties nodeEncodingProperties = inProfile.Audio;
    frameInputNode = graph.CreateFrameInputNode(nodeEncodingProperties);
    

    Best Regards,

    Jayden Gu


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, July 20, 2017 9:40 AM
  • Hi Jayden

    I am sorry, I typed bitsPerSample as "2" but that's a typo (mentioned it in bytes) - I am indeed specifying bitsPerSample as "16" in my code

    I also tried your suggestion in previous post but that didn't help either. If I don't set EncodingProperties explicitly and leave the AudioEncodingQuality to 'High' - it works. If I either explicitly set EncodingProperties or if I set AudioEncodingQuality to 'Low' - I get exception

    However, I tried setting sampleRate to 48000 - and it works this time!

    So,

    sampleRate = 16000, ChannelCount = 1, bitsPerSample = 16 --> Doesn't work
    sampleRate = 48000, channelCount = 1, bitsPerSample = 16 --> Works

    PS: sampleRate = 16000 works if there is a single OutgoingConnection like either File or Frame. The exception is thrown only when there are 2 OutgoingConnections on DeviceInputNode

    Thanks
    Prajwal


    Thursday, July 20, 2017 11:19 PM
  • Hi Prajwala Prabhakar,

    There is no exception that I set AudioEncodingQuality to 'Low' with  2 OutgoingConnections on DeviceInputNode. I can not reproduce your issue.

    Would you please share us a simple reproduced project, it will help us analyze and diagnose this issue more clearly.


    Best Regards,

    Jayden Gu


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, July 21, 2017 5:31 AM