AudioComponent plays sound in simulation, but in other modes, no sound at all.

This is strange, there is sound in simulation, but in other modes, no sound at all.

In Tick function:

if (!IsRunningDedicatedServer() && AudioComponent == NULL)
	{
		AudioComponent = CreateVoiceAudioComponent(44100);
		AudioComponent->AddToRoot();
		AudioComponent->Play();
	}

	if (AudioComponent != nullptr)
	{ 
		if (AudioComponent->Sound)
		{ 
			USoundWaveProcedural* SoundStreaming = CastChecked<USoundWaveProcedural>(AudioComponent->Sound);
			uint32 const maxBytes = 44100;
			uint8 buf[maxBytes];
			SoundStreaming->GeneratePCMData(buf, 44100);
			SoundStreaming->QueueAudio(buf, 5120); 
		}
		else
		{
			UE_LOG(LogTemp, Warning, TEXT("AudioComponent->Sound is null."));
		}
	

	} 

And the CreateVoiceAudioComponent function: (copied from OnlineSubsystemUtils.cpp)

   UAudioComponent* AudioComponent = nullptr;
	if (GEngine != nullptr)
	{
		if (FAudioDevice* AudioDevice = GEngine->GetMainAudioDevice())
		{
			USoundWaveProcedural* SoundStreaming = NewObject<USoundWaveProcedural>();
			SoundStreaming->SampleRate = SampleRate;
			SoundStreaming->NumChannels = 1;
			SoundStreaming->Duration = INDEFINITELY_LOOPING_DURATION;
			SoundStreaming->SoundGroup = SOUNDGROUP_Music;
			SoundStreaming->bLooping = false;

			AudioComponent = AudioDevice->CreateComponent(SoundStreaming);
			if (AudioComponent)
			{
				AudioComponent->bIsUISound = true;
				AudioComponent->bAllowSpatialization = false;
				AudioComponent->SetVolumeMultiplier(1.5f); 
			}
			 
		}
	}

	return AudioComponent; 

It plays noise in simulation, but nothing in other mode.
Help please!

Edit:
When I start PIE mode , then wait for a number of seconds then exit, it will play noise for the same number of seconds.