Pre-purchase: can M4L do this? (pythonic pseudocode)

Questions and discussion about building and using Max for Live devices
Post Reply
TmTmClb
Posts: 2
Joined: Thu Aug 08, 2019 11:35 am

Pre-purchase: can M4L do this? (pythonic pseudocode)

Post by TmTmClb » Thu Aug 08, 2019 12:00 pm

Hi, Ableton newbie here (Live Standard).

In studio track production, the workflow of "record in session view, jam with MIDI clips, create scenes, order them, then record that to arrangement for finishing" does not work when you use external instruments ONLY and they are monotimbral, some used repeatedly for several different sounds/tracks. You need to record audio clips in the session view to free the synth(s) for another sound/track.

I still would like to create scenes then record them in the arrangement, then do a lot of work there (MIDI automation, FX ), but I don't want to use "audio to MIDI" for several reasons. I have the original MIDI clips, so I thought about Max for Live (which I've only skimmed the doc). Here is a non-debugged pythonic "pseudocode" of what I'd like to do to conform MIDI tracks in the arrangement based on audio tracks. Is it feasible with M4L (and proper syntax, of course) ?

Code: Select all

## All the MIDI clips are parked on track 0, muted. It's the only MIDI track. The others are audio tracks.
## The arrangement playback uses audio clips only. The sample in each audio clip was recorded from one of the track 0 MIDI clips, sent to one of several external instruments.
## The goal is to create MIDI tracks targeting the original external instruments, with the exact same arrangement (same time positions and lengths) of MIDI clips as their audio counterparts.
## Both corresponding clips in each pair have the same name, except that the MIDI clip name starts with "M", and the audio clip name starts with "A".
## Clips naming scheme: A/M + instrument + patch + counter. "instrument" = 6 alphanumerical characters


audio_tracks = []

for t in arranger.tracks:
	if t.id == 0:
		MIDI_clips = [t.clips]				# create list of MIDI clips
	else:
		audio_tracks.append(t)				# create list of audio tracks

for t in audio_tracks:
	first_loop = 1
	for audio_clip in t.clips:
		target_clip_name = 'M' + audio_clip.name[1:]	# replace 'A' by 'M'
		for MIDI_clip in MIDI_clips:
			if (MIDI_clip.name != '') and (MIDI_clip.name == target_clip_name):
				if first_loop: 
					new_MIDI_track = arranger.create_MIDI_track(target_clip_name[1:7], MIDI channel, I/O)	# create MIDI track with instrument name etc. M4L 'create track' function?
					first_loop = 0
				MIDI_clip.length = audio_clip.length
				new_MIDI_track.clips.append(MIDI_clip, audio_clip.time)
				target_clip_name = ''			# skip rest of MIDI clip list
				break						# look up next audio clip
I hope I'm not asking too much... Python people should be able to read this code in a minute or two, and I really need to know before I buy Max for Live.
.

S4racen
Posts: 5169
Joined: Fri Aug 24, 2007 4:08 pm
Location: Dunstable
Contact:

Re: Pre-purchase: can M4L do this? (pythonic pseudocode)

Post by S4racen » Thu Aug 08, 2019 1:10 pm

Hi, for what you can achieve via MAxforLive you should check out the Live Object Model....

From reading partially what you're trying to do I'd suggest it's possibly beyond the realms of what's possible...

Cheers
D

TmTmClb
Posts: 2
Joined: Thu Aug 08, 2019 11:35 am

Re: Pre-purchase: can M4L do this? (pythonic pseudocode)

Post by TmTmClb » Fri Aug 09, 2019 12:02 pm

S4racen wrote:
Thu Aug 08, 2019 1:10 pm
Hi, for what you can achieve via MAxforLive you should check out the Live Object Model....

From reading partially what you're trying to do I'd suggest it's possibly beyond the realms of what's possible...
Thanks,
I did take a quick look at the LOM, and the objects and parameters seem to be there, but it wasn't enough to convince me that it would let me do what I want in Javascript, especially
- Iterate through lists (arranger tracks, MIDI and audio clips)
- Create new MIDI tracks
- Copy clips from one track to another, move them, change their names and lengths
- ...
I'd also like to avoid OOP as much as possible, because I never did it in JS (in Python yes). I don't want to spend more time with JS than strictly necessary).

Anybody else?

ShelLuser
Posts: 3607
Joined: Sun Dec 06, 2009 10:26 pm
Location: Wageningen, Netherlands

Re: Pre-purchase: can M4L do this? (pythonic pseudocode)

Post by ShelLuser » Sat Aug 24, 2019 8:43 am

TmTmClb wrote:
Fri Aug 09, 2019 12:02 pm
I did take a quick look at the LOM, and the objects and parameters seem to be there, but it wasn't enough to convince me that it would let me do what I want in Javascript, especially
- Iterate through lists (arranger tracks, MIDI and audio clips)
- Create new MIDI tracks
- Copy clips from one track to another, move them, change their names and lengths
- ...
Creating midi tracks won't be an issue, just check the functions of the Song class; you'll want create_midi_track. Copying clips is also a possibility it seems: I spotted the duplicate_clip_to function in the ClipSlot class, so that should be doable too. Moving clips... not so much it seems, you'll have to select, duplicate and then remove the original. Doable, but it'll be a challenge to select the right clip(s).

I'm very much impressed that my LOM Navigator M4l device still works pretty good in Live 10 but I really need to update its user interface :)
With kind regards,

Peter

Using the Big Trio: Live 10 Suite + Push, Max8 / M4l and Reason 10
Blog: SynthFan

Post Reply