Closed jeffgca closed 1 month ago
Hey! First off, this project is amazing, thank you so much for doing all this heavy lifting, this is huge.
I think there's a mix-up with this ternary statement:
https://github.com/ricardomatias/ableton-live/blob/master/lib/Clip.ts#L524
constructor(ableton: AbletonLive, public raw: RawClip, path?: string) { super(ableton, 'clip', path ?? raw.path); this._id = parseInt(raw.id, 10); this._name = raw.name; this._type = raw.is_audio_clip ? ClipType.Midi : ClipType.Audio; this._length = raw.length; this.childrenTransformers = { clipView: () => new ClipView(this.ableton), }; }
Shouldn't this:
this._type = raw.is_audio_clip ? ClipType.Midi : ClipType.Audio;
be instead:
this._type = raw.is_audio_clip ? ClipType.Audio : ClipType.Midi;
Currently when I run this code:
import _ from 'lodash-es' import { AbletonLive } from 'ableton-live' import WebSocket, { WebSocketServer } from 'ws' const live = new AbletonLive() const main = async () => { try { await live.connect() const tracks = await live.song.children('tracks') _.each(tracks, async (track) => { console.log(track.type, track.name) const clips = await track.getClips() console.log( _.map(clips, (clip) => { return [clip.type, clip.name] }), ) }) // const clips = await tracks[0].getClips() // const notes = await clips[0].getNotes() // notes.forEach((note) => console.log(note.pitch)) } catch (error) { console.error(error) } } main()
I get this output:
➜ m4l node index.js [AbletonLive] Listening on 127.0.0.1/ableton-live:9001 midi 1-MIDI audio 2-AUDIO CLIP [ [ 'audio', 'MIDI CLIP' ] ] [ [ 'midi', 'AUDIO CLIP' ] ]
This is my Ableton set:
Thanks for the effort, merged!
Closed via #30
Hey! First off, this project is amazing, thank you so much for doing all this heavy lifting, this is huge.
I think there's a mix-up with this ternary statement:
https://github.com/ricardomatias/ableton-live/blob/master/lib/Clip.ts#L524
Shouldn't this:
this._type = raw.is_audio_clip ? ClipType.Midi : ClipType.Audio;
be instead:
this._type = raw.is_audio_clip ? ClipType.Audio : ClipType.Midi;
Currently when I run this code:
I get this output:
This is my Ableton set: