Announcement

Collapse
No announcement yet.

Confused about new Audio Capture Component usage in 4.19

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

    Confused about new Audio Capture Component usage in 4.19

    I'm playing around with some of the new audio goodness in 4.19 preview 2 and exploring avenues for microphone processing. Specifically, I'm wanting PCM data from a microphone to be used in a custom VOIP solution. It doesn't interact with UE4's built-in VOIP system in any way.

    There are two routes I've tried: using a Media Sound Component, and an Audio Capture Component.

    The Media Sound component requires a bit more work to enumerate and Open the audio capture stream for the microphone, but it seems to work. I'm printing the envelope value and it behaves as it should.

    Similar story with the Audio Capture Component -- the envelope reacts as expected.

    The next step would be to write a custom Source Effect to add to the chain which would receive and process the captured audio.

    The problem is that in both cases I can hear the captured audio out of my speakers. I assume all this audio is being consumed by the new audio mixer and output as a normal sound. This is not my intended behavior -- I want to capture this audio for processing only, and not output it to the final mix.

    I've tried muting the sound but anything that quiets the sound also affects the detected envelope. If I'm understanding correctly, this makes sense -- anything connected to the source effect chain needs real audio to 'hear', but I basically want to kill the sound immediately after the source effect chain is processed and before it enters the rest of the sound system to be processed (spatialized, etc) and output.

    Am I barking up the wrong tree completely? I can't help but think that even if I zeroed out the audio in the source effect, there is a considerable amount of unnecessary processing happening for what could be a simple capture straight to memory. It may be that since I only want to capture (and not play back) audio, avoiding a synth component and going straight for platform-dependent capture is the cleanest route.

    I looked briefly at Audio Recording Manager, but it seems steeped in Sequencer and intended for output to a file, which is not what I'm after.

    I'm very new to audio in UE4 in general, let alone the new audio mixer, so I may have a gross misunderstanding of what is going on. Any wisdom is appreciated!

    #2
    .. snip ..
    Last edited by carefish; 02-06-2018, 03:36 PM. Reason: Solved my question, I forgot to enable the new audio mixer in the WindowsEngine.ini located at <location of ue4.19>\Engine\Config\Windows.

    Comment


      #3
      You'll want 0-out the audio on the source effect if you don't any audio to go to the output for the audio capture component, that will effectively mute it after your source effect is processed.


      Edit, something like this in the ProcessAudio callback:

      for (int32 Sample = 0; Sample < InData.AudioFrame.Num(); ++Sample)
      {
      OutData.AudioFrame[Sample] = 0.0f;
      }

      Comment


        #4
        That said, if you'd prefer a direct C++-only route to get mic audio and bypass the audio engine entirely, you can use the FAudioCaptureSynth class, which is the thing the MicCapture component uses. This is a very basic wrapper around RtAudio currently, but we will be implementing other backends as Mic-capture is needed.

        Comment


          #5
          Originally posted by Minus_Kelvin View Post
          That said, if you'd prefer a direct C++-only route to get mic audio and bypass the audio engine entirely, you can use the FAudioCaptureSynth class, which is the thing the MicCapture component uses. This is a very basic wrapper around RtAudio currently, but we will be implementing other backends as Mic-capture is needed.
          Why does UAudioCaptureComponent basically make its publicly-available parent methods (particularly ::OnGenerateAudio, ::OnBeginGenerate, and ::OnEndGenerate) all private? UAudioCaptureComponent isn't a huge class or anything, just curious why that choice was made.
          Trent Polack (@mittense)
          Personal Site | Development Blog | Joy Machine

          Comment


            #6
            I got this working thru blueprint in 4.21 but my question is i want to be able to record without hearing my voice in the speakers while i record. Can someone assist me on this please?
            Much Appreciated

            Comment


              #7
              I know your doing it in C++ but if you want to take a look at what i did here are a few snippets:
              Click image for larger version

Name:	AudioCapture.JPG
Views:	1
Size:	143.2 KB
ID:	1556409

              1. Activate the New Audio Sound Mixer by going to D:\Program Files\Unreal Engine\UE_4.21\Engine\Config\Windows (Where ever your instal is located) look for WindowsEngine.ini

              Click image for larger version

Name:	iniCapture.JPG
Views:	1
Size:	92.7 KB
ID:	1556410

              Uncomment AudioDeviceModuleName=AudioMixerXAudio2 & Comment ;AudioDeviceModuleName=XAudio2 as stated in the highlighted area. Not sure if it's the same procedure for IOS, Anfroid Etc. But works for Windows.

              2. Add AudioCaptureCompnent to which ever actor or Logic your making
              3. Add NewSoundSubMix ( Right click in content browser : Sound > SoundSubmix Open and set to your liking
              4. Add Created SoundSubMix in AudioCaptureCompnent settings. Effects section as show.

              Click image for larger version

Name:	SettingsCapture.JPG
Views:	1
Size:	38.6 KB
ID:	1556411

              5. In the Finish Recording SubMix Output Name= Whatever name you want to give your file (file to save eg., Wav File) Path= The absolute Location where file will be saved (Considering Content folder being Root) and Exisiting Sound Wave to Overwrite= You can set this to the wav file you wish to overwrite otherwise leave blank.

              I hope it helps. As this was my first attempt at it and it works. I just cant figure out how to record without hearing myself on the speakers.

              Comment


                #8
                Originally posted by porckchop View Post
                I got this working thru blueprint in 4.21 but my question is i want to be able to record without hearing my voice in the speakers while i record. Can someone assist me on this please?
                Much Appreciated
                I had the same problem and just now figured it out.
                When you select your Audio Capture Component, check in the Details window under Effects is a checkbox "Output To Bus Only".
                Description: "Whether or not to only send this audio's output to a bus. If true, this sound won't be audible except through bus sends."

                Hope it helps.
                Attached Files

                Comment


                  #9
                  Originally posted by Nameus View Post

                  I had the same problem and just now figured it out.
                  When you select your Audio Capture Component, check in the Details window under Effects is a checkbox "Output To Bus Only".
                  Description: "Whether or not to only send this audio's output to a bus. If true, this sound won't be audible except through bus sends."

                  Hope it helps.
                  Hi, I'm trying to solve the problem of hearing myself on the speakers. I tried to check that "Output to Bus Only", but with that parameter checked the output file results empty.
                  May you help me?

                  Comment


                    #10
                    Originally posted by Nameus View Post

                    I had the same problem and just now figured it out.
                    When you select your Audio Capture Component, check in the Details window under Effects is a checkbox "Output To Bus Only".
                    Description: "Whether or not to only send this audio's output to a bus. If true, this sound won't be audible except through bus sends."

                    Hope it helps.
                    How did you get this to work without hearing your own voice, it doesnt want to work no matter what i try, any ideas.?

                    Comment


                      #11
                      Originally posted by porckchop View Post

                      How did you get this to work without hearing your own voice, it doesnt want to work no matter what i try, any ideas.?
                      I ended up using ffmpeg (externally, holy ffmpeg!) to record my voice...

                      Comment


                        #12
                        How can i request at least a how to on this feature from the developer, i mean obviously im missing something and there isnt any documentation anywhere. does anyone know? or who to contact?

                        Comment


                          #13
                          Originally posted by masmil1988 View Post

                          I ended up using ffmpeg (externally, holy ffmpeg!) to record my voice...
                          I would be curious how you did this I can't for the life of me figure out how to do this in C++ or in Blueprint. FWIW I've been using Blueprints this entire time, so I have no clue how the C++ stuff even works

                          Comment

                          Working...
                          X