leolabs / ableton-js

Control Ableton Live with Node.js
MIT License
368 stars 46 forks source link

Set pitch of clip #34

Closed dir closed 2 years ago

dir commented 2 years ago

I'm trying to set the pitch of a clip.

Currently I've tried this to no avail:

clip_slots.forEach(async (slot) => {
      if (slot.raw.is_playing === true) {
        let clip = await slot.get("clip");
        let name = await clip.get("name");
        let pitch = await clip.set("pitch", 20);
        console.log(track + ': ' + name);
      }
});
dir commented 2 years ago

Do you know where I could find general documentation on the things you can set and get from ableton.song, clips, etc?

leolabs commented 2 years ago

If you use TypeScript, you can make use of autocompletion to give you the properties you can get and set. Otherwise, you can take a look at the source files of ableton-js. For example, the clip properties you can set are defined here.

That being said, I noticed that the settable clip properties are incomplete in my codebase. If you want to change the clip's pitch, you can set pitch_coarse for semitones and pitch_fine for cents.

I'll keep this issue open and will fix the types tomorrow.