A
alspacka

  • Mar 30, 2018
  • Joined Mar 8, 2018
  • 0 best answers
  • I'm working on a music app. I have a very short audio sample (a drum hit), which I've connected to a timer such that the sound will play every 200 msec. When I run the scene, the tempo that is produced, while mostly consistent, is inconsistent enough that it's not musically useful. Is there anything I can do to get more even timing? I have the timer node set to physics mode. I also have V-sync enabled, if that makes a difference here.

    Essentially, I have the same question as this one, but that was asked a while ago and I wondered if anything has changed since then.

  • Thanks for the response @TwistedTwigleg, that looks like it will work. I figured out why the one code snippet was working in one script and not another, and it was completely, and embarrassingly, unrelated to my question. When I pressed the play button, I was running my default root node rather than the root node in the new scenetree that I was working in! I didn't realize that was the way GE works.

  • @TwistedTwigleg said: You can simulate a button press/release from code using Input.action_press and Input.action_release. (I think. I haven’t actually either function before)

    I marked this as an answer, but it actually didn't work. I tried this bit of code, which worked from one script but not from the one I want. Trying to figure out why:

    var a = InputEventAction.new() a.action = "LD1" a.pressed = true Input.parse_input_event(a)

  • In my project settings/input map, I have an action called "LD1", which is mapped to the z key on the keyboard. How do I simulate that button being pressed, and then released, in code? Thanks!

  • Thanks! I'm not sure how resources work yet -- if I access the .stream.loop_end from my StreamPlayer, will that modify one particular instance of the wav file, or will it modify my base resource? I ask because I need to have multiple instances of the wav file running at once, with different loop end points.

  • VERY new to GE so please bear with me. I have an AudioStreamPlayer in which I load a wav file. As I understand it, the wav is loaded as an AudioStreamSample. I need to be able to edit its "Loop End" member variable of AudioStreamSample from another script, but I don't see how to create this connection as the AudioStreamSample does not appear in the inspector as a child of the AudioStreamPlayer.

    My application is to build a musical instrument. My wav file is a single-cycle waveform, and changing the loop_end alters the pitch.

    Thanks for any inputs.