Patent Publication Number: US-2019180785-A1

Title: Audio Authoring and Compositing

Description:
INCORPORATION BY REFERENCE; DISCLAIMER 
     Each of the following applications are hereby incorporated by reference: application Ser. No. 15/283,133 filed on Sep. 30, 2016; application No. 62/235,552 filed on Sep. 30, 2015; application No. 62/235,548 filed on Sep. 30, 2015. The Applicant hereby rescinds any disclaimer of claim scope in the parent applications or the prosecution history thereof and advises the USPTO that the claims in this application may be broader than any claim in the parent applications. 
    
    
     BACKGROUND 
     With the proliferation of digital cameras and mobile devices with digital cameras, people today have more digital content than ever before. As such, the need for tools for presenting and viewing this digital content has never been greater. Unfortunately, many of the tools today require users to manually organize their content. Also, many of these editing tools require users to manually select their content for editing and to manually edit their content. Because of this manual approach, most digital content simply resides in vast digital media libraries waiting for the rare occasion that they can be manually discovered, and in even rarer occasions, painstakingly edited to be part of composite presentations. 
     SUMMARY 
     Some embodiments provide a media compositing method with several novel features. In some embodiments, this method is performed by an application that executes on a computing device that stores media content pieces (e.g., videos, still images, etc.), and/or that has access through a network to media content pieces (MCPs) stored on other computing devices. The method of some embodiments performs an automated process that (1) analyzes the MCPs (e.g., analyzes the content and/or metadata of the MCPs) to define one or more MCP groups, and (2) produces a user interface (UI) layout that identifies the defined MCP groups as groups for which the method can display composite presentations (e.g., video presentations). 
     To define the MCP groups, the method of some embodiments uses one or more media grouping templates (templates). A template in some embodiment is defined by reference to a set of media matching attributes. The method compares a template&#39;s attribute set with the content and/or metadata of the MCPs in order to identify MCPs that match the template attributes. When a sufficient number of MCPs match the attribute set of a template, the method of some embodiments defines a template instance by reference to the matching MCPs. 
     In some embodiments, the method can define multiple template instances for a template. For instance, in some embodiments, the templates include (1) location-bounded templates (e.g., videos and/or photos captured within a region with a particular radius), (2) time-bounded templates (e.g., videos and/or photos captured within a particular time range and/or date range), (3) time-bounded and location-bounded templates (e.g., mornings at a beach), (4) content-defined templates (e.g., videos and/or photos containing smiles), and (5) user-metadata based templates (e.g., MCPs from albums created by the user, MCPs shared by a user with others, MCPs having particular user-defined metadata tags, etc.). 
     In these embodiments, one or more of these templates might result in multiple template instances. For example, a time and location-bounded template might be defined in terms of (1) a time range tuple specifying 12 pm to 4 pm, (2) a day range tuple specifying Sunday, and (3) a location tuple specifying a region that is not associated with the home or work location of a user of the device executing the application. For this template, the method might identify multiple template instances that include different sets of MCPs that are captured at different locations on Sunday afternoons, with different template instances corresponding to different regions. In some embodiments, the time-bounded attributes require the MCPs to be captured within a certain temporal range of each other (e.g., all MCPs captured from 12 pm-4 pm on Saturdays). 
     After defining multiple template instances, the method in some embodiments generates a UI layout that includes an arrangement of a set of summary panes for some or all of the template instances. in some embodiments, the UI layout concurrently displays the summary panes of only a subset of the defined template instances. For example, in some embodiments, the method computes a score for each defined template instance, ranks the defined template instances based on the generated scores, and then generates the UI layout based on the rankings. In some embodiments, the UI layout concurrently shows summary panes for only a certain number of the highest-ranking template instances. In other embodiments, the UI layout concurrently show summary panes for only template instance with generated scores that exceed a certain minimum threshold. The method in some of these embodiments provide controls for allowing a user to view summary panes for oilier defined template instances that the method does not initially display with other summary panes in the generated UI layout. 
     In different embodiments, the method generates the scores for the template instances differently. In some embodiments, a template instance&#39;s score is based on (1) contextual attributes that relate to the time at which the UI layout is being generated and/or displayed, and (2) quality and/or quantity attributes that relate to quality and/or quantity of the MCPs of the template instance. Different contextual attributes can be used in different embodiments. Examples of contextual attributes include (1) time, (2) location of the device, (3) location of future calendared events stored on, or accessible by, the device, (4) locations derived from electronic tickets stored on the device, etc. 
     In some embodiments, the contextual attributes are used to derive template-instance scores in order to identify template instances that would be relevant (interesting) to a user (e.g., at the time that the generated UI layout will be displayed). For instance, in some embodiments, the method can identify a future location of the device&#39;s user from the time and location of an event scheduled in a calendar application, or specified by an electronic ticket application, executing on the device. As the time approaches to the time of the calendared or ticketed event, the method increases the score of a template instance that is associated with the location of the event based on an assumption that the user would want to see MCPs previously captured at that location. 
     As mentioned above, each template instance&#39;s score in some embodiments also depends on the quality and/or quantity attributes of the MCPs of the instance. Some embodiments account for quantity of MCPs in an instance based on an assumption that a larger quantity signifies a higher level of interest in template instance. For example, a template instance that has a lot of photographs in one location on one particular day would typically signify that at an interesting event took place at that location on that particular day and the user would hence be more interested in seeing the photos form that event. 
     However, in some embodiments, the method discards duplicative or nearly duplicative MCPs (e.g., keeps only one photo when multiple identical or nearly identical photos exist) from a template instance or before their inclusion in the template instance because often having multiple such photos does not lead to an interesting composite presentation. On the other hand, the method in some cases maintains multiple photos from a burst-mode sequence so that the composite presentation can provide interesting burst-mode photo treatments. In some embodiments, the method also discards certain MCPs that are deemed not to be interesting (e.g., pictures of receipts, screenshot photos, etc.) or not to be useful (e.g., very blurry photos, etc.). These MCPs are filtered out in some embodiments before the template instances are created. In other words, these MCPs are never associated with template instances in some embodiments. 
     In some embodiments, each template instance&#39;s score accounts for the quality of the instance&#39;s MCPs based on an assumption that template instances with better content will result in better-generated composite presentations and thereby in composite presentations that are more interesting to the viewer. Different embodiments score the MCPs based on different criteria. For instance, some embodiments generate an intrinsic score for an MCP based on one or more of the following MCP attributes and/or metadata: focus, blur, exposure, camera motion, voice content, face content, user input and/or behavior (e.g., user tags, user&#39;s inclusion in albums, user sharing with others, etc.). Some embodiments also score specialty MCP types (e.g., burst-mode photos, slow-motion videos, time-lapsed videos, etc.) higher than other MCP types (e.g., still photographs). Some embodiments also score MCPs that are captured at locations that are not associated with the device user&#39;s home or work higher than MCPs captured at home or work. 
     In some embodiments, the method also computes an extrinsic score for each MCP in a template instance that quantify the temporal and visual distances between two successive MCPs in a presentation order, which define how the MCPs are to be presented in the composite presentation of the template instance. The method then uses this score to define an order for selecting a subset of the MCPs for the composite presentation. For instance, some embodiments use the computed extrinsic scores along with the computed MCP intrinsic scores to select highest scoring MCPs (i.e., best quality MCPs) that provide the most visually unique combination of MCPs. The extrinsic score in some embodiments is a time-and-difference distance between neighboring MCPs in the presentation order. In some embodiments, the time-and-difference distance is a weighted aggregation (e.g., sum) of a time distance and a difference distance between the two MCPs. 
     As mentioned above, the method in some embodiments generates the arrangement of the summary panes for some of the generated template instances based on the scores computed for the template instances. The summary panes display information about the template instances. In some embodiments, a template instance&#39;s summary pane includes one or more thumbnails of one or more MCPs of the instance, and a title. Some embodiments generate the thumbnails from the highest scoring MCPs of the instances. Some embodiments also derive the title for an instance&#39;s pane from MCP attributes (e.g., MCP metadata such as location, or MCP content such as smiles, etc.) that associates the MCPs into one template instance. 
     After a user selects the summary pane for a template instance, the method in some embodiments generates the definition of the composite presentation, and then renders the composite presentation from this definition. In some embodiments, the presentation definition includes the identity of the instance&#39;s MCPs that are included in the presentation, the presentation order for the included MCPs, and the list of edit operations (e.g., transition operations, special effects, etc.) that are to be performed to generate the composite presentations from the MCPs. 
     In some embodiments, the method generates some or all of the MCPs that are included in a template instance&#39;s composite presentation from the MCPs of the template instance. For instance, multiple MCPs of the template instance can be still photos. For some or all of these still photos, the method generates a video clip in the composite generation by specifying a Ken Burns effect for each of these photos. Also, from a video clip MCP of a template instance, the method can extract one or more video clips to include in the composite presentation. Similarly, from an MCP that is a burst-mode sequence, the method can extract one or more still photos of the sequence and/or one or more Ken-Burns type video clips for one or more of the still photos of the sequence. Many other examples of deriving the composite-presentation MCPs from a template instance&#39;s MCPs exist. 
     Instead of defining the composite presentation for a template instance after a user selects the summary pane for the template instance in the UI layout, the method of some embodiments defines the composite presentation before the UI layout is generated. In some of these embodiments, the method generates a score for each defined composite presentation, and then uses the generated scores for all of the defined composite presentations to define and arrange the UI layout For instance, in some embodiments, the method uses the generated composite-presentation scores to identify the subset of composite presentations that should initially be concurrently represented on the UI layout, and to identify the order of summary panes for these composite presentations on the UI layout. 
     In some of these embodiments, the composite presentations are rendered after the user selects their respective summary panes on the UI layout. Other embodiments render the composite presentations before generating the UI layout. One of ordinary skill will realize that other embodiments perform these operations in different sequences. For instance, some embodiments define a portion of a composite presentation before the UI layout is generated, and then generate the rest of the definition of the composite presentation after the UI layout is generated. 
     The composite presentation generation of some embodiments has several novel features. For instance, the method of some embodiments generates composite presentations by selecting a blueprint for the composite presentation. In some embodiments, the blueprint describes the desired transitions, effects, edit styles (including pace of the edits), etc. Blueprint can also specify the desired type of presentation, which can then influence the type of MCPs included or emphasized in the composite presentation. For example, one blueprint might specify highlights as the desired type of presentation, while another blueprint might specify retrospective as the desired type. For highlights, the method&#39;s composite generation would select the best MCPs that are representative of the MCPs of the template instance. For retrospectives, the method&#39;s composite generation would might select the MCPs that are not necessarily of the whole set of MCPs of the template instance. 
     For a template instance, the blueprint in some embodiments is associated with the template of the template instance. Alternatively, or conjunctively, the blueprint in some embodiments is associated with a mood that the method automatically picks for the composite presentation. In some embodiments, the mood is an adjective that describes the type of composite presentation. Examples of mood include extreme, club, epic, uplifting, happy, gentle, chill, sentimental, dreamy, etc. In some embodiments, the method automatically picks the mood for a composite presentation based on the type and/or duration of media in the template instance, content analysis on this media (e.g., detection of high motion video), and detected user-mood preferences. Also, in some embodiments, the method allows the mood to be modified for a composite presentation. In some of these embodiments, the method re-generates the composite presentation for a template instance after the user modifies the mood for a generated composite presentation. Some embodiments allow the user to view the mood for a template instance represented by a summary pane on the generated UI layout. If the user modifies the mood for the represented template instance, the method generates the composite presentation for this template instance based on the user change. 
     The composite presentation generation of some embodiments automatically specifies the duration for the composite presentation. In some of these embodiments, the method specifies the duration based on the amount of high-quality, unique content in the template instance and the blueprint. For instance, after defining the above-described selection order based on the time-and-difference distance values, the method selects the MCPs in the template instance up to the position in the selection order where two successive MCPs are within a certain distance of each other (e.g., within 0.25 unit time-and-difference distance of each other). The blueprint&#39;s specified parameters (e.g., parameters specifying ideal duration for the MCPs) along with the selected MCPs determine the desired duration of the composite presentation. In some embodiments, the blueprint might also specify how the MCPs should be selected, e.g., by specifying selection criteria (such as degree of difference), specifying the manner for computing the time-and-difference distance values are calculated, etc. 
     The method of some embodiments allows the user to modify a presentation duration that the method initially computes. For instance, in some embodiments, the user can modify the presentation duration after being presented with a rendered composited presentation. Alternatively, or conjunctively, the method allows the user to view and modify the presentation duration in the generated UI layout (e.g., as part of the information provided by a template instance&#39;s summary pane), without having to first view the rendered composite presentation with this duration. 
     In some embodiments, the composite presentation generation has novel media compositing operations, novel song compositing operations, and novel interplay between the media and song compositing operations. The method of some embodiments uses a constrained solver that generates the composite presentation definition by exploring different manners for combining the MCPs of a template instance based on (1) a set of constraints that limit the exploration of the solution space, and (2) metadata tags that specify content characteristics (e.g., for a photo, or for ranges of frames of a video). Examples of constraints include duration constraints (e.g., ideal, minimum and maximum durations for each MCP type) and positional constraints (e.g., one MCP type cannot be placed next to another MCP type). 
     In exploring the solution space to find an optimal solution that satisfies the constraint and meets one or more optimization criteria, the constrained solver in some embodiments preferentially costs solutions that use MCPs that are highly ranked in the selection order. Also, in finding the optimal solution, constrained solver in some embodiments (1) identifies different portions of the template instance MCPs (e.g., different segments of the video clips, etc.) based on the metadata tag ranges, and (2) explores solutions based on these identified portions. 
     In some embodiments, the solver discards MCP segments from an identified solution that are smaller than a certain size. The solver in some embodiments also explores whether an MCP segment in an identified solution should be split into smaller segments in order to delete one or more ranges in the middle of the segment. In some of these embodiments, the solver restarts its search for a solution after deleting smaller resulting segments and/or splitting MCPs into smaller segments. 
     In some embodiments, the media compositor also specifies Ken-Burns effects for still photos in order to define video presentations for the still photos. The media compositor in some embodiments specifies special treatments for other types of image content (such as burst-mode sequences, slow-motion sequences, time-lapse sequences, etc.) that result in the generation of a video sequence for this type of content. By only using extracted segments of MCPs and by specifying special treatment effects for photos and other type of content, the media compositor generates MCPs for the composite presentation from the MCPs of the template instance. 
     As mentioned above, the media compositor in some embodiments computes the ideal duration for the composite presentation based on the selection order that it defines using the time-and-difference distance values. In some of these embodiments, the media compositor provides the ideal duration to the song compositor. The song compositor then generates a composite song presentation (to accompany the composite media presentation) that has the ideal duration. 
     In some embodiments, the song compositor generates the composite song presentation by identifying a sequence of audio segments and defining edits and transitions between each pair of audio segments in the sequence. The audio segments are part of one song in some embodiments. In other embodiments, they can be part of two or more songs. These audio segments are referred to as body segments to signify that they are parts of another song. In some embodiments, body segments are assigned a priority value and a section, and within each of their respective sections, are assigned an order. These values are then used to insert the body segments in a dynamically composited song. 
     In some embodiments, the song compositor also selects an ending segment from several candidate ending segments for the composite song presentation. The song compositor in some of these embodiments can also select a starting segment from several starting segments for the composite song presentation. An editor defines the body, starting and ending segments from one or more songs by using the audio authoring tools of some embodiments. 
     To ensure that the segments are properly arranged in the composite song presentation, the song compositor of some embodiments uses (1) insertion rules that specify how audio segments can be inserted in an audio sequence, and (2) sequence rules that ensure that the inserted audio segments can neighbor other segments in the sequence. in some embodiments, the song compositor iteratively inserts body segments into a candidate audio sequence by stepping through the body segments based on their assigned priority values, and inserting the body segments into the candidate audio sequence based on their duration and the insertion rules. In some embodiments, the insertion rules specify (1) that a body segment that belongs to a subsequent second section cannot be inserted before a body segment that belong to an earlier first section, and (2) that body segments that belong to the same section be placed next to each other based on their order in their respective section. 
     The song compositor of some embodiments then uses the sequence rules to validate the body segment arrangement in the audio sequence. This validation entails ensuring that the placement of no two neighboring segments in the audio sequence violates a sequence rule. When a neighboring segment pair violates a sequence rule, the compositor removes the segment with the lower priority to cure the violation in some embodiments. 
     In some embodiments, these sequence rules are embedded in a jump table that has multiple rows and columns, and each audio segment is associated with one row and one column. In some embodiments, each starting or ending segment is also associated with at least one row or one column. Each jump table cell then specifies whether the two segments that are assigned to that cell&#39;s row and column are allowed to follow each other in an order specified by the row and column assignment. An editor uses the authoring tool of some embodiments to specify the jump table and its attributes for the body, starting and ending segments that the editor defines. At runtime, the song compositor then uses this jump table to automatically define a song for a duration specified by the media compositor. 
     In some embodiments, each jump table cell also specifies whether a transition is required at the transition between the two segments. The jump table also specifies (1) a priority value for each body segment and (2) an identifier for indicating whether the body segment can be sliced during the song compositing. In some embodiments, the song compositor inserts body segments in a presentation order based on the segment priority values and based on a set of insertion rules, until a particular duration is reached. This duration in some embodiments is the ideal duration provided by the media compositor minus the duration of the longest ending segment. After arranging the body segments, the song compositor adds an ending segment, and when the audio sequence is still shorter than the desired duration, a starting segment if one segment is available that would not make the sequence duration exceed the desired duration. 
     In some embodiments, the media compositor and song compositor have several novel interactions. The first is the media compositor automatically generates a desired presentation duration, and the song compositor dynamically generates a definition of a composite song presentation based on this duration, as described above. Another novel interaction is that in some embodiments the song compositor provides the location of the ending segment, and/or location of a stinger in the ending segment, to the media compositor so that the media compositor can align the start of the last video or image segment with the ending segment or stinger in this segment. In some embodiments, the video and song compositors also synchronize fade-out effects that they apply to their respective presentations with each other. 
     Also, in some embodiments, the media compositor performs post-processing to align edit points in the composite media to certain audibly discernable transition locations in the composite song. These locations in some embodiments include location of beats, locations of onsets, locations of segment boundaries, and location of ending-segment stinger in the composite definition. An audio onset corresponds to the beginning of a musical note at which the amplitude rises from zero to a peak. A beat is the rhythmic movement at which the song is played. 
     In some embodiments, the media compositor directs the song compositor to identify one or more audibly discernable transition locations in the composite song near a particular time in the presentation. In some of these embodiments, the song compositor returns (1) a list of such location that are near the particular time, and (2) a priority for each of these locations. The media compositor then uses this list of transitions to align an edit point in the composite media&#39;s definition to a transition location based the specified priority value(s) and the degree to which the media edit has to be moved to reach the transition location. 
     In some embodiments, the compositing application that implements the above-described method executes on a mobile device. This application only requires a user of a mobile device to capture photos and videos at different events. Once the user has captured photos and videos, the application can automatically group the content that was captured together, associate the group content with a location or event, present each defined group to the user, and to display a composite presentation for the group upon the user&#39;s selection of the group. For instance, when a user goes to an event (e.g., baseball game) and takes pictures and videos at the stadium, the mobile device can automatically group these pictures and videos, create a composite presentation from them, and provide the composite presentation to the user after the user leaves the game. Similarly, photos and videos from vacations (e.g., trips to Hawaii) can be grouped together, put in a composite presentation, and provided to users after their vacations ends. 
    
    
     
       BRIEF DESCRIPTION OF DRAWINGS 
       The novel features of the invention are set forth in the appended claims. However, for purposes of explanation, several embodiments of the invention are set forth in the following figures. 
         FIG. 1  conceptually illustrates a media-compositing application of some embodiments. 
         FIG. 2  illustrates an example of a layout generated by a layout generator. 
         FIG. 3  illustrates an example of arranging template instance summary panes in some embodiments. 
         FIG. 4  illustrates a process of operations performed by the media-compositing application of  FIG. 1 . 
         FIG. 5  illustrates an example of the media-compositing application user interface of some embodiments. 
         FIG. 6  illustrates an example of allowing a user to change content for the composite presentation. 
         FIG. 7  illustrates an authoring process for dividing a song into multiple body segments, one or more starting segments, and one or more ending segments. 
         FIG. 8  illustrates multiple operational stages of a user interface of an authoring application of some embodiments. 
         FIG. 9  illustrates directing the authoring application to generate and display a jump table of some embodiments. 
         FIG. 10  illustrates an example of a, jump table of  FIG. 9  in more detail. 
         FIG. 11  illustrates a process that defines a jump table of the authoring application. 
         FIG. 12  illustrates architecture of a song compositor of some embodiments. 
         FIG. 13  illustrates a process that the song compositor of  FIG. 12  performs in some embodiments to dynamically composite a song presentation. 
         FIG. 14  illustrates a process for iteratively inserting body segments into a presentation sequence. 
         FIG. 15  illustrates an example of operation of the sequence generator and sequence validator of  FIG. 12 . 
         FIG. 16  is an example of an architecture of such a mobile computing device. 
         FIG. 17  conceptually illustrates another example of an electronic system with which some embodiments of the invention are implemented. 
     
    
    
     DETAILED DESCRIPTION 
     In the following detailed description of the invention, numerous details, examples, and embodiments of the invention are set forth and described. However, it will be clear and apparent to one skilled in the art that the invention is not limited to the embodiments set forth and that the invention may be practiced without some of the specific details and examples discussed. 
     Some embodiments provide a media-compositing application that automatically organizes media content pieces (MCPs) that are stored on, and/or accessible by, a device into different groups, and produces a user interface (UI) layout that identifies the defined MCP groups as groups for which the application can display composite presentations (e.g., video presentations). In some embodiments, the application groups the MCPs by performing an automated process that is not triggered by a user request to group the MCPs. To group the MCPs, the application&#39;s automated process uses multiple grouping templates (templates), with each specifying a set of media attributes that are to be compared with the MCP content and/or attributes to group the MCPs. 
     In some embodiments, the generated UI layout includes summary panes for some, but not all, of the defined MCP groups. For instance, in some embodiments, the UI layout at any given time includes summary panes for the MCP groups that would be contextually most relevant to a user of the device at that time. However, in some embodiments, the application provides controls for allowing a user to view summary panes for other defined MCP groups that the application does not initially display with other summary panes in the generated UI layout. When a user selects a summary pane for an MCP group, the application displays a composite presentation that it generates from the group&#39;s MCPs without receiving any other user input. 
       FIG. 1  illustrates one such media-compositing application  100 . This application executes on a device that stores MCPs (e.g., videos, still images, etc.), and/or has access through a network to MCPs stored on other computing devices. This device is a computer (e.g., server, desktop or laptop), or a mobile device (such as a smartphone or tablet). As shown, this application includes a collection generator  105 , a layout generator  110 , a context identifier  115 , a scoring engine  120 , a media compositor  125 , a song compositor  130 , and a rendering engine  135 . To perform their operations, these modules of the application access media content storage  140 , template storage  145 , media collection storage  150 , audio storage  155 , composite-video storage  160 , composite-audio storage  165 . 
     In some embodiments, the collection generator  105  and layout generator  110  perform an automated process that (1) analyzes the MCPs (e.g., analyzes the content and/or metadata of the MCPs) to define one or more MCP groups, and (2) produces a user interface (UI) layout that identifies the defined MCP groups as groups for which the application can display composite presentations (e.g., video presentations). In performing their operations, these modules in some embodiments use the scoring engine  120  and the context identifier  115 . 
     More specifically, to define the MCP groups, the collection generator  105  in some embodiments uses one or more media grouping templates (templates) in the template storage  145  to try to associate each MCP stored in the media content storage  140  with one or more template instances. In some embodiments, the media content storage  140  is a data storage (e.g., a database) of the device that executes the application. In other embodiments, some or all of this storage  140  resides on a separate device (e.g., another computer, server, mobile device, etc.). 
     In some embodiments, a template in the template storage  145  is defined by reference to a set of media matching attributes. The collection generator  105  compares a template&#39;s attribute set with the content and/or metadata of the MCPs in order to identify MCPs that match the template attributes. When a sufficient number of MCPs match the attribute set of a template, the application of some embodiments defines a template instance by reference to the matching MCPs, and stores this template instance in the media collection storage  150 . In some embodiments, a template instance includes a list of MCP identifiers that identify the MCP&#39;s that matched the instance&#39;s template attribute set. 
     In some embodiments, the collection generator  105  can define multiple template instances for a template. For instance, in some embodiments, the templates include (1) location-bounded templates (e.g., videos and/or photos captured within a region with a particular radius), (2) time-bounded templates (e.g., videos and/or photos captured within a particular time range and/or date range), (3) time-bounded and location-bounded templates (e.g., mornings at a beach), (4) content-defined templates (e.g., videos and/or photos containing smiles), and (5) user-metadata based templates (e.g., MCPs from albums created by the user, MCPs shared by a user with others, MCPs having particular user-defined metadata tags, etc.). 
     The collection generator  105  stores the definition of the template instances that, it generates in the media collection storage  150 . In some embodiments, the generator repeats its grouping operation in order to update the template instance definitions in the media collection storage  150 . For instance, in some embodiments, the generator repeats its grouping operation periodically, e.g., every hour, six hours, twelve hours, twenty four hours, etc. Conjunctively, or alternatively, the generator  150  in some embodiments performs its grouping operation whenever the application opens and/or based on user request. 
     Also, in some embodiments, the collection generator  105  performs its grouping operation each time a new MCP is stored, or a certain number of MCPS are stored, in the media content storage  140 . For example, in some embodiments, the application  100  executes on a mobile device that captures a variety of image content data (e.g., still photos, burst-mode photos, video clips, etc.). Each time the mobile device captures an MCP (e.g., a photo, a video clip, etc.), the collection generator  105  in some embodiments tries to associate the captured MCP with one or more template instances, provided that the application is running in the foreground or background at that time. 
     Based on template definition, layout generator  110  in sonic embodiments generates UI layouts that identify the defined template instances as MCP groups for which the application can display composite presentations (e.g., video presentations). At any given time, the layout generator  110  of some embodiments generates a UI layout that identifies a subset of the defined template instance that would be contextually relevant to a user of the device at that time. As further described below, this is based on the contextual attributes provided by the context identifier  115  and template instance scores computed by the scoring engine  120 . 
       FIG. 2  illustrates an example of a UI layout  200  generated by the layout generator  110 . In this example, the UI layout is displayed on a display screen of a mobile device  100  that executes the application of some embodiments. Also, this example is illustrated in terms of four stages  202 - 208  that show different aspects of this UI layout presentation. 
     As shown, the UI layout concurrently displays several summary panes  205  for a subset of template instances that are defined at a particular time. Each summary pane  205  displays information about its associated template instance. In this example, a template instance&#39;s summary pane includes a title plus one or more thumbnails of one or more MCPs of the instance. The layout generator  110  in some embodiments derives a summary pane&#39;s (1) title from the attribute set (e.g., MCP metadata such as location, or MCP content such as smiles, etc.) of the pane&#39;s instance, and (2) thumbnails from one or more of the better quality MCPs of the pane&#39;s instance. In some embodiments, the scoring engine  120  generates a score for each MCP to quantify its quality. This scoring will be further described in concurrently filed U.S. Patent Application entitled “Synchronizing Audio and Video Components of an Automatically Generated Audio/Video Presentation,” with Attorney Docket Number APLE.P0633, which is incorporated herein by reference. 
     As further shown, the UI layout  200  has two different display sections  210  and  215 . The first display section  210  displays summary panes for template instances that are deemed to be contextually relevant to a user of the device at that time, while the second display section  215  displays summary panes for different categories of template instances. In this example, two or more template instances belong to one category when they are derived from one media grouping template. Also, in this example, each category is identified by a category heading at the top of the summary panes for the template instances of that category. In this example, the categories are Holidays, Birthdays, Vacations, and Parks. 
     The first and second stages  202  and  204  of  FIG. 2  illustrate that the user can scroll through the summary panes in the first section  210  by performing horizontal drag (left or right) operations, which are enabled by a touch-sensitive display screen of the mobile device  100 . The second and third stages  204  and  206  illustrates that the user can scroll through the summary panes in the second section  215  by performing vertical touch drag (up or down) operations. 
     The third and fourth stages  206  and  208  illustrate that the second display section  215  initially displays summary panes only for the better quality template instances in each category. Specifically, the third stage  206  shows that the user can view all template instances created for a category by selecting a “See More” control  230  that appears above the summary panes for the Holidays category. The fourth stage  208  shows that this selection causes the UI layout to expand the space for the Holidays category to reveal additional summary panes for additional Holidays template instances. 
     Accordingly, in the example illustrated in  FIG. 2 , the UI layout not only provides a first section that displays summary panes for template instances that are deemed to be contextually more relevant than template instances at a given time, but also limits the summary panes displayed in the second section to those that are the best ones in their respective categories. One of ordinary skill will realize that the UI layout of  FIG. 2  is just one exemplary UI layout design. Other embodiments display, arrange, and/or nest the summary panes differently. Also, other embodiments provide different kinds of information for each summary pane. 
     To assess whether one template instance is contextually more relevant than, and/or better than, another one template instance at a particular time, the layout generator has the scoring engine  120  generates a score for each template instance, ranks the template instances based on the generated scores, and then generates the UI layout based on the rankings. In some embodiments, the UI layout concurrently shows summary panes for only a certain number of the highest-ranking template instances, In other embodiments, the UI layout concurrently show summary panes for only template instance with generated scores that exceed a certain minimum threshold. 
     In different embodiments, the scoring engine  120  generates the scores for the template instances differently. In some embodiments, a template instance&#39;s score is based on (1) contextual attributes that relate to the time at which the UI layout is being generated and/or displayed, and (2) quality and/or quantity attributes that relate to quality and/or quantity of the MCPs of the template instance. Different contextual attributes can be used in different embodiments. Examples of contextual attributes include (1) time, (2) location of the device, (3) location of future calendared events stored on, or accessible by, the device, (4) locations derived from electronic tickets stored on the device, etc. 
     In some embodiments, the context identifier  115  periodically collects such contextual attributes from one or more services modules executing on the device. Examples of these service modules include location service modules, such as GPS modules, or other location modules (e.g., frameworks) that generate the location data from multiple location determining services. The service modules also include in some embodiments one or more location prediction engines that formulate predictions about future locations of the device (1) based on events scheduled in a calendar application, or specified by an electronic ticket application, executing on the device, and/or (2) based on past locations of the device (e.g., locations associated with regions in which the device previously stayed more than a threshold amount of time). These services in some embodiments are framework level services. 
     In addition to, or instead of, periodically collecting such contextual attributes periodically, the context identifier  115  in some embodiments collects these attributes on-demand based on requests from the layout generator  110 . The layout generator  110  passes the contextual attributes that it receives to the scoring engine  120 , which then uses these attributes to derive template-instance scores in order to identify template instances that would be relevant (interesting) to a user (e.g., at the time that the generated UI layout will be displayed). 
     For instance, in some embodiments, the application can identify a future location of the device&#39;s user from the time and location of an event scheduled in a calendar application, or specified by an electronic ticket application, executing on the device. As the time approaches to the time of the calendared or ticketed event, the application increases the score of a template instance that is associated with the location of the event based on an assumption that the user would want to see MCPs previously captured at that location. 
       FIG. 3  illustrates an example that illustrates how the layout generator in some embodiments arranges the template instance summary panes based on their contextual relevance. This example is illustrated in three operational stages  302 - 306  of the mobile device  100 . The first and second stages  302  and  304  illustrate the user scrolling through the UI layout  200  that has multiple summary panes in the first and second display sections  210  and  15 . The second stage  304  illustrates that one of summary pane categories towards the bottom of the second display section  210  is a category for vacation, and that one vacation summary pane relates to Maui Spring 2014. The first and second stages  302  and  304  also show that the user is scrolling through the UI layout  200  during these stages in the February of 2015. 
     The third stage  306  illustrates a UI layout  300  that the layout generator generates in April 2015. In this UI layout  300 , the layout generator has moved the Maui Spring 2014 template instance to the first display section  210 , in order to present this collection as one of the featured collections for which it can automatically generate a composite presentation. The layout generator  110  does this in some embodiments because it detects that an electronic ticketing application executing on the device has an electronic ticket to Hawaii in the near future, and then determines that it has previously defined a template instance that includes the media content from the last Maui trip. 
     In this example, the contextual attributes that the layout generator passes to the scoring engine, and that the scoring engine uses in its soring calculation to generate a high score for the Maui collection, include the destination location of the ticket and the date of the trip. In some embodiments, only the destination location or only the date from the ticket might be enough to move the Maui collection up the generated UI layout. 
     Also, in the example of  FIG. 3 , the Maui collection moves from the second display section to the first display section. In some embodiments, the layout generator emphasizes a summary pane by just moving it up in the second display section, or by relocating it to a different position in the first display section. In addition, the layout generator can redefine the UI layout at a much greater frequency than that illustrated in  FIG. 3 . For example, in some embodiments, the layout generator refreshes the UI layout based on a predicted destination of the device as the device is traveling to a new destination (e.g., in a car). Alternatively, or conjunctively, the layout generator in some embodiments refreshes the UI layout when a user leaves a region, in which the user captured a number of MCPs with the camera of the mobile device that executes the application of some embodiments. 
     In some embodiments, each template instance&#39;s score can depend on the quality and/or quantity attributes of the MCPs of the instance. In some embodiments, the scoring engine  120  generates a score for a template instance that accounts for quantity of MCPs in the instance based on an assumption that a larger quantity signifies a higher level of interest in the template instance. For example, a template instance that has a lot of photographs in one location on one particular day would typically signify that at an interesting event took place at that location on that particular day and the user would hence be more interested in seeing the photos form that event. 
     However, in some embodiments, the collection generator  105  discards duplicative or nearly duplicative MCPs (e.g., keeps only one photo when multiple identical or nearly identical photos exist) from a template instance or before their inclusion in the template instance because often having multiple such photos does not lead to an interesting composite presentation. On the other hand, the collection generator  105  in some cases maintains multiple photos from a burst-mode sequence so that the composite presentation can provide interesting burst-mode photo treatments. In some embodiments, the collection generator  105  also discards certain MCPs that are deemed not to be interesting (e.g., pictures of receipts, screenshot photos, etc.) or not to be useful (e.g., very blurry photos, etc.). These MCPs are filtered out in some embodiments before the template instances are created. In other words, these MCPs are never associated with template instances in some embodiments. 
     In some embodiments, each template instance&#39;s score accounts for the quality of the instance&#39;s MCPs based on an assumption that template instances with better content will result in better-generated composite presentations and thereby in composite presentations that are more interesting to the viewer. In different embodiments, the scoring engine  120  scores the MCPs based on different criteria. For instance, in some embodiments, the scoring engine generates an intrinsic score for an MCP based on one or more of the following MCP attributes and/or metadata: focus, blur, exposure, camera motion, voice content, face content, user input and/or behavior (e.g., user tags, user&#39;s inclusion in albums, user sharing with others, etc.). Some embodiments also score specialty MCP types (e.g., burst-mode photos, slow-motion videos, time-lapsed videos, etc.) higher than other MCP types (e.g., still photographs). Some embodiments also score MCPs that are captured at locations that are not associated with the device user&#39;s home or work higher than MCPs captured at home or work. 
     In some embodiments, the collection generator  105  uses the MCP intrinsic scores to filter out some of the MCPs before or after their inclusion in a template instance. In these embodiments, the collection generator  105  uses the scoring engine  120  to compute these scores. The scoring engine in some embodiments includes different scoring modules for computing different types of scores, e.g., MCP scores, context-based instance scores, quality-based instance scores, quantity-based instance scores, etc. In some embodiments, one or more of these scores (e.g., MCP scores) are provided by one or more framework services of the device. Alternatively, or conjunctively, the framework services in some embodiments provide metadata tags that characterized different characteristics of the MCPs, and these metadata tags are used to compute some or all of the scores. 
     In addition to the intrinsic scores, the scoring engine  120  computes extrinsic scores in some embodiments that express a quality of one MCP by reference to one or more other MCPs. For instance, in some embodiments, the scoring engine  120  computes extrinsic scores in order to define a selection order for the MCPs in a template instance. In some of these embodiments, the computed extrinsic scores quantify the temporal and visual distances between two successive MCPs in the selection order, as further described in the above-incorporated patent application. 
     When a user selects the summary pane for a template instance, the layout generator in some embodiments directs the media compositor  125  and the song compositor  130  to generate, for the selected template instance, the definitions of media and song presentations, which the rendering engine  135  renders to produce a composite presentation for display. The media compositor  125  in some embodiments generates the definition of the composite media presentation from the MCPs of the template instance. 
     In generating this definition, the media compositor uses the selection order that was computed by using the extrinsic scores, to select only a subset of the MCPs of the template instance. For instance, after the selection order is defined based on the time-and-difference distance values, the video-compositor of some embodiments selects the MCPs in the template instance up to the position in the selection order where two successive MCPs are within a certain distance of each other (e.g., within 0.25 unit time-and-difference distance of each other). 
     In some embodiments, this selection then allows the media compositor to automatically define the duration of the composite presentation without any user input. For instance, some embodiments compute the duration as the sum of the ideal duration of each MCP in the subset of selected MCPs. In some embodiments, each MCP has an MCP type, and the MCP&#39;s ideal duration is the ideal duration that is defined by its type. The computation of the ideal presentation duration will be further described in the above-incorporated patent application. 
     In other embodiments, the media compositor selects a duration for the composite presentation, and then uses the selection order to select the N highest ranking MCPs according to the selection order. Thus, these embodiments use the duration is used to identify the MCPs to select according to the selection order, while other embodiments use the selection order to define the presentation duration. However, given that both of these approaches in some embodiments rely on a selection that is based on computed time-and-difference distance scores, they ensure that the MCPs that remain in the template instance are the best quality MCPs that provide a visually unique combination of MCPs. 
     In some embodiments, the definition of the composite media presentation includes the identity of the instance&#39;s MCPs that are included in the presentation, the presentation order for the included MCPs, and the list of edit operations (e.g., transition operations, special effects, etc.) that are to be performed to generate the composite presentations from the MCPs. In some embodiments, the MCPs of the composite media presentation can be identical to the MCPs of the template instance, or they can be MCPs that the media compositor derives from the instance&#39;s MCPs. 
     For instance, multiple MCPs of the template instance can be still photos. For some or all of these still photos, the media compositor  125  generates a video clip in the composite generation by specifying a Ken Burns effect for each of these photos. Also, from a video clip MCP of a template instance, the application can extract one or more video clips to include in the composite presentation. Similarly, from an MCP that is a burst-mode sequence, the media compositor  125  can extract one or more still photos of the sequence and/or one or more Ken-Burns type video clips for one or more of the still photos of the sequence. Many other examples of deriving the composite-presentation MCPs from a template instance&#39;s MCPs exist. 
     In some embodiments, the media compositor generates composite media definition by selecting a blueprint for the composite presentation. In some embodiments, the blueprint describes the desired transitions, effects, edit styles (including pace of the edits), etc. Blueprint can also specify the desired type of presentation, which can then influence the type of MCPs included or emphasized in the composite presentation. For example, one blueprint might specify highlights as the desired type of presentation, while another blueprint might specify retrospective as the desired type. For highlights, the collection generator  105  or media compositor  125  in some embodiments selects the best MCPs that are representative of the MCPs of the template instance. For retrospectives, the collection generator  105  or media compositor  125  selects in some embodiments the MCPs that are not necessarily of the whole set of MCPs of the template instance. 
     In some embodiments, the blueprint also determines the duration of the composite presentation that the media compositor  125  automatically generates. In some of these embodiments, the application specifies the duration based on the amount of high-quality, unique content in the template instance and the blueprint. For instance, in some embodiments, the blueprint&#39;s specified parameters (e.g., parameters specifying ideal duration for the MCPs) along with the MCPs that are selected based on the selection order, determine the desired duration of the composite presentation. In some embodiments, the blueprint might also specify other parameter, such as the way the extrinsic scores are computed, etc. 
     For a template instance, the blueprint in some embodiments is associated with the template of the template instance. Alternatively, or conjunctively, the blueprint in some embodiments is associated with a mood that the application (e.g., the collection generator  105  or media compositor  125 ) automatically picks for the composite presentation. In some embodiments, the mood is an adjective that describes the type of composite presentation. Examples of mood include extreme, club, epic, uplifting, happy, gentle, chill, sentimental, dreamy, etc. 
     In some embodiments, the application  100  (e.g., the collection generator  105  or media compositor  125 ) automatically picks the mood for a composite presentation based on the type and/or duration of media in the template instance, content analysis on this media (e.g., detection of high motion video), and detected user-mood preferences. Also, in some embodiments, the application allows the mood to be modified for a composite presentation. In some of these embodiments, the video and song compositors  125  and  130  re-generate the composite presentation for a template instance after the user modifies the mood for a generated composite presentation. Some embodiments allow the user to view the mood for a template instance represented by a summary pane on the generated UI layout. If the user modifies the mood for the represented template instance, the video and song compositors  125  and  130  generate the composite presentation for this template instance based on the user change. 
     The application of some embodiments also allows the user to modify a presentation duration that the application initially computes. For instance, in some embodiments, the user can modify the presentation duration after being presented with a rendered composited presentation. Alternatively, or conjunctively, the application allows the user to view and modify the presentation duration in the generated UI layout (e.g., as part of the information provided by an instance&#39;s summary pane), without having to first view the rendered composite presentation with this duration. Some embodiments also allow the user to modify the MCPs that the collection generator  105  automatically selects for a template instance. In some embodiments, the user can modify the MCPs before and/or after viewing a composite presentation that the video and song compositors  125  and  1350  generate for a template instance that the collection generator  105  generates. 
     In some embodiments, the media compositor  125  includes a novel constrained solver that generates a composite media definition by exploring different manners for combining the MCPs of a template instance based on (1) a set of constraints that limit the exploration of the solution space, and (2) metadata tags that specify content characteristics (e.g., for a photo, or for ranges of frames of a video). Examples of constraints include duration constraints (e.g., ideal, minimum and maximum durations for each MCP type) and positional constraints (e.g., one MCP type cannot be placed next to another MCP type). 
     In exploring the solution space to find an optimal solution that satisfies the constraint and meets one or more optimization criteria, the constrained solver in some embodiments preferentially costs solutions that use MCPs that are highly ranked in the selection order. Also, in finding the optimal solution, constrained solver in some embodiments (1) identifies different portions of the template instance MCPs (e.g., different segments of the video clips, etc.) based on the metadata tag ranges, and (2) explores solutions based on these identified portions. 
     In some embodiments, the solver discards MCP segments from an identified solution that are smaller than a certain size. The solver in some embodiments also explores whether an MCP segment in an identified solution should be split into smaller segments in order to delete one or more ranges in the middle of the segment (e.g., ranges that undesirable content, such as ranges with excessive camera motion, etc., and/or ranges that do not have desirable content, such as ranges that do contain any faces). In some of these embodiments, the solver restarts its search for a solution after deleting smaller resulting segments and/or splitting MCPs into smaller segments. 
     In some embodiments, the media compositor also specifies Ken-Burns effects for still photos in order to define video presentations for the still photos. The media compositor in some embodiments specifies special treatments for other types of image content (such as burst-mode sequences, slow-motion sequences, time-lapse sequences, etc.) that result in the generation of a video sequence for this type of content. By only using extracted segments of MCPs and by specifying special treatment effects for photos and other type of content, the media compositor generates MCPs for the composite presentation from the MCPs of the template instance. 
     In some embodiments, the media compositor provides the desired duration of the composite presentation to the song compositor, after this duration from the selection order and/or blueprint. Based on the received desired duration, the song compositor then dynamically defines a composite song presentation to accompany the composite media presentation of the media compositor. This song compositor dynamically defines the song presentation to include several audio segments in a particular sequence, and a set of edits and transitions between the audio segments in the sequence. In some embodiments, the audio segments are part of one song, while in other embodiments, they can be part of two or more songs. 
     These audio segments are referred to as body segments to signify that they are parts of another song. In some embodiments, the song compositor also selects an ending segment from several candidate ending segments for the composite song presentation. The song compositor in some of these embodiments can also select a starting segment from several starting segments for the composite song presentation. An editor defines the body, starting and ending segments from one or more songs by using the audio authoring tools of some embodiments. 
     To ensure that the segments are properly arranged in the composite song presentation, the song compositor of some embodiments uses (1) insertion rules that specify how audio segments can be inserted in an audio sequence, and (2) sequence rules for ensuring that the inserted audio segments can neighbor other segments in the sequence. In some embodiments, the insertion rules are defined by reference to audio sections to which each body segments belong. Specifically, in some embodiments, the audio segment editor associates each body segment to one section in a set of sequentially specified sections, and specifies a particular sequential ordering of the body segments in each section. The insertion rules of some embodiments specify that a body segment that belongs to a subsequent second section cannot be inserted before a body segment that belong to an earlier first section. The insertion rules also require that body segments that belong to the same section be placed next to each other based on their order in their respective section. 
     In some embodiments, these sequence rules are embedded in a jump table that has multiple rows and columns, and each body segment is associated with one row and one column. In some embodiments, each starting or ending segment is also associated with at least one row or one column. Each jump table cell then specifies whether the two segments that are assigned to that cell&#39;s row and column are allowed to follow each other in an order specified by the row and column assignment. An editor uses the authoring tool of some embodiments to specify the jump table and its attributes for the body, starting and ending segments that the editor defines. At runtime, the song compositor then uses this jump table to automatically define a song for a duration specified by the media compositor. 
     In some embodiments, each jump table cell also specifies whether a transition is required at the transition between the two segments. The jump table in some embodiments also specifies (1) a priority value for each body segment and (2) an identifier for indicating whether the body segment can be sliced during the song compositing. In some embodiments, the song compositor inserts body segments in a presentation order based on the segment priority values and based on a set of insertion rules, until a particular duration is reached. This duration in some embodiments is the ideal duration provided by the media compositor minus the duration of the longest ending segment. After arranging the body segments, the song compositor adds an ending segment, and when the audio sequence is still shorter than the desired duration, a starting segment if one segment is available that would not make the sequence duration exceed the desired duration. 
     In some embodiments, the media compositor  125  and song compositor  130  have several novel interactions. The first is the media compositor automatically generates a desired presentation duration, and the song compositor dynamically generates a definition of a composite song presentation based on this duration, as described above. Another novel interaction is that in some embodiments the song compositor provides the location of the ending segment, and/or location of a stinger in the ending segment, to the media compositor so that the media compositor can align the start of the last video or image segment with the ending segment or stinger in this segment. In some embodiments, the video and song compositors also synchronize fade-out effects that they apply to their respective presentations with each other. 
     Also, in some embodiments, the media compositor performs post-processing to align edit points in the composite media to certain audibly discernable transition locations in the composite song. These locations in some embodiments include location of beats, locations of onsets, locations of segment boundaries, and location of ending-segment stinger in the composite definition. An audio onset corresponds to the beginning of a musical note at which the amplitude rises from zero to a peak. A beat is the rhythmic movement at which the song is played. An ending segment stinger is a short piece of music in the ending segment that signifies the start of the end of the ending segment. 
     In some embodiments, the media compositor directs the song compositor to identify one or more audibly discernable transition locations in the composite song near a particular time in the presentation. In some of these embodiments, the song compositor returns (1) a list of such location that are near the particular time, and (2) a priority for each of these locations. The media compositor then uses this list of transitions to align an edit point in the composite media&#39;s definition to a transition location based the specified priority value(s) and the degree to which the media edit has to be moved to reach the transition location. 
     After the media compositor generates a definition of the composite media presentation, and the song compositor generates a definition of the composite song presentation, these modules store the generated media and song presentation definitions respectively in the media and song definition storages  160  and  165 . Some embodiments use one storage (e.g., one file) to store both of these definitions. From the storages  160  and  165 , the rendering engine  135  retrieves the media and song presentation definitions and generates a rendered composite presentation from these definitions. In some embodiments, the rendering engine  135  stores the rendered composite presentation in a file that it stores on the device, or outputs the rendered composite presentation to a frame buffer of the device for display. 
     One of ordinary skill will realize that the application  100  in other embodiments operates differently than described above. For instance, instead of defining the composite presentation for a template instance after a user selects the summary pane for the template instance in the UI layout, the application of some embodiments defines the composite presentation before the UI layout is generated. In some of these embodiments, the application generates a score for each defined composite presentation, and then uses the generated scores for all of the defined composite presentations to define and arrange the UI layout. For instance, in some embodiments, the application uses the generated composite-presentation scores to identify the subset of composite presentations that should initially be concurrently represented on the UI layout, and to identify the order of summary panes for these composite presentations on the UI layout. Alternatively, some embodiments render the composite presentations before generating the UI layout. Still other embodiments define a portion of a composite presentation before the UI layout is generated, and then generate the rest of the definition of the composite presentation after the UI layout is generated. 
     The operation of the application  100  will now be described by reference to a process  400  of  FIG. 4 . The sequence of the operations of the process  400  just presents one manner that the modules of this application operate in some embodiments. One of ordinary skill will realize that, as described above and further below, other embodiments have these modules perform these operations in a different sequence, and/or have some of the operations performed by other modules. As such, the description of process  400  is meant to provide only one exemplary manner for implementing some embodiments of the invention. 
     The process  400  starts by the collection generator  105  defining and/or updating template instances that group MCPs based on their similar attributes. As mentioned above, the collection generator  105  in some embodiments uses one or more media grouping templates (templates) in the template storage  145  to associate the MCPs stored in the media content storage  140  with one or more template instances. In some embodiments, the generator  105  also tries to associate MCPs stored remotely (e.g., on remote storages of other devices) with one or more template instances. 
     As further described in the above-incorporated patent application, the collection generator  105  compares a template&#39;s attribute set with the content and/or metadata of the MCPs in order to identify MCPs that match the template attributes. After identifying the MCP collection for a template instance, the collection generator  105  discards undesirable MCPs from a template instance. Undesirable MCPs include poor quality MCPs (e.g., MCPs with too much camera motion, etc.), uninteresting MCPs (e.g., pictures of receipts, screenshot photos, etc.), and duplicative or nearly duplicative MCPs. Duplicative MCPs (e.g., multiple nearly identical or very similar photos) often do not lead to an interesting composite presentation. However, in some cases, duplicative MCPs (e.g., photos from a burst-mode sequence) are not filtered. Also, in some embodiments, some or all of the undesirable MCPs (e.g., the uninteresting MCPs, or the MCPs with poor image characteristics) are filtered out before the collection generator  105  defines the template instances. 
     Next, at  410 , the process  400  has the scoring engine  120  generate a score for each template instance that is defined or updated at  405 . In different embodiments, the scoring engine  120  generates the scores for the template instances differently. In some embodiments, a template instance&#39;s score is a weighted combination (e.g., weighted sum) of (1) a contextual score that is based on contextual attributes relating to the time at which the UI layout is being generated and/or displayed, (2) a quality score that quantifies the quality of the MCPs of the template instance, and (3) a quantity score that quantifies the quantity of the MCPs of the template instance. The computation of these scores was described above, and is further described in the above-incorporated patent application. 
     At  415 , the process  400  defines a title and selects one or more thumbnails for each defined or updated template instance. Some embodiments use the title and thumbnail(s) for the template instance&#39;s summary pane in the generated UI layout. In some embodiments, the layout generator  110  derives a template instance&#39;s title from the attribute set (e.g., MCP metadata such as location, or MCP content such as smiles, etc.) of the instance. Also, in some embodiments, the layout generator derives the instance&#39;s thumbnails from one or more of the better quality MCPs of the instance. Some embodiments compute a score that quantifies the intrinsic quality of an MCP as further described in the above-incorporated patent application. 
     Next, at  420 , the layout generator  110  in some embodiments generates UI layouts that identify the defined template instances as MCP groups for which the application can display composite presentations (e.g., video presentations). At any given time, the layout generator  110  of some embodiments generates a UI layout that identifies a subset of the defined template instance that would be contextually relevant to a user of the device at that time. 
     To arrange the template instance summary panes in the UI layout in a contextually relevant manner, the layout generator  110  in some embodiments uses the template instance scores computed at  410 . For instance, in some embodiments, the layout generator  110  uses the computed template instance scores (1) to sort the template instances, (2) to show the contextually most relevant template instances in the featured, first display section  210  of the UI layout, and (3) to identify the template instances that are to be initially displayed in each template category in the second display section  215  of the UI layout. 
     In some embodiments, the contextually most relevant template instances for the first display section are the template instances that have the highest composite computed score (e.g., are the template instances with the highest weighted sum score computed from the composite score, quality score, and quantity score). The template instances that are then initially displayed for each template category are the template instances that are highest composite scoring template instances in their category that are not displayed in the first display section. 
     Other embodiments use the computed scores in a different manner to define the arrangement of the summary panes in the UI layout. For instance, in some embodiments, the contextual and quality scores are used to identify the arrangement of summary panes in the first display section  210 , while the quality and quantity scores are used to identify the arrangement of the initially displayed summary panes in the second display section  215 . Other embodiments use these or other scores in other manners to define the UI layout. 
     At  425 , a user selects a summary pane for a template instance, In response, the layout generator in some embodiments directs (at  425 ) the media compositor  125  to generate, for the selected template instance, the definition of the composite presentation. In some embodiments, the media compositor  125  generates the definition of the composite media presentation from the MCPs of the template instance, while directing the song compositor to generate the definition of the associated composite song presentation. 
     To generate the definition of the media composite presentation, the media compositor  125  automatically picks (at  425 ) the mood for the composite presentation based on the type and/or duration of media in the template instance, content analysis on this media (e.g., detection of high motion video), and detected user-mood preferences. After picking the mood, the media compositor picks (at  425 ) a blueprint for the composite presentation based on the selected mood. As described above, the blueprint in some embodiments describes the desired transitions, effects, edit styles (including pace of the edits), the desired type of presentation, etc. 
     At  425 , the media compositor defines the selection order for selecting the MCPs of the selected template instance. As described above and further described in the above-incorporated patent application, the media compositor defines the selection order by having the scoring engine compute extrinsic scores that quantify the time-and-difference distance values between the MCPs of the template instance. 
     Next, at  430 , the media compositor computes a desired duration for the composite presentation based on the selection order and the blue print. For instance, the video-compositor of some embodiments selects a subset of the MCPs of the template instance up to the position in the selection order where two successive MCPs are within a certain time-and-difference distance of each other (e.g., within 0.25 unit time-and-difference distance of each other). In conjunction with the blueprint, which specifies the type of desired edits (e.g., fast transition edits, or slow transition edits), the selection of the subset of MCPs based on the selection order, allows the media compositor to automatically define the duration of the composite presentation without any user input. 
     For instance, some embodiments compute the duration as the sum of the ideal duration of each MCP in the subset of selected MCPs. In some embodiments, each MCP has an MCP type, and the MCP&#39;s ideal duration is the ideal duration that is defined by its type. In some of these embodiments, the ideal duration for an MCP type is adjusted based on the blueprint that is selected. Other embodiments automatically define the duration of the composite presentation differently. For instance, in some embodiments, the media compositor does not account for the blueprint in computing the desired duration, and just computes the desired duration of the composite presentation based on the subset of MCPs that it picked by using the selection order. 
     After computing (at  430 ) the desired duration of the composite presentation, the media compositor  125  in some embodiments (at  435 ) provides this duration to the song compositor  130  and directs this compositor to dynamically generate the definition of a song presentation that has this duration. As mentioned above, and further described below, the song compositor generates this definition by exploring different combinations of body segments from one or more songs, along with different possible starting and ending segments. 
     Next, at  435 , the media compositor dynamically generates the definition of a media presentation that has the desired duration. As mentioned above, the media compositor  125  uses a constrained solver that generates a composite media definition by exploring different manners for combining the MCPs of a template instance based on (1) a set of constraints that limit the exploration of the solution space, and (2) metadata tags that specify content characteristics (e.g., for a photo, or for ranges of frames of a video). 
     In exploring the solution space to find an optimal solution that satisfies the constraint and meets one or more optimization criteria, the constrained solver in some embodiments (1) identifies different portions of the template instance MCPs (e.g., different segments of the video clips, etc.) based on the metadata tag ranges, and (2) explores solutions based on these identified portions. Also, the media compositor specifies Ken-Burns effects and other special treatments for still photos and other MCPs in order to generate aesthetically pleasing media presentations. 
     At  435 , the video and song compositor  125  and  130  have several interactions in order to synchronize the defined media and song presentations. For instance, as mentioned above, the media compositor obtains the location of the ending segment, and/or the stinger in this ending segment, from the song compositor in order to align the start of the last video or image segment with this ending segment or stinger. Also, in some embodiments, the media compositor obtains from the song compositor the location of any fade-out effect that the song compositor is defining for the end of the song presentation, so that the media compositor can synchronize its video fade-out effect with the audio fade out. In some embodiments, the media compositor can also obtain from the song compositor one or more audibly discernable transition location that are near a particular time in the presentation, so that the media compositor can roll a video edit at this time to coincide with one of obtained locations. 
     After the video and song compositors generate the definitions for the media and song presentations, the rendering engine  135  generates (at  440 ) a rendered composite presentation from these definitions. In some embodiments, the rendering engine  135  outputs the rendered composite presentation to a frame buffer of the device for display. In other embodiments, the rendering engine can store the rendered composite presentation in a file that it stores on the device. 
     Before or after viewing the composite presentation, the application allows a user to modify the composite presentation. For instance, in some embodiments, the user can modify the duration or mood of the composite presentation. Some embodiments also allow the user to change the song that is used for the composite presentation. Similarly, some embodiments allow the user to change the MCPs (e.g., add or delete MCPs) that are used for the composite presentation. 
       FIG. 5  illustrates how the UI of the application of some embodiment represents the machine-selected mood and the machine-generated duration of the composite presentation, and how this UI allows the user to change this presentation and duration. This example is illustrated in four operational stages  502 - 508  of the mobile device  100 . Each of these stages shows a page  500  that displays a viewer  510  in which the composite presentation can be played. This application illustrates this page  500  after finishing a full-screen display of the composite presentation or after the user stops the full-screen composite presentation display. In some embodiments, the user has to select the viewer (e.g., by tapping it) to start a full screen display of the presentation again, or to start a display of this presentation just in the viewer&#39;s window. 
     Each stage also shows a mood slider  515  and a duration slider  520 . Each slider lists a number of candidate slider values that can scroll left and right across the screen in a sliding direction when the user performs a drag operation on the slider. The mood slider lists several mood values (e.g., Happy, Epic, Chill, Gentle, Sentimental, etc.), while the duration slider lists several durations (e.g., 30 seconds, 45 seconds, 60 seconds, etc.). 
     The first stage  502  shows the user performing a drag operation on the mood slider  515 . This stage also shows the machine-selected mood for the composite presentation is happy. The second stage  504  shows the user selecting the Epic mood in order to change the mood of the composite presentation from Happy to Epic. The third stage  506  shows that the presentation mood has been changed to Epic. 
     The third stage  506  also shows the user performing a drag operation on the duration slider  520 . This stage also shows the machine-defined duration for the composite presentation is 30 seconds. The fourth stage  508  shows the user selecting a 60 second duration in order to change the duration of the composite presentation from 30 seconds to 60 seconds. The fourth stage  508  also shows that the presentation duration has been changed to 60 seconds. 
       FIG. 6  illustrates how the UI of the application allows the user to change the content that the application automatically picks for the composite presentation. This example is illustrated in five operational stages  602 - 610  of the mobile device  100 . The first stage  602  is similar to the first stage  502  of  FIG. 5  in that it displays page  500  with the viewer  510 , the mood slider  515  and the duration slider  520 . This page also includes an Edit control  605 . The first stage shows the user&#39;s selection of this control. 
     The second stage  604  shows that in response to the selection of the Edit control  605 , the application displays several edit controls, such as (1) a transition control  650  for modifying one or more machined selected transitions in the composite presentation, (2) a music control  655  for modifying the song that is used to automatically generate a song for the composite presentation, (3) an effects control  660  for modifying one or more machined specified effects for the composite presentation, (4) a title control  665  for modifying one or more machine-generated titles for the composite presentation, and (5) a content control  670  for adding or removing MCPs automatically selected for the composite presentations. 
     Selection of any of these controls would direct the application to present one or more additional controls for effectuating the operation associated with the selected control. In the example illustrated in  FIG. 6 , the selected control is the content control  670 , which is selected in the second stage  604 . 
     The third stage  606  shows that the selection of the content control  670  directs the application to present a page  630  that displays a list of MCPs that the user can select to add or remove MCPs from the composite presentation. On this page, some embodiments display the MCPs that are already included in the composite presentation differently (e.g., with a different shade or with a designation on top) than the MCPs that are not already included in the presentation. 
     The third stage  606  also shows the user selecting a thumbnail of a video clip  635  for addition to the composite presentation. The fourth and fifth stages  608  and  610  then show the composite presentation playing in the viewer  510 . As shown in the fifth stage, the composite presentation now includes content from the selected video clip  635 . 
       FIG. 7  illustrates an authoring process  700  for dividing a song into multiple body segments, one or more starting segments and one or more ending segments. In some embodiments, an editor performs this authoring process  700  before the song compositor uses these segments to dynamically create a song presentation for a particular duration requested by the media compositor. The editor performs this process by using an authoring tool.  FIG. 8  illustrates multiple operational stages of a user interface  800  of an authoring application of some embodiments. The process  700  will be described below by reference to this user interface. 
     As shown in  FIG. 7 , the process  700  starts when the editor selects (at  705 ) a song. The first stage  802  of  FIG. 8  illustrates the user selecting Song 1 from a list  805  through a cursor click operation. In this example, the user interacts with the UI through a cursor and keyboard, but in other embodiments, the editor interacts with the authoring tool through touch input. The second stage  804  of  FIG. 8  illustrates the selected song in a timeline  810 . At  710 , the editor uses a trim tool of the authoring application to divide the selected song into a number of segments. The second stage  804  shows the selection of a trim tool  820 , while the third stage  806  illustrates multiple segments in the timeline after the trim tool has been used to divide the selected songs into these segments. 
     To ensure that the segments are properly arranged in the composite song presentation, two different sets of rules are used in some embodiments. These rules are insertion rules for inserting audio segments in the sequence, and sequence rules for ensuring that the inserted audio segments can neighbor other segments in the sequence. In some embodiments, these sequence rules are embedded in a jump table, which will be further described below. Some embodiments define the insertion rules by reference to the names that are assigned to the song segments. For instance, in some embodiments, each song segment has a number and a letter assigned to it. The number defines the segment&#39;s section number, while the letter is the segment identifier in the section. In these embodiments, the song compositor can place a first audio segment before a second audio segment only if the first audio segment has a section number that is the same or smaller than the second audio segment. 
     Given such insertion rules, the process  700  names (at  715 ) the song segments that it defines at  710 . The third stage  806  shows that after the selected song is divided into several segments, a field  830  opens up below each song segment. An editor can insert the segment&#39;s name in its associated field. The fourth stage  808  shows the segment names ( 1   a,    1   b,    1   c,    2   a,    2   b ,  3   a,    3   b,    3   c ) filled in in their corresponding fields. As shown in this example by segments  1   b,    1   c ,  3   a  and  3   b,  the segments do not need to be sequentially numbered based on their initial position in the selected song. 
     Next, at  715 , the editor inserts (at  720 ) one or more markers in the defined sections to identify location of audibly discernable transitions (e.g., beats). After  720 , the process defines (at  725 ) transition, starting and ending segments. As mentioned above, these segments are segments that the song compositor can optionally add to a composite presentation in some embodiments. In other embodiments, one or more transition, starting and/or ending segments are required. For instance, in some embodiments, a composite song segment has to include an ending segment, while it could optionally include a starting segment. 
     As further described below, the jump table in some embodiments allows the editor to specify whether a transition segment is required when one segment follows another. In some embodiments, transition, starting and ending segments are segments that the editor defines based on portions that the editor extracts from the selected song. In other embodiments, one or more of these segments (e.g., transition segments) are defined by reference to special effects or pre-defined audio content of the authoring tool. 
     At  720 , the editor in some embodiments also specifies one or more markers in the defined starting and ending sections in order to identify locations of audibly discernable transitions. The media compositor can then align an edit point in the composite media presentation with one such identified location in a starting or ending section. One example of such a location is the location of a stinger in an ending segment. In some embodiments, the authoring tool allows the editor to specify a priority for each audibly discernable location that. the editor associates with marker in a body, starting, or ending segment. The media compositor then uses the priority values of the transition locations to select one transition location to align with one of its edit points. 
     After  720 , the process  700  ends. 
     As shown in  FIG. 8 , the UI  800  of this application includes a control  855  for creating a jump table for the audio segments that the editor defines.  FIG. 9  illustrates that the selection of this control  855  directs the authoring application to generate and display a jump table  900  with multiple rows and columns.  FIG. 10  illustrates this jump table  900  with more detail. As shown, each audio segment is associated with one row and one column. 
     As shown in  FIG. 10 , each jump table cell has a Boolean identifier that specifies whether the two segments that are assigned to that cell&#39;s row and column are allowed to follow each other in an order specified by the row and column assignment. In some embodiments, the audio segments defined along the columns are the segments that follow the segments that are defined along the rows. The Boolean identifiers of the cells of the jump table collectively define the sequence rules that specify whether two audio segments can be neighboring segments in the composite song presentation that is defined by the song compositor. In some embodiments, each jump table cell can also have three other parameters, which are a transition parameter, a fade-in parameter, and a fade-out parameter. The transition parameter specifies an optional transition between the two segments of the cell, while the fade-out and fade-in parameters specify how the cell&#39;s row audio segment should fade-out and the cell&#39;s column audio segment should fade-in. 
     As further shown in  FIG. 10 , the jump table also specifies (1) a priority value for each body segment and (2) an identifier for indicating whether the body segment can be sliced during the song compositing. For each body segment, the jump table also specifies the number of bars in the segment. This number is used in some embodiments to predict locations of beats in the segment. in the jump table, the starting segment I is associated with one rows, while each ending segment is associated with a column. These associations of the starting and ending sections allow the jump table to correlate the body segments with one or more starting and ending segments to specify whether the starting segments can precede the body segments and the ending segments can follow the body segments. 
       FIG. 11  conceptually illustrates a process  1100  that defines a jump table of the authoring application of  FIG. 8 . This process starts whenever the editor selects the jump-table creation control  855  in some embodiments. As shown, this process initially displays a jump table that associates each body segment with a row and a column, associates each starting segment with a row and associates each ending segment with a column. 
     The process then performs a series of operations that are conceptually illustrated as operations  1110 - 1135  in order to populate the jump table with the attributes and relationships of the body, starting and ending sections. One of ordinary will realize that the order of the operations in  FIG. 11  is arbitrary, as the editor can perform these operations in any order until the jump table is populated. Also, in the example illustrated in this figure, each operation defines one attribute or one set of relationships completely. Again, one of ordinary shill will realize that the editor can jump around between these operations to define different instances of the attributes and relationships at different times. 
     At  1110 , the editor defines the priority for each body segment in the segment column of the jump table. As further described below, the priority values of body segments are used in some embodiments to specify an order for the body segments that is used to step through the body segments to determine whether they are viable candidate for insertion into the audio sequence based on their duration. The priority values are also used to identify the body segment to remove when two body segments are inserted into the audio sequence in violation of a sequencing rule. 
     At  1115 , the editor specifies in the jump table the divisible indicator that specifies whether each body segment is divisible (i.e., sliceable) into smaller sections. In some embodiments, the jump table also specifies whether an ending segment can be divided into smaller sections. When the song compositor cannot composite a song of a desired duration by using the full body segments, the song compositor in some embodiments tries to determines whether any of the body segments is divisible and if so, tries to add one or more of the parts of the body segments to the song in order to create a song of the desired duration. The song compositor uses the divisible indicator to determine whether it can slice the body segments into smaller pieces. 
     At  1120 , the editor specifies the number of bars in each body segment. In some embodiments, the song compositor uses a body segment&#39;s number of bars to compute a predicted location of a beat in the body segment. As further described below, the song compositor uses the beat location when it needs to compile for the media compositor a list of audibly discernable transition locations that are near a given time. 
     At  1125  and  1130 , the editor specifies the attributes of each jump table cell that is associated with a body segment and another body segment, a starting segment or an ending segment. As mentioned above, each such cell has four attributes, which are (1) a Boolean indicator specifying the propriety of whether the row-associated segment can precede the column-associated segment, (2) a transition indicator specifying whether a transition needs to be defined between these two segments, and (3) fade-in and fade-out parameters specifying how the column-associated segment should fade-in and how the row-associated segment should fade-out. In some embodiments, the transition indicator includes a transition identifier that identifies a particular transition from several pre-defined and/or editor-defined transitions. 
     At  1135 , the process exports the data embedded in the jump table to a data structure that is used by the song compositor at runtime. In some embodiments, this data structure is a JSON (Javascript Object Notation) file. In some embodiments, the process associates the exported jump-table data structure (e.g., JSON file) with the song from which the song segments need to be extracted. In other embodiments, the process associates the jump-table data structure with the extracted song segments, e.g., places the JSON file and the song segments in another file. The song compositor imports the jump-table data structure (e.g., JSON file) whenever it wants to dynamically composite a song. One or more editors perform the processes  700  and  1100  of  FIGS. 7 and 11  multiple times to create multiple sets of song segments and multiple jump-table data structures (e.g., multiple JSON files) for multiple songs. 
     In some embodiments, the jump-table data structure or a parent structure (e.g., a file that contains the JSON file and its associated set of song segments) is associated with a mood, and the song compositor selects the data structure whenever it wants to dynamically composite a song for that mood. Different jump-table data structures can be associated with different moods. In some embodiments, one jump-table data structure can be associated with multiple moods. Alternatively, some embodiments associate one or more moods with a song, and associate the song with a jump-table data structure and the song segments extracted from the songs. 
       FIG. 12  illustrates the song compositor  130  of some embodiments. As shown, this song compositor includes a sequence generator  1205 , a segment sorter  1210 , and a sequence validator  1215 . The sequence generator  1205  serves as the coordinating module of the song compositor in some embodiments. From the media compositor  125 , the sequence generator  1205  receives the desired duration and mood for a song that the song compositor needs to dynamically generate without user input. 
     Based on the received mood, the sequence generator selects a jump-table file and its associated set audio segments that are associated with the received mood. Based on this file, the sequence creates a runtime version of the jump table  1220 , which it, the segment sorter  1210  and sequence validator  1215  use. The sequence generator next directs the segment sorter to define a sorted order for the selected set of audio segments. In response, the segment sorter uses the segment priority values of the jump table  1220  to generate the segment order  1225 . This order lists the audio segments from the highest priority segment to the lowest priority segment. 
     The sequence generator then defines an audio sequence based on the sorted order  1225  and the insertion rules. In some embodiments, this audio sequence is a sequence of just body segments. Also, in some embodiments, the sequence generator defines the duration of this audio sequence as the received desired duration minus the duration of the longest ending segment in the selected song segment set. The sequence generator iteratively inserts body segments into the audio sequence by stepping through the body segments based on their priority values (i.e., based on the sorted order  1225 ). As further described below by reference to  FIGS. 13-15 , the insertion rules that the sequence generator uses as it inserts the body segments in some embodiments, specify (1) that a body segment that belongs to a subsequent second section cannot be inserted before a body segment that belong to an earlier first section, and (2) that body segments that belong to the same section be placed next to each other based on their order in their respective section. 
     After creating a candidate audio sequence  1235 , the sequence generator  1205  then directs the sequence validator  1215  to use the sequence rules of the jump table  1220  to validate the body segment arrangement in the audio sequence. This validation entails ensuring that the placement of no two neighboring segments in the audio sequence violates a sequence rule specified in the jump table. When the validator  1215  detect a neighboring segment pair that violates a sequence rule, the validator removes the segment with the lower priority to cure the violation. 
     When the validator removes one or more segments to cure one or more sequence-rule violations, the sequence generator  1205  again tries to insert body segments in the audio sequence. In such situations, the sequence generator resumes on the sorted order at the position where it left off in its previous iteration. When the sequence generator identifies an audio sequence that does not violate any sequence rule (based on the sequence validator&#39;s assessment), the sequence generator adds an ending segment from the segment set  1230 . In some embodiments, the sequence generator adds the longest ending segment that is compatible with the last body segment in the defined audio sequence. If the audio sequence duration is less than the received desired duration at this stage and the segment set includes a starting segment that is compatible with the first song segment of the sequence, the sequence generator adds this starting segment at the start of the audio sequence. When multiple starting segments are viable, the sequence generator selects the starting segment with the longest duration that does not cause the audio sequence to exceed the desired duration. 
       FIG. 13  illustrates a process  1300  that the song compositor of  FIG. 12  performs in some embodiments to dynamically composite a song presentation. This process starts each time the media compositor directs the song compositor to generate a song presentation of a particular duration. As shown, the process  1300  receives (at  1305 ) the desired duration and a mood for the desired song presentation, form the media compositor. 
     Based on the received mood, the process selects (at  1310 ) a song from which it should dynamically generate the song presentation. In some embodiments, at  1310 , the process selects a jump-table file and its associated set segments that are associated with the received mood. The set of segments include body, starting and ending segments in some embodiments. Next, at  1315 , the process sorts the song segments according to their priority values, which are specified in the jump-table file. In this sort, the song segments that have higher priority values are arranged before the song segments with lower priority values. 
     At  1320 , the process computes an adjusted duration by subtracting the duration of the longest ending segment from the ideal duration received at  1305 . The process uses the adjusted duration to compute a sequence of one or more body segments and any needed transitions between them. The process subtracts the duration of the longest ending segment in order to ensure that there is sufficient time to include an ending segment at the end of the composite song presentation. Other embodiments do not require the composite song presentation to have an ending segment, and in these embodiments, the process does not compute an adjusted duration, and instead uses the received duration to identify the composite song presentation. 
     Next, at  1325 , the process iteratively inserts body segments into a presentation sequence based on the sorted order defined at  1315 . In some of these embodiments, the process steps through the sorted order (and loops back when it reaches the end of the sorted order) to examine viability for inserting the body segments at successive locations in the defined audio sequence. In stepping through this order, the process examines the viability for insertion of a body segment based on the remaining duration of the presentation and the length of the body segment. 
     Also, when the process determines that a body segment can be inserted in the audio sequence, the process inserts the body segment in a location in the audio sequence that comports with the insertion rules. For instance, in some embodiments, the process inserts a body segment that belongs to a subsequent second section after a body segment that belong to an earlier first section. Also, when placing multiple body segments that belong to the same section, the process places the body segments based on their order in their respective section, e.g., when arranging segments  1 A- 1 C, the process first places  1 A, then  1 B, and the  1 C. However, when inserting one body segment several times in the audio sequence, the process will place the subsequent instances of the body segment after body segments are later in the segment order so that the segments can loop. For example, when inserting segment  1 A after previously inserting segments  1 A- 1 C, the process inserts  1 A after  1 C, so that the audio sequence is expressed as  1 A,  1 B,  1 C,  1 A. 
     In some embodiments, the process insert body segments into the audio sequence until the sequence has reached the adjusted duration, or until the process has exhausted choices. To explore all the choices, the process  1300  in some embodiments explores adding sliced portions of the sliceable body segments, when it cannot obtain an audio sequence with the adjusted duration by just adding body segments. The operation  1325  of the process  1300  will be further described below by reference to  FIG. 14 . 
     At  1330 , the process determines whether any of the body segments in the defined audio sequence violate the sequence rules specified in the jump table. In some embodiments, the process  1300  generates a runtime jump table from the jump-table definition in the jump-table file. The process uses this jump table to determine whether any pair of neighboring body segments in the audio sequence violates a sequence prohibition as set out in the jump table. If so, the process removes (at  1335 ) the lower priority body segment of the pair. In some cases, multiple neighboring pairs might violate sequence prohibition(s). In such a case, the process tries to identify (at  1335 ) the lowest priority body segment that upon removal can rectify multiple violations. In other embodiments, the process does not try to identify such body segments, and instead simply solves the neighboring pair violations one pair at a time, by analyzing the violating pairs in a particular order (e.g., from start to end of the audio sequence). 
     After removing (at  1335 ) one or more body segments from the defined audio sequence, the process returns to  1325  to try to insert body segments again in the song presentation. When the process returns to  1325 , the process resumes on the sorted order at the position where it left off in its previous iteration through  1325  before its last transition to  1330 . 
     When the process  1300  determines (at  1330 ) that the defined audio sequence does not violate any sequence rule, the process adds (at  1340 ) one of the ending segments to the audio sequence. In some embodiments, the process  1300  selects the longest ending segment that is compatible with the last body segment in the defined audio sequence. Lastly, at  1345 , the process determines whether the defined audio sequence is still shorter than the received ideal duration. If so, the process determines (at  1345 ) whether any of the starting segments can make the audio sequence reach the ideal duration or get as close as possible. To do this, the starting segment cannot conflict with the first body segment in the audio sequence. When multiple starting segments are viable, the process selects the starting segment with the longest duration that does not cause the audio sequence to exceed the desired duration. After  1345 , the process ends. 
       FIG. 14  illustrates a process  1400  that the process  1300  performs at  1325 . As shown, the process selects (at  1405 ) a segment based on the segment priority values. The first time through  1405 , the process  1400  selects the body segment that is first on the priority-sorted order defined at  1315 . Each subsequent time through  1405 , the process selects the body segment in the sorted order that is after the last body segment that the process selected from the sorted order in its last iteration through  1405 . 
     After selecting a body segment (at  1405 ), the process determines (at  1410 ) whether the addition of the selected body segment to the audio sequence would make the sequence&#39;s duration match the adjusted duration computed at  1320 . In some embodiments, the process accounts for duration of any transition that. would have to be defined by placing the selected body segment. next to the prior segment, whenever it assesses what the duration of the sequence would be upon the addition of a potential candidate segment at  1410  or  1420 . Whether such a transition is needed is defined in the jump table. In some embodiments, some or all of the transitions are not added to the audio sequence in a way that would increase the sequence&#39;s overall duration, as such a transition would be applied to the end of the previous segment and/or the start of the next segment. 
     When the process determines (at  1410 ) that the addition of the selected body segment to the audio sequence would make the sequence&#39;s duration match the adjusted duration, the process adds (at  1415 ) the selected body segment to the audio sequence in a location in the audio sequence that comports with the insertion rules. For instance, in some embodiments, the process inserts a body segment that belongs to a subsequent second section after a body segment that belongs to an earlier first section. Also, when placing multiple body segments that belong to the same section, the process places the body segments based on their order in their respective section. For example, when arranging segments  1 A- 1 C, the process first places  1 A, then  1 B, and the  1 C. However, when inserting one body segment several times in the audio sequence, the process will place the subsequent instances of the body segment after body segments are later in the segment order so that the segments can loop. For example, when inserting segment  1 A after previously inserting segments  1 A- 1 C, the process inserts  1 A after  1 C, so that the audio sequence is expressed as  1 A,  1 B,  1 C,  1 A. After  1415 , the process ends. 
     When the process determines (at  1410 ) that the addition of the selected body segment to the audio sequence would not make the sequence&#39;s duration match the adjusted duration, the process determines (at  1415 ) whether the addition of the selected body segment to the defined audio sequence would cause the audio sequence to exceed the adjusted duration. When no body segment has been added to the audio sequence, the process determines whether the duration of the selected body segment exceeds the adjusted duration. When one or more body segments have been previously added to the audio sequence, the process determines (at  1410 ) whether the length of the selected body segment exceeds the adjusted duration minus the duration of body segments currently assigned to the audio sequence. 
     When the process determines (at  1420 ) that the addition of the selected body segment to the defined audio sequence would not cause the audio sequence to exceed the adjusted duration, the process adds (at  1425 ) the selected body segment to the audio sequence in a location in the audio sequence that comports with the insertion rules, as described above. After  1425 , the process returns to  1405  to select another body segment. 
     When the process determines (at  1420 ) that the addition of the selected body segment to the defined audio sequence would cause the audio sequence to exceed the adjusted duration, the process determines (at  1430 ) whether it has completed one loop through the sorted order in this iteration through operation  1325 . If not, the process returns to  1405  to select the next body segment based on the sorted order. 
     When the process determines (at  1430 ) that it has explored all body segments in this iteration through  1325 , the process determines (at  1435 ) whether any body segments are designated as sliceable. If not, the process ends. Otherwise, the process explores (at  1440 ) adding portions of the divisible body segments to the audio sequence. In some embodiment, the process identifies portions of the body segment based on how an editor has marked up the divisible sections of the body segment and/or based on the bar data associated with the body segment. 
     In some embodiments, the operations for adding the body segment portions are similar to the operations  1405 - 1430  for adding the body segments to the audio sequence. Thus, the process explores the body segment portions based on the priority values of their associated body segments. While inserting a body segment portion in the audio sequence, the process follows the above-described insertion rules in some embodiments. The process tries to add body segment portions until the addition of one body segment portion causes the audio sequence to reach the adjusted duration, or until all body segment portions have been explored. After  1440 , the process ends. 
       FIG. 15  illustrates an example of the operation of the sequence generator  1205  and the sequence validator  1215 . This example is illustrated in three operational stages  1502 - 1506 , with the first and third stages  1502  and  1506  relating to the operation of the sequence generator  1205  and the second stage  1504  relating to the operation of the sequence validator  1215 . In this example, the song segment set includes eight segments  1 A,  1 B,  1 C,  2 A,  2 B,  2 C,  3 A and  3 B. The duration and priority of these song segments are shown in the priority sorted table  1510  that the segment sorter  1210  produces. 
     The first stage  1502  shows the sequence generator  1205  receiving the desired duration of the song. In this example, it is assumed that the desired duration is 1 minute 10 seconds, and the length of the longest ending segment is 10 seconds. Accordingly, the sequence generator  1205  steps through the body segments according to the order specified by the priority sorted table  1510  in order to identify a body-segment sequence that is has a maximum duration of 60 seconds. 
     As shown by the exploded view of the composite sequence  1235 , the sequence generator steps through the priority sorted order to first insert body segment  1 A, then body segment  1 C, followed by body segment  2 A, and then finally by body segment  2 C. Each time the sequence generator selects a body segment, it determines whether the length of this body segment exceeds the remaining duration of the body-segment sequence that it is generating. If so, the sequence generator does not insert the selected body segment and moves to the next body segment. For instance, after inserting body segment  1 A, the sequence generator selects body segment  1 B since after segment  1 A, segment  1 B has the highest priority. But the sequence generator does not insert segment  1 B because the length of the body segment sequence would then be 65 seconds, which would exceed the maximum 60-second duration for this sequence. 
     Thus, the sequence generator inserts a selected body segment in the sequence only when this insertion would not cause the body-segment sequence to exceed its maximum duration. When the sequence generator inserts a selected body segment in the sequence, it inserts this segment based on the body segment&#39;s section number and segment letter. Because of the insertion rule, the sequence generator inserts body segment  1 C after body segment  1 A, then inserts body segment  2 A after body segment  1 C, and then inserts body segment  2 C after body segment  2 A. 
     After inserting body segment  2 C, the total duration of the defined audio sequence  1515  is 1 minute, which is the maximum body-segment sequence duration. As shown in the second stage  1504 , the sequence generator  1205  then has the sequence validator  1215  examine the defined audio sequence  1515  to determine whether any two neighboring segments violates a sequence rule that is defined in the jump table. 
     The second stage  1504  also shows the sequence validator  1215  receives the jump table  1520 , which includes a rule that prohibits body segment  2 A following body segment  1 C. Thus, the sequence validator  1215  removes the body segment  2 A from the body-segment sequence  1515  to produce the modified audio sequence  1525 . Since the duration of this modified audio sequence is now 40 seconds, which is 20 seconds less than the 60 second desired duration, the sequence generator tries to insert body segments in this sequence to reach the desired duration. 
     As shown in the third stage  1506 , the sequence generator  1205  starts selecting body segments to examine for insertion in the body-segment sequence where it left off in its previous attempt. In this example, the sequence generator  1205  left off at segment  2 B. The sequence generator, however, cannot add this segment because adding this segment would cause the body-segment sequence to exceed 60 seconds. Hence, the sequence generator  1205  skips this segment, and then selects segment  3 A. The sequence generator adds this segment  3 A to the sequence as after its addition, the sequence has a 45 second duration that is less than the maximum 60 second duration. 
     As shown by the exploded view of the composite sequence  1235  in the third stage  1506 , the sequence generator steps and loops through the priority sorted order to then add segments  1 C and  2 C again to the sequence, after skipping over segments  3 B,  1 A,  1 B, and  2 A. These segments are skipped over because the addition of each of these segments would cause the body-segment sequence to exceed its maximum duration. When segments  1 C and  2 C are inserted again in the body-segment sequence, they are inserted in the sequence at positions specified by their section number and segment letter. As such, the resulting body-segment sequence  1535  is as follows:  1 A,  1 C,  1 C,  2 C,  2 C,  3 A. 
     Since this body-segment sequence is 60 seconds long (i.e., has the desired maximum duration), the sequence generator has the sequence validator check it for sequence rule violations. If the sequence validator does not identify any sequence rule violations, the sequence generator then selects the longest ending segment that can follow body segment  3 A, and inserts this ending segment in the audio sequence after body segment  3 A. When the inserted ending segment is less than 10 seconds long, the audio sequence is less than 70 seconds (i.e., less than the desired duration of the song presentation). In this situation, the sequence generator tries to identify a starting segment that can precede segment  1 A, and that has a duration that would not cause the audio sequence to exceed its maximum duration after this starting segment has been inserted in the audio sequence. If it identifies any such starting segment, the sequence generator inserts this segment before all the body segments (i.e., before segment  1 A in this example). When multiple starting segments exist that can precede segment  1 A and that have a duration that is equal to or less than the available duration of the audio sequence, the sequence generator selects the longest starting segment. 
     Many of the above-described features and applications are implemented as software processes that are specified as a set of instructions recorded on a computer readable storage medium (also referred to as computer readable medium). When these instructions are executed by one or more computational or processing unit(s) (e.g., one or more processors, cores of processors, or other processing units), they cause the processing unit(s) to perform the actions indicated in the instructions. Examples of computer readable media include, but are not limited to, CD-ROMs, flash drives, random access memory (RAM) chips, hard drives, erasable programmable read-only memories (EPROMs), electrically erasable programmable read-only memories (EEPROMs), etc. The computer readable media does not include carrier waves and electronic signals passing wirelessly or over wired connections. 
     In this specification, the term “software” is meant to include firmware residing in read-only memory or applications stored in magnetic storage which can be read into memory for processing by a processor. Also, in some embodiments, multiple software inventions can be implemented as sub-parts of a larger program while remaining distinct software inventions. In some embodiments, multiple software inventions can also be implemented as separate programs. Finally, any combination of separate programs that together implement a software invention described here is within the scope of the invention. In some embodiments, the software programs, when installed to operate on one or more electronic systems, define one or more specific machine implementations that execute and perform the operations of the software programs. 
     The applications of some embodiments operate on mobile devices, such as smart phones (e.g., iPhones®) and tablets (e.g., iPads®).  FIG. 16  is an example of an architecture  1600  of such a mobile computing device. Examples of mobile computing devices include smartphones, tablets, laptops, etc. As shown, the mobile computing device  1600  includes one or more processing units  1605 , a memory interface  1610  and a peripherals interface  1615 . 
     The peripherals interface  1615  is coupled to various sensors and subsystems, including a camera subsystem  1620 , a wireless communication subsystem(s)  1625 , an audio subsystem  1630 , an I/O subsystem  1635 , etc. The peripherals interface  1615  enables communication between the processing units  1605  and various peripherals. For example, an orientation sensor  1645  (e.g., a gyroscope) and an acceleration sensor  1650  (e.g., an accelerometer) is coupled to the peripherals interface  1615  to facilitate orientation and acceleration functions. 
     The camera subsystem  1620  is coupled to one or more optical sensors  1640  (e.g., a charged coupled device (CCD) optical sensor, a complementary metal-oxide-semiconductor (CMOS) optical sensor, etc.). The camera subsystem  1620  coupled with the optical sensors  1640  facilitates camera functions, such as image and/or video data capturing. The wireless communication subsystem  1625  serves to facilitate communication functions. In some embodiments, the wireless communication subsystem  1625  includes radio frequency receivers and transmitters, and optical receivers and transmitters (not shown in  FIG. 16 ). These receivers and transmitters of some embodiments are implemented to operate over one or more communication networks such as a GSM network, a Wi-Fi network, a Bluetooth network, etc. The audio subsystem  1630  is coupled to a speaker to output audio (e.g., to output voice navigation instructions). Additionally, the audio subsystem  1630  is coupled to a microphone to facilitate voice-enabled functions, such as voice recognition (e.g., for searching), digital recording, etc. 
     The I/O subsystem  1635  involves the transfer between input/output peripheral devices, such as a display, a touch screen, etc., and the data bus of the processing units  1605  through the peripherals interface  1615 . The I/O subsystem  1635  includes a touch-screen controller  1655  and other input controllers  1660  to facilitate the transfer between input/output peripheral devices and the data bus of the processing units  1605 . As shown, the touch-screen controller  1655  is coupled to a touch screen  1665 . The touch-screen controller  1655  detects contact and movement on the touch screen  1665  using any of multiple touch sensitivity technologies. The other input controllers  1660  are coupled to other input/control devices, such as one or more buttons. Some embodiments include a near-touch sensitive screen and a corresponding controller that can detect near-touch interactions instead of or in addition to touch interactions. Also, the input controller of some embodiments allows input through a stylus. 
     The memory interface  1610  is coupled to memory  1670 . In some embodiments, the memory  1670  includes volatile memory (e.g., high-speed random access memory), non-volatile memory (e.g., flash memory), a combination of volatile and non-volatile memory, and/or any other type of memory. As illustrated in  FIG. 16 , the memory  1670  stores an operating system (OS)  1672 . The OS  1672  includes instructions for handling basic system services and for performing hardware dependent tasks. 
     The memory  1670  also includes communication instructions  1674  to facilitate communicating with one or more additional devices; graphical user interface instructions  1676  to facilitate graphic user interface processing; image processing instructions  1678  to facilitate image-related processing and functions; input processing instructions  1680  to facilitate input-related (e.g., touch input) processes and functions; audio processing instructions  1682  to facilitate audio-related processes and functions; and camera instructions  1684  to facilitate camera-related processes and functions. The instructions described above are merely exemplary and the memory  1670  includes additional and/or other instructions in some embodiments. For instance, the memory for a smartphone may include phone instructions to facilitate phone-related processes and functions. The above-identified instructions need not be implemented as separate software programs or modules. Various functions of the mobile computing device can be implemented in hardware and/or in software, including in one or more signal processing and/or application specific integrated circuits. 
     While the components illustrated in  FIG. 16  are shown as separate components, one of ordinary skill in the art will recognize that two or more components may be integrated into one or more integrated circuits In addition, two or more components may be coupled together by one or more communication buses or signal lines. Also, while many of the functions have been described as being performed by one component, one of ordinary skill in the art will realize that the functions described with respect to  FIG. 16  may be split into two or more integrated circuits. 
       FIG. 17  conceptually illustrates another example of an electronic system  1700  with which some embodiments of the invention are implemented. The electronic system  1700  may be a computer (e.g., a desktop computer, personal computer, tablet computer, etc.), phone, PDA, or any other sort of electronic or computing device. Such an electronic system includes various types of computer readable media and interfaces for various other types of computer readable media. Electronic system  1700  includes a bus  1705 , processing unit(s)  1710 , a graphics processing unit (GPU)  1715 , a system memory  1720 , a network  1725 , a read-only memory  1730 , a permanent storage device  1735 , input devices  1740 , and output devices  1745 . 
     The bus  1705  collectively represents all system, peripheral, and chipset buses that communicatively connect the numerous internal devices of the electronic system  1700 . For instance, the bus  1705  communicatively connects the processing unit(s)  1710  with the read-only memory  1730 , the GPU  1715 , the system memory  1720 , and the permanent storage device  1735 . 
     From these various memory units, the processing unit(s)  1710  retrieves instructions to execute and data to process in order to execute the processes of the invention. The processing unit(s)may be a single processor or a multi-core processor in different embodiments. Some instructions are passed to and executed by the GPU  1715 . The GPU  1715  can offload various computations or complement the image processing provided by the processing unit(s)  1710 . 
     The read-only-memory (ROM)  1730  stores static data and instructions that are needed by the processing unit(s)  1710  and other modules of the electronic system. The permanent storage device  1735 , on the other hand, is a read-and-write memory device. This device is a non-volatile memory unit that stores instructions and data even when the electronic system  1700  is off. Some embodiments of the invention use a mass-storage device (such as a magnetic or optical disk and its corresponding disk drive, integrated flash memory) as the permanent storage device  1735 . 
     Other embodiments use a removable storage device (such as a floppy disk, flash memory device, etc., and its corresponding drive) as the permanent storage device. Like the permanent storage device  1735 , the system memory  1720  is a read-and-write memory device. However, unlike storage device  1735 , the system memory  1720  is a volatile read-and-write memory, such a random access memory. The system memory  1720  stores some of the instructions and data that the processor needs at runtime. In some embodiments, the invention&#39;s processes are stored in the system memory  1720 , the permanent storage device  1735 , and/or the read-only memory  1730 . For example, the various memory units include instructions for processing multimedia clips in accordance with some embodiments. From these various memory units, the processing unit(s)  1710  retrieves instructions to execute and data to process in order to execute the processes of some embodiments. 
     The bus  1705  also connects to the input and output devices  1740  and  1745 . The input devices  1740  enable the user to communicate information and select commands to the electronic system. The input devices  1740  include alphanumeric keyboards and pointing devices (also called cursor control devices (e.g., mice)), cameras (e.g., webcams), microphones or similar devices for receiving voice commands, etc. The output devices  1745  display images generated by the electronic system or otherwise output data. The output devices  1745  include printers and display devices, such as cathode ray tubes (CRT) or liquid crystal displays (LCD), as well as speakers or similar audio output devices. Some embodiments include devices such as a touchscreen that function as both input and output devices. 
     Finally, as shown in  FIG. 17 , bus  1705  also couples electronic system  1700  to a network  1725  through a network adapter (not shown). In this manner, the computer can be a part of a network of computers (such as a local area network (“LAN”), a wide area network (“WAN”), or an Intranet), or a network of networks, such as the Internet. Any or all components of electronic system  1700  may be used in conjunction with the invention. 
     Some embodiments include electronic components, such as microprocessors, storage and memory that store computer program instructions in a machine-readable or computer-readable medium (alternatively referred to as computer-readable storage media, machine-readable media, or machine-readable storage media). Some examples of such computer-readable media include RAM, ROM, read-only compact discs (CD-ROM), recordable compact discs (CD-R), rewritable compact discs (CD-RW), read-only digital versatile discs (e.g., DVD-ROM, dual-layer DVD-ROM), a variety of recordable/rewritable DVDs (e.g., DVD-RAM, DVD-RW, DVD+RW, etc.), flash memory (e.g., SD cards, mini-SD cards, micro-SD cards, etc.), magnetic and/or solid state hard drives, read-only and recordable Blu-Ray® discs, ultra density optical discs, any other optical or magnetic media, and floppy disks. The computer-readable media may store a computer program that is executable by at least one processing unit and includes sets of instructions for performing various operations. Examples of computer programs or computer code include machine code, such as is produced by a compiler, and files including higher-level code that are executed by a computer, an electronic component, or a microprocessor using an interpreter. 
     While the above discussion primarily refers to microprocessor or multi-core processors that execute software, some embodiments are performed by one or more integrated circuits, such as application specific integrated circuits (ASICs) or field programmable gate arrays (FPGAs). In some embodiments, such integrated circuits execute instructions that are stored on the circuit itself In addition, some embodiments execute software stored in programmable logic devices (PLDs), ROM, or RAM devices. 
     As used in this specification and any claims of this application, the terms “computer”, “server”, “processor”, and “memory” all refer to electronic or other technological devices. These terms exclude people or groups of people. For the purposes of the specification, the terms display or displaying means displaying on an electronic device. As used in this specification and any claims of this application, the terms “computer readable medium,” “computer readable media,” and “machine readable medium” are entirely restricted to tangible, physical objects that store information in a form that is readable by a computer. These terms exclude any wireless signals, wired download signals, and any other ephemeral signals. 
     While the invention has been described with reference to numerous specific details, one of ordinary skill in the art will recognize that the invention can be embodied in other specific forms without departing from the spirit of the invention. For instance, a number of the figures conceptually illustrate processes. The specific operations of these processes may not be performed in the exact order shown and described. The specific operations may not be performed in one continuous series of operations, and different specific operations may be performed in different embodiments. Furthermore, the process could be implemented using several sub-processes, or as part of a larger macro process.