ableton-js 3.3.4 → 3.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -4,8 +4,22 @@ All notable changes to this project will be documented in this file. Dates are d
4
4
 
5
5
  Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
6
6
 
7
+ #### [v3.4.0](https://github.com/leolabs/ableton.js/compare/v3.3.5...v3.4.0)
8
+
9
+ - :bug: Fix setting quantizations not working correctly [`cd7a6e5`](https://github.com/leolabs/ableton.js/commit/cd7a6e52e65ad8dea9082b8b24afed952f6b33ad)
10
+ - :sparkles: Return mute and solo properties for each track [`5585533`](https://github.com/leolabs/ableton.js/commit/558553386dc7a0927541c2b246cc27fd86677641)
11
+
12
+ #### [v3.3.5](https://github.com/leolabs/ableton.js/compare/v3.3.4...v3.3.5)
13
+
14
+ > 6 November 2023
15
+
16
+ - :sparkles: Properly create and return scenes and tracks [`dc550f1`](https://github.com/leolabs/ableton.js/commit/dc550f15a79360caf3b247f5373a1d255b2b3476)
17
+ - :bug: Fix `createScene` not working when no index is provided [`e6bf99b`](https://github.com/leolabs/ableton.js/commit/e6bf99b7bcbcc053a2cddd12b5a77d91f36b0430)
18
+
7
19
  #### [v3.3.4](https://github.com/leolabs/ableton.js/compare/v3.3.3...v3.3.4)
8
20
 
21
+ > 26 October 2023
22
+
9
23
  - :sparkles: Add support for the Track View class [`3ff5980`](https://github.com/leolabs/ableton.js/commit/3ff5980e5e5f407bc6b767a5329b54774ca10534)
10
24
  - :sparkles: Add a `safeStopPlaying` function that only stops playback when Live is currently playing to prevent accidental jumps to the beginning of the timeline [`a7b84e2`](https://github.com/leolabs/ableton.js/commit/a7b84e2146a69ab00cc75f83a4eedd5d91495eda)
11
25
  - :art: Fix formatting [`f06d3d0`](https://github.com/leolabs/ableton.js/commit/f06d3d0cde4632612b1db8ea04e85f1276eb8bb6)
@@ -5,6 +5,37 @@ from .Device import Device
5
5
  from .Scene import Scene
6
6
  from .Track import Track
7
7
 
8
+ import Live
9
+
10
+ PLAY_QUANTIZATIONS = {
11
+ 'q_8_bars': Live.Song.Quantization.q_8_bars,
12
+ 'q_4_bars': Live.Song.Quantization.q_4_bars,
13
+ 'q_2_bars': Live.Song.Quantization.q_2_bars,
14
+ 'q_bar': Live.Song.Quantization.q_bar,
15
+ 'q_half': Live.Song.Quantization.q_half,
16
+ 'q_half_triplet': Live.Song.Quantization.q_half_triplet,
17
+ 'q_quarter': Live.Song.Quantization.q_quarter,
18
+ 'q_quarter_triplet': Live.Song.Quantization.q_quarter_triplet,
19
+ 'q_eight': Live.Song.Quantization.q_eight,
20
+ 'q_eight_triplet': Live.Song.Quantization.q_eight_triplet,
21
+ 'q_sixtenth': Live.Song.Quantization.q_sixtenth,
22
+ 'q_sixtenth_triplet': Live.Song.Quantization.q_sixtenth_triplet,
23
+ 'q_thirtytwoth': Live.Song.Quantization.q_thirtytwoth,
24
+ 'q_no_q': Live.Song.Quantization.q_no_q
25
+ }
26
+
27
+ REC_QUANTIZATIONS = {
28
+ 'rec_q_eight': Live.Song.RecordingQuantization.rec_q_eight,
29
+ 'rec_q_eight_eight_triplet': Live.Song.RecordingQuantization.rec_q_eight_eight_triplet,
30
+ 'rec_q_eight_triplet': Live.Song.RecordingQuantization.rec_q_eight_triplet,
31
+ 'rec_q_no_q': Live.Song.RecordingQuantization.rec_q_no_q,
32
+ 'rec_q_quarter': Live.Song.RecordingQuantization.rec_q_quarter,
33
+ 'rec_q_sixtenth': Live.Song.RecordingQuantization.rec_q_sixtenth,
34
+ 'rec_q_sixtenth_sixtenth_triplet': Live.Song.RecordingQuantization.rec_q_sixtenth_sixtenth_triplet,
35
+ 'rec_q_sixtenth_triplet': Live.Song.RecordingQuantization.rec_q_sixtenth_triplet,
36
+ 'rec_q_thirtysecond': Live.Song.RecordingQuantization.rec_q_thirtysecond,
37
+ }
38
+
8
39
 
9
40
  class Song(Interface):
10
41
  def __init__(self, c_instance, socket):
@@ -23,6 +54,9 @@ class Song(Interface):
23
54
  def create_return_track(self, ns):
24
55
  return Track.serialize_track(ns.create_return_track())
25
56
 
57
+ def create_scene(self, ns, index):
58
+ return Scene.serialize_scene(ns.create_scene(index))
59
+
26
60
  def get_clip_trigger_quantization(self, ns):
27
61
  return str(ns.clip_trigger_quantization)
28
62
 
@@ -61,6 +95,14 @@ class Song(Interface):
61
95
  def set_appointed_device(self, ns, device_id):
62
96
  ns.appointed_device = Interface.get_obj(device_id)
63
97
 
98
+ def set_clip_trigger_quantization(self, ns, name):
99
+ quantization = PLAY_QUANTIZATIONS.get(str(name), PLAY_QUANTIZATIONS['q_bar'])
100
+ ns.clip_trigger_quantization = quantization
101
+
102
+ def set_midi_recording_quantization(self, ns, name):
103
+ quantization = REC_QUANTIZATIONS.get(str(name), REC_QUANTIZATIONS['rec_q_no_q'])
104
+ ns.midi_recording_quantization = quantization
105
+
64
106
  def safe_stop_playing(self, ns):
65
107
  if self.song.is_playing:
66
108
  self.song.stop_playing()
@@ -17,6 +17,8 @@ class Track(Interface):
17
17
  return {
18
18
  "id": track_id,
19
19
  "name": track.name,
20
+ "solo": track.solo,
21
+ "mute": track.mute,
20
22
  "color": track.color,
21
23
  "color_index": track.color_index,
22
24
  "is_foldable": track.is_foldable,
@@ -1 +1 @@
1
- version = "3.3.4"
1
+ version = "3.4.0"
package/ns/scene.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { Ableton } from "..";
2
2
  import { Namespace } from ".";
3
3
  import { ClipSlot, RawClipSlot } from "./clip-slot";
4
+ import { Color } from "../util/color";
4
5
  export interface GettableProperties {
5
6
  clip_slots: RawClipSlot[];
6
7
  color: number;
@@ -11,6 +12,7 @@ export interface GettableProperties {
11
12
  tempo: number;
12
13
  }
13
14
  export interface TransformedProperties {
15
+ color: Color;
14
16
  clip_slots: ClipSlot[];
15
17
  }
16
18
  export interface SettableProperties {
package/ns/scene.js CHANGED
@@ -3,12 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Scene = void 0;
4
4
  const _1 = require(".");
5
5
  const clip_slot_1 = require("./clip-slot");
6
+ const color_1 = require("../util/color");
6
7
  class Scene extends _1.Namespace {
7
8
  raw;
8
9
  constructor(ableton, raw) {
9
10
  super(ableton, "scene", raw.id);
10
11
  this.raw = raw;
11
12
  this.transformers = {
13
+ color: (c) => new color_1.Color(c),
12
14
  clip_slots: (clip_slots) => clip_slots.map((c) => new clip_slot_1.ClipSlot(this.ableton, c)),
13
15
  };
14
16
  this.cachedProps = {
package/ns/song.d.ts CHANGED
@@ -156,20 +156,20 @@ export declare enum TimeFormat {
156
156
  Smpte30Drop = 5
157
157
  }
158
158
  export declare enum Quantization {
159
- q_2_bars = "q_2_bars",
160
- q_4_bars = "q_4_bars",
161
159
  q_8_bars = "q_8_bars",
160
+ q_4_bars = "q_4_bars",
161
+ q_2_bars = "q_2_bars",
162
162
  q_bar = "q_bar",
163
- q_eight = "q_eight",
164
- q_eight_triplet = "q_eight_triplet",
165
163
  q_half = "q_half",
166
164
  q_half_triplet = "q_half_triplet",
167
- q_no_q = "q_no_q",
168
165
  q_quarter = "q_quarter",
169
166
  q_quarter_triplet = "q_quarter_triplet",
167
+ q_eight = "q_eight",
168
+ q_eight_triplet = "q_eight_triplet",
170
169
  q_sixtenth = "q_sixtenth",
171
170
  q_sixtenth_triplet = "q_sixtenth_triplet",
172
- q_thirtytwoth = "q_thirtytwoth"
171
+ q_thirtytwoth = "q_thirtytwoth",
172
+ q_no_q = "q_no_q"
173
173
  }
174
174
  export declare enum RecordingQuantization {
175
175
  rec_q_eight = "rec_q_eight",
@@ -187,10 +187,10 @@ export declare class Song extends Namespace<GettableProperties, TransformedPrope
187
187
  view: SongView;
188
188
  beginUndoStep(): Promise<any>;
189
189
  continuePlaying(): Promise<any>;
190
- createAudioTrack(index?: number): Promise<any>;
191
- createMidiTrack(index?: number): Promise<any>;
192
- createReturnTrack(): Promise<any>;
193
- createScene(index?: number): Promise<any>;
190
+ createAudioTrack(index?: number): Promise<Track>;
191
+ createMidiTrack(index?: number): Promise<Track>;
192
+ createReturnTrack(): Promise<Track>;
193
+ createScene(index?: number): Promise<Scene>;
194
194
  deleteReturnTrack(index: number): Promise<any>;
195
195
  deleteScene(index: number): Promise<any>;
196
196
  deleteTrack(index: number): Promise<any>;
package/ns/song.js CHANGED
@@ -17,20 +17,20 @@ var TimeFormat;
17
17
  })(TimeFormat || (exports.TimeFormat = TimeFormat = {}));
18
18
  var Quantization;
19
19
  (function (Quantization) {
20
- Quantization["q_2_bars"] = "q_2_bars";
21
- Quantization["q_4_bars"] = "q_4_bars";
22
20
  Quantization["q_8_bars"] = "q_8_bars";
21
+ Quantization["q_4_bars"] = "q_4_bars";
22
+ Quantization["q_2_bars"] = "q_2_bars";
23
23
  Quantization["q_bar"] = "q_bar";
24
- Quantization["q_eight"] = "q_eight";
25
- Quantization["q_eight_triplet"] = "q_eight_triplet";
26
24
  Quantization["q_half"] = "q_half";
27
25
  Quantization["q_half_triplet"] = "q_half_triplet";
28
- Quantization["q_no_q"] = "q_no_q";
29
26
  Quantization["q_quarter"] = "q_quarter";
30
27
  Quantization["q_quarter_triplet"] = "q_quarter_triplet";
28
+ Quantization["q_eight"] = "q_eight";
29
+ Quantization["q_eight_triplet"] = "q_eight_triplet";
31
30
  Quantization["q_sixtenth"] = "q_sixtenth";
32
31
  Quantization["q_sixtenth_triplet"] = "q_sixtenth_triplet";
33
32
  Quantization["q_thirtytwoth"] = "q_thirtytwoth";
33
+ Quantization["q_no_q"] = "q_no_q";
34
34
  })(Quantization || (exports.Quantization = Quantization = {}));
35
35
  var RecordingQuantization;
36
36
  (function (RecordingQuantization) {
@@ -71,17 +71,21 @@ class Song extends _1.Namespace {
71
71
  async continuePlaying() {
72
72
  return this.sendCommand("continue_playing");
73
73
  }
74
- async createAudioTrack(index) {
75
- return this.sendCommand("create_audio_track", { index });
74
+ async createAudioTrack(index = -1) {
75
+ const result = await this.sendCommand("create_audio_track", { index });
76
+ return new track_1.Track(this.ableton, result);
76
77
  }
77
- async createMidiTrack(index) {
78
- return this.sendCommand("create_midi_track", { index });
78
+ async createMidiTrack(index = -1) {
79
+ const result = await this.sendCommand("create_midi_track", { index });
80
+ return new track_1.Track(this.ableton, result);
79
81
  }
80
82
  async createReturnTrack() {
81
- return this.sendCommand("create_return_track");
83
+ const result = await this.sendCommand("create_return_track");
84
+ return new track_1.Track(this.ableton, result);
82
85
  }
83
- async createScene(index) {
84
- return this.sendCommand("create_scene", [index]);
86
+ async createScene(index = -1) {
87
+ const result = await this.sendCommand("create_scene", { index });
88
+ return new scene_1.Scene(this.ableton, result);
85
89
  }
86
90
  async deleteReturnTrack(index) {
87
91
  return this.sendCommand("delete_return_track", [index]);
package/ns/track.d.ts CHANGED
@@ -147,6 +147,8 @@ export interface RawTrack {
147
147
  color_index: number;
148
148
  is_foldable: boolean;
149
149
  is_grouped: boolean;
150
+ mute: boolean;
151
+ solo: boolean;
150
152
  }
151
153
  export declare class Track extends Namespace<GettableProperties, TransformedProperties, SettableProperties, ObservableProperties> {
152
154
  raw: RawTrack;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ableton-js",
3
- "version": "3.3.4",
3
+ "version": "3.4.0",
4
4
  "description": "Control Ableton Live from Node",
5
5
  "main": "index.js",
6
6
  "author": "Leo Bernard <admin@leolabs.org>",