Hi!,

I am working (as practice) on a Simon game clone, I´d like the user to be able to press a button, which will play a tone (I created the tones as small .WAV files using BFXR). The issue I have is that if the user keeps the button pressed, I am looping the sound to create a continuous tone, but there is a small silence in between each play that I cant get rid of. This is the code I´m using:

func _process(delta):
	# Called every frame. Delta is time since last frame.
	# Update game logic here.
	if(greenButton_Pressed && !greenButtonSound.playing):
		greenButtonSound.play()
	elif(!greenButton_Pressed && greenButtonSound.playing):
		greenButtonSound.stop()

func _on_GreenButton_button_down():
	greenButton_Pressed = true

func _on_GreenButton_button_up():
	greenButton_Pressed = false

I´ve checked the WAV files using Audacity and trimmed the small silence at the end of the file generated by BFXR. So the file is all audio.

Thanks for any help anyone can provide :)

Without knowing much about audio(so take this with a large dose of salt) I do wonder if the solution wouldn't be to handle the loop as PWM and have at least 2 tracks playing the audio clip so that while one pulse goes silent the other on the second track blends in to fill the void so to speak...

https://en.wikipedia.org/wiki/Pulse-width_modulation https://en.wikipedia.org/wiki/Pulse-width_modulation#Audio_effects_and_amplification

4 years later