Assortion is a check if specific condition is meet, if not it will crash the engine and print what condition failed, in you case condition was IsValid() which is a function and it return false. Normally you should go to line in pointing to in engine source code to see whats wrong… but those one is very easy to guess, it happens in SharedPointer.h and only shered pointer you use is TSharedPtr<class IVoiceCapture> VoiceCapture; so it easy to guess that you have invalid pointer here. Even by looking on code you can clearly see you decler a pointer but you never set and and then you make function call on it and it crashes because you calling it to some thing that does not exist
you need to get voice capture first so do this:
VoiceCapture = FVoiceModule::Get().CreateVoiceCapture();
if(!VoiceCapture.IsValid()) return; //insted of return you can do something else in case of fail