best way to create a DAW-like timeline
I’ve been working a lot this month to build a solid timeline that I could use to add sounds to a movie in a project involving teenagers. (I know it could sounds like I’m reinventing the wheel but in this case, first my movie is assynchronous – played with a bicycle, second It could be useful for a lot of other projects)
Here’s I how I’ve planed it (try to explain clearly)
- Got a bpatcher named Timeline where the mouse position is tracked. its offset will follow the playhead.
- Got an abstraction named audio_clip which handles 3 arguments for clip number (incrementing each time a new clip is created) – color (depending on which track the file is dropped in) – and label (name of the audio file). this abstraction is – nearly – just a background color, a message box for label and a function object for mixing purpose.
- when a file is dropped on the timeline first I write in a coll named "project" a list with number of the clip, track number, filepath, in point, out point, breackpoint list of the function and other infos like loop statut 0/1…
- then I use some scripting to draw a bpatcher with Audio_clip on the timeline.
- I then fill two jit.matrix :
1- one is named "timeline 2 char
2- the second one is named "zoom 4 char 200" : for each clip numbers (200 maximum) it handles the 4 patching_rect numbers. so zooming is easy with a "jit.op @op * pass * pass" – uzi and scripting (while zooming, I’ve got to update the function length and domain too).
while the timeline matrix tell me which clip the cursor is over, the zoom matrix can tell me where are its beginning and its end.
this allows me to act differently if I click at the beginning, into the "body" or at the end of a clip. So I can move a clip, expand or reduce it’s length from it’s beginning or from it’s end. each time updating the "audio_clip" bpatcher patching_rect attribute, and then, at mouse up, the "project" coll – the "timeline" matrix and the "zoom" matrix.
here, I’m using aka.mouse to change the cursor appearance depending on the location of the cursor.
so far, it seems to work pretty well.
the overlapping problem was tricky. each time a file is dropped or a clip is moved or expanded, got to detect if other clips are overlapped (this is done watching into the "timeline" matrix) and then, some times, overlapped clips have to be reduced or removed … while some part of the "timeline" matrix just got to be freed…
this morning I woke up and thought :
a great part of my patch’s structure depends on the length of the movie I’m using.
What if I want to use it just with sound ? I will have to imagine a process to copy the timeline matrix in a temporary matrix while expanding… pffffff
allready thought about how I could edit a few clip at once ?
well, did not go thru but seems possible. got to think about a "selection" process. something that draw a transparent clear grey panel over the timeline…
my program this morning : trying to figure out how to implement an undo process. hummmmm….. let’s see….
and you, maxers, how will you structure this project ?
what do you think about my options ?
(oh, by the way, I don’t know anything – I tried but it seems to really challenge the limits of my brain capacity – about java).
I don’t have max 6 yet, but if you do maybe the dict objects might help to create and manage the complicated data structures you need in making a multitrack/multi-media-item timeline, rather than using coll? I’d imagine it would be useful for saving undo states too.
unfortunately, I don’t have Max6 yet, and will have to wait a few.