[How To?] - Continuously playing tone

NahwellNahwell Posts: 5Member

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 :)

Answers

Sign In or Register to comment.