How to make a slider that changes speed of the sound?

The title says all. idk how to do this, but it's supposed to kinda look like the sliders in this project:

except it changes the speed of sound.

Well, there are two questions here. The first is, how do you make a slider? To do that, first make a variable. This will put a watcher on the stage, with the name in the gray part and the value, initially 0, in the orange part.

Then you right-click on the watcher, and there will be in the menu a radio button labelled "slider."

Once you have a slider, you can use that same right-click menu to set its minimum and maximum values.

Next question, how do you use that to change the speed of a sound? I take it you just want to change the sampling rate, so if you speed it up it's not only faster but also higher pitched, right? So, find this block in Sounds:
preloaded libraries script pic
and put the variable that's associated with the slider in the second input, the one that says 44100 in the picture. Experiment with the min and max slider values. I think 60000 sounds distinctly high-pitched but not quite Alvin and the Chipmunks-ish.

I know I'm late but there's a block @Snapenilk made that controls the playback speed directly and has an easy interface

How do you use it though?

Wait, I messed up
I forgot, you have to replace the regular sound blocks with these also because, well, it's kind of confusing but basically the code for the regular Snap! sound interface is different from the HTML audio elements in javascript
Use this link instead
I'm really bad at explaining things/helping people

Sound objects in Snap! have two* properties:

  • name
    • A string (self-explanatory)
  • audio
    • An HTML Audio element (<audio></audio in HTML or the Audio() constructor in JavaScript)
    • This is how the sound is controlled.

(*not counting default properties that all object have)

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.