Change Audio Pitch [V 1.0]

letmethink

  • *
  • Posts: 2545
If there's any demand for this, I can update it for 3.5 for native targets (I have it working in a demo)
Place this code into an import event:
Code: [Select]
@:access(lime.media.AudioSource.backend)
@:access(openfl.media.SoundChannel.__source)
@:access(lime._backend.native.NativeAudioSource.handle)
Then use this code whenever you want to change the pitch (with the 1 being the sound channel to set the pitch on and the 1.2 being the pitch (where 1 is normal)
Code: [Select]
lime.media.openal.AL.sourcef(Engine.engine.channels[1].currentSound.__source.backend.handle, lime.media.openal.AL.PITCH, 1.2);
This currently messes up audio looping, but I can fix this if there is the demand

« Last Edit: August 08, 2017, 04:40:02 pm by letmethink »
~Letmethink

LIBERADO

  • *
  • Posts: 2720
If there's any demand for this, I can update it for 3.5 for native targets
Yes, please.
I'm spanish, excuse me for my bad English.
I'm not a private teacher. Please, post your questions in the public forum.



colburt187

  • *
  • Posts: 2416
Yeah I think this is a really essential function to have!

designpeg

  • Posts: 731

letmethink

  • *
  • Posts: 2545
Hmm okay. This extension only works on 3.5 right now. For looping to work properly you have to play the sound then enable looping on the channel you played the sound on

NOTE: This extension doesn't work on flash/html5 since they don't use openAL for audio
~Letmethink

LIBERADO

  • *
  • Posts: 2720
Thank you very much, @letmethink
   
Because this extension only works on Stencyl 3.5, I have installed both versions, the old version to use it with Stencyl 3.4, and this new version to use it with Stencyl 3.5
   

   
I'm spanish, excuse me for my bad English.
I'm not a private teacher. Please, post your questions in the public forum.

FMStudioGameDev

  • *
  • Posts: 234
Thank you very much, @letmethink
   
Because this extension only works on Stencyl 3.5, I have installed both versions, the old version to use it with Stencyl 3.4, and this new version to use it with Stencyl 3.5
Could you please share the old version for Stencyl 3.4? The link in the first post leads to a 404.
Thanks a lot

LIBERADO

  • *
  • Posts: 2720
@FMStudioGameDev of course. It is attached to this post.
I'm spanish, excuse me for my bad English.
I'm not a private teacher. Please, post your questions in the public forum.

FMStudioGameDev

  • *
  • Posts: 234
@FMStudioGameDev of course. It is attached to this post.

Thanks a lot!

LIBERADO

  • *
  • Posts: 2720
@letmethink, what should the "pan" blocks do? I guess they are for stereo panning, but when I test them on Windows or Cppia, they do nothing.
I'm spanish, excuse me for my bad English.
I'm not a private teacher. Please, post your questions in the public forum.

NobodyX

  • *
  • Posts: 1228
Just spotted this thread and... wow, thank you so much to everyone who worked on this!!!! I've wanted pitch changing for so long

I just tried "Sound utility.zip" in 3.5 and the pitch shifting works great!!!

(Though the pan blocks don't seem to do anything for me, either)

I'd love to see these become standard, non-extension blocks.

letmethink

  • *
  • Posts: 2545
Oh yeah sorry I forgot to update the panning. That should be like a 5 minute job which I'll do tomorrow (I'm replying from my phone).
~Letmethink

LIBERADO

  • *
  • Posts: 2720
That should be like a 5 minute job which I'll do tomorrow
Any news about this?
I'm spanish, excuse me for my bad English.
I'm not a private teacher. Please, post your questions in the public forum.