Paper deep dive
RPPNet: Perceptually-Grouped Rhythm-Pitch Primitives for Long-Term Structure Melody Generation via Boundary-Aware Modeling
Tieyao Zhang, Yuke Liu, Jiaxing Yu, Xinda Wu, Kejun Zhang, Genfang Chen
Intelligence
Status: succeeded | Model: Gemma-4-26B-A4B | Prompt: intel-v1 | Confidence: 92%
Last extracted: 7/23/2026, 2:38:15 AM
Summary
The paper introduces RPPNet, a two-stage deep learning architecture for symbolic melody generation that replaces fixed bar-level structural units with perceptually-grouped Rhythm-Pitch Primitives (RPPs). By leveraging acoustic cues, auditory inertia, and similarity perception from music psychology, RPPNet generates variable-length RPP sequences that better align with human structural perception, resulting in superior long-term coherence and musicality compared to existing bar-based models like Museformer and MELONS.
Entities (8)
Relation Signals (7)
RPPNet → evaluatedon → MelodyNet
confidence 95% · We adopt the MelodyNet dataset [44]... split into train/validation/test sets
RPPNet → uses → Rhythm-Pitch Primitive
confidence 95% · It first generates variable-length Rhythm-Pitch Primitive (RPP) sequences... then decodes the RPP sequences into concrete notes.
RPPNet → derivedfrom → acoustic cues
confidence 92% · The grouping of RPPs is automatically derived from acoustic cues, auditory inertia, and similarity perception based on music psychology.
RPPNet → derivedfrom → auditory inertia
confidence 92% · The grouping of RPPs is automatically derived from acoustic cues, auditory inertia, and similarity perception based on music psychology.
RPPNet → derivedfrom → similarity perception
confidence 92% · The grouping of RPPs is automatically derived from acoustic cues, auditory inertia, and similarity perception based on music psychology.
RPPNet → outperforms → MELONS
confidence 90% · Experiments show that melodies generated by RPPNet are superior... with significant improvements across all subjective evaluation dimensions.
RPPNet → outperforms → Museformer
confidence 90% · Experiments show that melodies generated by RPPNet are superior... with significant improvements across all subjective evaluation dimensions.
Cypher Suggestions (0)
No Cypher suggestions yet.
Abstract
Abstract:Existing symbolic music generation models typically use bars as the basic structural unit. However, human perception of musical phrases often does not align with notated bar lines, leading to long-term structural fragmentation. This paper proposes RPPNet-a two-stage deep learning architecture with variable structural boundaries. It first generates variable-length Rhythm-Pitch Primitive (RPP) sequences, where each RPP encodes note count, rhythm, and contour; then decodes the RPP sequences into concrete notes. The grouping of RPPs is automatically derived from acoustic cues, auditory inertia, and similarity perception based on music psychology. Experiments show that melodies generated by RPPNet are superior in both long-term structure and musicality, with significant improvements across all subjective evaluation dimensions. Ablation studies confirm that the performance gain stems from the structural correctness of the psychological representation, rather than from model capacity. This work offers an interdisciplinary perspective for music generation, integrating music theory, computational modeling, and music psychology.
Tags
Links
- Source: https://arxiv.org/abs/2607.19776v1
- Canonical: https://arxiv.org/abs/2607.19776v1
Trouble viewing inline? Open PDF directly →
Full Text
38,953 characters extracted from source content.
Expand or collapse full text
RPPNet: Perceptually-Grouped Rhythm-Pitch Primitives for Long-Term Structure Melody Generation via Boundary-Aware Modeling Abstract Existing symbolic music generation models typically use bars as the basic structural unit. However, human perception of musical phrases often does not align with notated bar lines, leading to long-term structural fragmentation. This paper proposes RPPNet—a two-stage deep learning architecture with variable structural boundaries. It first generates variable-length Rhythm-Pitch Primitive (RPP) sequences, where each RPP encodes note count, rhythm, and contour; then decodes the RPP sequences into concrete notes. The grouping of RPPs is automatically derived from acoustic cues, auditory inertia, and similarity perception based on music psychology. Experiments show that melodies generated by RPPNet are superior in both long-term structure and musicality, with significant improvements across all subjective evaluation dimensions. Ablation studies confirm that the performance gain stems from the structural correctness of the psychological representation, rather than from model capacity. This work offers an interdisciplinary perspective for music generation, integrating music theory, computational modeling, and music psychology. 1 Introduction Symbolic melody generation is a core direction of generative AI in art [18]. In recent years, text‑to‑audio models have achieved notable results and can generate complete songs, yet they do not allow fine‑grained user control [8, 27, 28]. Symbolic music, in contrast, enables precise control over melody, harmony, and other elements, holding a central position in human‑AI co‑creation. Consequently, this direction continues to attract significant attention from both academia and industry [3]. In recent years, researchers have drawn on language models from natural language processing to capture long‑term dependencies in music and achieve structured melody generation. Such methods offer an end‑to‑end framework, excellent representation learning ability, and the potential to generate sequences of arbitrary length. They require no hand‑crafted domain rules and can automatically extract knowledge from large‑scale data; their effectiveness has been validated across multiple disciplines [1, 20, 26, 36, 39]. However, long-term structure modeling in symbolic music remains challenging [5, 29, 46]. Existing methods operate within linear sequence frameworks where attention mechanisms capture long-range token correlations yet fail to learn explicit associations between non-adjacent but functionally similar structural units; meanwhile, this task requires integrating music theory, computational modeling, psychology, and neuroscience [2]. Both factors jointly constrain effective learning of hierarchical logic, biasing models toward local statistical patterns and limiting long-term structure generation quality. Recent works integrate computational modeling with music theory to improve long-term coherence through explicit structural boundaries and thematic features, such as Museformer [47] with its hierarchical attention mechanism, Theme Transformer [38] with thematic material retrieval, and MELONS [50] and PopMNet [42] with graph-structured thematic variation encoding. However, these methods rely on fixed bar-level units. Psychological evidence shows that listeners perceive structural boundaries through acoustic cues, auditory inertia, and similarity-based grouping [7, 11, 23], rather than fixed metric segmentation. This mismatch hinders listeners’ perceptual grouping of the generated structure, thereby reducing overall musical coherence. To address this problem, we propose a hierarchical melody generation framework, RPPNet111The source code is available at: https://github.com/Kreuzter0421/RPPNet-PyTorch.git. It is based on an autoregressive architecture and splits generation into an RPP-level generation stage and a Note-level generation stage. Both stages use a Transformer encoder-decoder [34]. Drawing on music theory and cognitive psychology, we use three perceptual dimensions—acoustic cues, auditory inertia, and similarity relations—and rhythmic structure analysis [11, 13, 12] to design a heuristic algorithm. This algorithm represents a melody as a sequence of non-equidistant rhythm-pitch primitives (RPPs). The RPP-level stage employs decoupled serial prediction for autoregressive RPP generation, constructing long-term structure; the Note-level stage decodes RPPs into MIDI notes via time-scale expansion mapping. Unlike bar-based approaches (e.g., Museformer, MELONS), RPPNet replaces fixed bars with perceptually-driven flexible grouping units—the first hierarchical model to do so, grounded in psychological evidence that phrase boundaries often misalign with notated bar lines. Our contributions are as follows: 1. We propose RPPNet, a two-stage hierarchical framework with a novel perception-driven structural representation. It replaces fixed bar-level boundaries with flexible rhythm-pitch primitives grouped by acoustic cues, auditory inertia, and similarity perception. 2. We propose an automatic grouping algorithm that derives structural boundaries without explicit annotations. Controlled ablations demonstrate that performance gains stem from perceptual grouping principles rather than model capacity. 3. The proposed time-scale expansion mapping bridges discrete RPP events and continuous Note-level generation, with decoupled serial prediction ensuring strict alignment between generated notes and the RPP sequences. 4. Experimental results show that RPPNet outperforms existing baselines in long-term structural coherence and musicality. 2 Related Work 2.1 Long Sequence Symbolic Music Generation Symbolic music generation performs algorithmic composition by modeling discrete musical events, encoded in formats including MIDI, MusicXML, and ABC notation.Early research focused on local sequential dependency modeling: N-gram Markov chains predict the next event based on joint preceding events [4], yet can only capture short-range dependencies and fail to model deep hierarchical structures. HMM introduce latent states to implicitly control token distributions [30, 31], while dynamic Bayesian networks further explicitly model deep dependencies [32]. In recent years, deep neural network generative models have achieved significant advances in symbolic music. From RNNs [6], VAEs [37], and GANs [45], to Transformers [10, 21, 40], modeling capabilities have steadily increased. However, the quadratic complexity of Transformer self-attention, compounded by the long sequence nature of symbolic music, poses severe challenges for modeling dependencies spanning hundreds of bars. This challenge stems from standard tokenization strategies, where a single piece can reach thousands to tens of thousands of tokens [15], severely weakening long-term dependency modeling [33, 16]. Even when subsequent studies introduce compound tokens (e.g., Compound Word [43], Octuple [48]) to compress sequence length, models still struggle to capture thematic repetition and variation spanning dozens of bars—the core difficulty of long-term structure modeling. 2.2 Structure modeling guided by music theory To address the challenges of long‑range structural modeling in music, researchers have attempted to incorporate music theory priors into model design to guide globally coherent generation. The relevant methods can be grouped into three categories. Structure‑aware attention: Optimizing attention distribution to efficiently extract musical structural features. For example, Museformer [47] combines fine‑ and coarse‑grained attention to capture bar‑level structure; HAT [49] builds a harmony‑aware hierarchical Transformer, using harmonic progressions to guide long‑range dependency modeling. External structural prior injection: Explicitly introducing boundary or thematic features to constrain the generation process. Ref. [41] uses segmentation modules and multi‑scale attention to inject structural boundary information, aiding long‑form generation; Theme Transformer [38] takes retrieved thematic material as a conditional sequence to enhance cross‑segment thematic consistency. Hierarchical modeling and task decomposition: break long sequence generation into multi-level subtasks for globally controllable structure. MusicFramework [9] captures repetitive patterns via hierarchical representations to support multi-level abstract melody generation; TM-CGAN [19] explicitly models themes with a VAE-CGAN hybrid architecture, balancing global coherence and local variation; PhraseLDM [33] performs non-autoregressive generation in a phrase-level latent space to yield 128-bar multi-track music, alleviating long-term structure fragmentation. PopMNet [42] models internal dependencies via chord-melody graphs, while MELONS[50] combines bar-level relational graphs with GraphRNN and Transformer for long-term structure modeling. However, these methods all lack perceptual grounding in structural segmentation. Neither explicit bar-level splitting nor implicit attention-based partitioning can capture the diversity and perceptual uncertainty of phrase boundaries, leading to structural degradation in long-term generation. Developing perceptually grounded, compact structural units for efficient structure-aware long-term structure modeling remains a core challenge. 2.3 Perceptual Theories of Musical Structure The challenge of modeling long‑range structure in symbolic music [5, 29, 46] stems from the highly structured intrinsic nature of music: its elements are organized according to certain structural frameworks and expressed in human‑understandable ways [2]. This framework exhibits significant multi‑dimensional characteristics [14, 22, 25], encompassing not only basic components such as harmony and phrases but also interweaving cognitive organizational principles like similarity perception [23], making the analysis and modeling of its internal logic highly complex [35]. Music psychology research shows that structural perception relies primarily on three mechanisms: (1) acoustic cues—using changes in intensity, pitch, duration, timbre, etc. to mark structural boundaries [11]; (2) auditory inertia—based on the establishment and fulfillment of expectations for musical events [7]; (3) similarity perception—associating structural elements through motivic repetition and variation [23]. Together, these mechanisms reveal the hierarchical and theme‑driven nature of musical structure. Deliege [11] validated the psychological effectiveness of grouping preference rules, confirming that acoustic changes in intensity and pitch serve as core cues for perceiving structural boundaries. Cooper and Meyer [7] identified auditory inertia as the organizing force of musical rhythm: listeners perceive continuous sound as a dynamic structure based on psychological expectations, where deviations such as syncopation and rests create tension. Lamont and Dibben [23] demonstrated through cross-genre listening experiments that similarity judgments rely primarily on surface features such as texture and pitch contour rather than deep structural assumptions, exhibiting significant contextual dependence. Traditional music modeling is mostly based on note‑ or bar‑level granularity, which hardly aligns with the actual mechanisms of structural perception. Drawing on the above psychological findings, this paper proposes a heuristic algorithm that automatically analyzes monophonic melody structure based on acoustic cues, auditory inertia, and similarity perception, and converts it into RPP sequence data. 3 Method 3.1 Heuristic Segmentation of Rhythm-Pitch Primitive To construct cognitively grounded low-level structural units, we propose a heuristic melody segmentation algorithm that parses melodies into Rhythm-Pitch Primitives (RPPs), each containing at most three notes to carry local boundary information and support RPP-level generation, laying the foundation for subsequent hierarchical modeling. Figure 1: Example of RPP grouping (excerpt from Hey Jude). Colored legends indicate rhythmic types; black arrows denote melodic contour direction. Primitives are defined by rhythmic patterns (five categories, e.g., iambic) and pitch contours (ascending, descending, etc.), as illustrated in Figure 1; evolutionary relationships between adjacent primitives are encoded via multi-hot vectors. Grouping employs dynamic programming to maximize the cumulative structural weight W(⋅)W(·)222The complete formalization of W(⋅)W(·) is available in the repository mentioned above. of the parsed sequence (Algorithm 1), where W(⋅)W(·) scores each note based on its metrical grid position, duration, and syncopation pattern. Algorithm 1 Dynamic Programming for RPP Grouping 0: Note sequence P1:LP_1:L, Weight function W(⋅)W(·) 0: Optimal RPP list ℛR 1: if L≤3L≤ 3 then 2: return MakeRPP(P1:L)\MakeRPP(P_1:L)\ 3: end if 4: dp[0]←0dp[0]← 0, dp[1…L]←−∞dp[1… L]←-∞ 5: path[0…L]←∅path[0… L]← 6: for i=1i=1 to L do 7: k∗←argmax1≤k≤3dp[i−k]+W(Pi−k+1:i)k^*← _1≤ k≤ 3\dp[i-k]+W(P_i-k+1:i)\ 8: dp[i]←dp[i−k∗]+W(Pi−k∗+1:i)dp[i]← dp[i-k^*]+W(P_i-k^*+1:i) 9: path[i]←path[i−k∗]∪k∗path[i]← path[i-k^*]∪\k^*\ 10: end for 11: ℛ←∅R← , idx←1idx← 1 12: for k∈path[L]k∈ path[L] do 13: ℛ←ℛ∪MakeRPP(Pidx:idx+k−1)R ∪\MakeRPP(P_idx:idx+k-1)\ 14: idx←idx+kidx← idx+k 15: end for 16: return ℛR 3.2 Hierarchical Sequence Representation To overcome self-attention dilution in long sequences [47], we propose a hierarchical generation architecture that strictly decouples the RPP-level and Note-level. 3.2.1 RPP-Level Representation We model the global structure as a sequence of Rhythm-Pitch Primitives. The sequence is =v1,…,vTV=\v_1,…,v_T\. Each unit is explicitly defined as vi=bi,pi,di,ri,miv_i=\b_i,p_i,d_i,r_i,m_i\, where bib_i, pip_i, and did_i denote the measure index, metrical position, and duration respectively. The rhythmic pattern rir_i and melodic contour mim_i characterize the motif. This abstraction achieves significant temporal downsampling, enabling efficient identification of form development without external priors. 3.2.2 Note-Level Representation To realize the RPP-level representation as Note-level outputs, we define a note sequence =u1,…,uKU=\u_1,…,u_K\ mapping to final MIDI events. Each unit uj=bj,pj,dj,nju_j=\b_j,p_j,d_j,n_j\ shares the aforementioned temporal grid, while njn_j explicitly defines the absolute pitch. 3.2.3 Compound Word Embedding Strategy Extending the Compound Word parallel fusion concept [17], the discrete attributes within viv_i and uju_j are independently mapped into dense vectors at each time step. These vectors are subsequently aggregated into a unified hidden representation via concatenation and linear projection. 3.3 Model As shown in Figure 2, our two-stage hierarchical generation framework decouples melody construction into RPP-level structural planning and Note-level instantiation. This multi-resolution temporal representation effectively addresses the semantic disparity between abstract structural development and Note-level symbolic generation. Figure 2: The architecture of the proposed two-stage hierarchical generation framework. Melody construction is strictly decoupled into RPP-level structural planning and Note-level note instantiation. The dashed box details the decoupled serial prediction mechanism deployed at the output end. 3.3.1 RPP-Level Generation The RPP-level structural module aims to generate a long-term framework guiding musical development, featuring a standard Transformer encoder-decoder architecture as its core [40]. While employing compound representation inputs to compress sequence length, we replace traditional parallel prediction with a decoupled serial prediction mechanism at the output, highlighted by the dashed box in Figure 2. Given historical context features <th_<t at time step t, the joint probability of primitive vtv_t is strictly decoupled into the marginal probability of temporal position postpos_t and conditional probabilities of detailed attributes, formulated in Eqn (1): P(vt|<t)=P(post|<t)⋅P(dt,rt,mt|<t,post)P(v_t|h_<t)=P(pos_t|h_<t)· P(d_t,r_t,m_t|h_<t,pos_t) (1) The model first predicts postpos_t solely from <th_<t. This position representation is subsequently mapped into a temporal prior embedding and concatenated with <th_<t, enabling the joint prediction of duration, rhythmic pattern, and melodic contour under explicit temporal constraints. 3.3.2 Note-Level Generation The Note-level module decodes the RPP sequence into concrete note events via a Transformer encoder-decoder [40]. We construct a time-scale expansion mapping that bridges discrete RPP events and the continuous note-level time axis: for each primitive i, the absolute onset is computed as Tstart=bi×ℛbar+piT_start=b_i×R_bar+p_i, and its hidden state ih_i is broadcast across all grid steps within [Tstart,Tstart+di)[T_start,T_start+d_i). This allows the decoder to attend to structural memory via cross-attention, ensuring strict alignment between output notes and the RPP-level skeleton. 4 Experiment 4.1 Dataset We adopt the MelodyNet dataset [44], comprising over 300,000 MIDI melodies from FreeMIDI, HookTheory, BitMIDI, MuseScore, KernScores, and Kunstderfuge. After removing non-melody tracks and incomplete data, 274,300 melodies remain, split into train/validation/test sets at a ratio of 18:1:118:1:1. 4.2 Compared Models To evaluate the structural awareness of RPPNet, we select two representative baseline models, human-composed melodies, and two framework variants to validate the specific contribution of the proposed heuristic RPP grouping: • Museformer [47]: A long-sequence music generation model with fine- and coarse-grained attention. • MELONS [50]: A graph-sequence architecture that models bar-level chord and melodic contours via line graphs to condition token generation. • RPPNet-Real: A variant using ground-truth RPP sequences as RPP-level input, representing the theoretical ceiling of Note-level generation. • RPPNet-Random-Grouped: An ablation baseline replacing heuristic RPP grouping with random segmentation while maintaining architectural consistency and length distribution alignment. We select Museformer [47] and MELONS [50] as primary baselines, as both exemplify fixed bar-level structural modeling — the exact assumption our work relaxes. MelodyGLM [44] is excluded because its pretrain-finetune paradigm confounds structural boundary design with large-scale pretraining. PhraseLDM [33] is excluded as it requires explicit phrase-level annotations unavailable in MelodyNet. Our ablation baseline RPPNet-Random-Grouped isolates the contribution of perceptual semantics from mere variable-length grouping, yielding a clean controlled comparison: fixed-bar (Museformer, MELONS) vs. perceptually-grouped variable-length (RPPNet) vs. randomly-grouped variable-length (ablation). 4.3 Experiment Setup 4.3.1 Objective Metrics To validate the effectiveness of RPP grouping, we construct a random-grouping baseline (Random-Grouped) that preserves the length distribution of the RPP training set via random sampling while removing structural semantics. Following Museformer [47], we adopt Perplexity (PPL) and Structural Error (SE) as objective metrics. This alignment isolates the effect of structural representation choice from metric selection bias. PPL requires a consistent vocabulary across models, so Museformer and MELONS are excluded from the objective comparison. We also note growing evidence questioning the perceptual validity of conventional symbolic music objective metrics [24]. We further verify the RPP-level generator’s learning of underlying distributions by comparing attribute statistics between ground-truth and generated RPP sequences. 4.3.2 Subjective Metrics Following [44], we conduct a subjective listening test with 15 paid participants (7 with musical background, 8 without) rating generated melodies on a 10-point scale (1–-10). All models are trained from scratch, yielding 50 32-bar melodies evaluated across five configurations—RPPNet, RPPNet-Real, RPPNet-Random-Grouped, Museformer, and MELONS—alongside 10 human-composed references from the test set. Participants were asked to rate each melody on a scale of 1–10 (lowest to highest) along the following four dimensions: • Coherence: Is the melody fluent, pleasant, and engaging? • Rhythmicity: Does the melody exhibit a regular metric pattern and appropriate use of rests? • Structure: Does the melody display clear structural features, such as reasonable repetition and motivic development? • Overall Impression: A holistic evaluation of the melody. We select Museformer [47] and MELONS [50] as primary baselines, both representing fixed bar-level structural modeling that our work relaxes. MelodyGLM [44] is excluded as its pretrain-finetune paradigm introduces a confounding variable unrelated to boundary design. PhraseLDM [33] is excluded due to its reliance on explicit phrase annotations unavailable in MelodyNet. The ablation baseline RPPNet-Random-Grouped isolates perceptual semantics from variable-length grouping alone, enabling a controlled comparison across fixed-bar, perceptually-grouped, and randomly-grouped conditions. 5 Result Model Coherence Rhythmicity Structure Overall Human 7.29 ± 0.74∗ 7.36 ± 0.68∗ 7.45 ± 0.82∗ 7.47 ± 0.79∗ RPPNet (Ours) 6.61 ± 0.71 6.61 ± 0.69 6.77 ± 0.73 6.69 ± 0.68 RPPNet-Real 6.61 ± 0.85 6.59 ± 0.83 6.51 ± 0.98 6.61 ± 0.87 RPPNet-Rnd-Grp 5.99 ± 0.62∗ 6.08 ± 0.54∗ 6.01 ± 0.64∗ 6.09 ± 0.66∗ Museformer [47] 5.81 ± 0.54∗ 5.62 ± 0.53∗ 5.57 ± 0.58∗ 5.73 ± 0.54∗ MELONS [50] 5.39 ± 0.69∗ 5.33 ± 0.66∗ 5.31 ± 0.76∗ 5.30 ± 0.77∗ Table 1: Results of the subjective evaluation. Scores are presented as Mean ± Standard Deviation. Asterisks denote significant differences compared to our proposed RPPNet (p∗<0.01^**p<0.01, p∗∗<0.001^***p<0.001). “Overall” denotes the overall musical impression. Attribute / Pattern Real (%) Generated (%) Note Group One note 12.26 10.61 Two notes 36.25 40.41 Three notes 51.49 48.98 Rhythm Pattern (0,) 7.74 8.43 (1,) 4.51 2.19 (0, 1) 14.29 29.83 (1, 0) 21.96 10.57 (0, 0, 1) 14.14 16.31 (0, 1, 0) 17.72 17.18 (1, 0, 0) 19.64 15.49 Melodic Contour Descending 15.47 15.15 Ascending 13.18 18.19 Stationary 7.60 7.06 Cont. Descending 7.68 6.83 Cont. Ascending 7.26 6.28 Cont. Stationary 6.32 3.25 Down then Up 8.93 8.91 Up then Down 10.11 8.15 Stay then Up 2.85 4.46 Stay then Down 3.30 3.98 Down then Stay 2.51 3.74 Up then Stay 2.54 3.39 Single Note 12.26 10.61 Table 2: Detailed statistical distributions of note density, rhythm pattern, and melodic contour across real and generated datasets. Model PPL ↓ SE ↓ RPPNet (Ours) 2.21 0.0132 ± 0.0013 RPPNet-Random-Grouped 2.36 0.0175 ± 0.0008 Table 3: Results of the objective evaluation in the ablation study. SE denotes the structural entropy of Rhythmic Pattern Primitives (RPPs). The best results are highlighted in bold. 5.1 Statistic Analysis To quantify RPP-level distributional fidelity, we statistically compare real and generated attribute distributions, yielding a Pearson correlation of 92.19%92.19\% across 23 categories (Table 2). Dimension-level analysis reveals strong alignment in note group (r=0.98r=0.98) and melodic contour (r=0.90r=0.90), while rhythm pattern shows the largest gap (r=0.44r=0.44), primarily due to over-generation of iambs (0,1: +15.5%+15.5\%) and under-generation of trochees (1,0: −11.4%-11.4\%). These results suggest the model effectively captures note grouping and pitch contour structure, while rhythmic pattern fidelity remains the primary direction for improvement. 5.2 Ablation Study To validate the effectiveness of heuristic RPP grouping, we construct a random-grouping ablation baseline (Random-Grouped) within the RPPNet framework with aligned length distribution. Objective metrics (Table 3) show that standard RPPNet (PPL=2.21PPL=2.21, SE=0.0132SE=0.0132) outperforms Random-Grouped (2.36, 0.0175). Subjective evaluation (Table 1) further reveals that Random-Grouped exhibits significant degradation across all dimensions upon removing heuristic grouping: coherence (5.99, p<0.001), rhythmic quality (6.08, p<0.01p<0.01), structural quality (6.01, p<0.001p<0.001), and overall impression (6.09, p<0.01p<0.01). This demonstrates that the structural semantics captured by heuristic grouping are critical for melodic coherence and motif organization. Meanwhile, standard RPPNet and RPPNet-Real (ground-truth RPP input) show no significant difference in coherence (6.61 vs. 6.61, p=1.00p=1.00), rhythmic quality (6.61 vs. 6.59, p=0.93p=0.93), or overall impression (6.69 vs. 6.61, p=0.55p=0.55), with structural quality also approaching non-significance (6.77 vs. 6.51, p=0.08p=0.08). This suggests that the RPP-level generator of RPPNet possesses strong distribution fitting capabilities, corroborating the findings from statistical experiments. 5.3 Comparison with Previous Models Table 1presents the subjective ratings and significance tests against baselines. Human-composed melodies score 7.47 overall as the reference ceiling. RPPNet achieves an overall impression of 6.69, significantly outperforming Museformer (5.73, p<0.001p<0.001) and Melons (5.30, p<0.001p<0.001). The advantage is most pronounced in structural quality: RPPNet (6.77) exceeds Museformer (5.57, p<0.001p<0.001) and MELONS (5.31, p<0.001p<0.001) by 1.20 and 1.46 points, respectively, demonstrating that explicit hierarchical structural modeling effectively enhances the organization of long-term structure. 6 Discussion This work integrates music-psychological principles with music theory to propose RPPNet, a perception-driven structural representation for melody generation that transcends fixed bar-level boundaries through hierarchical decoupled generation. Experiments confirm that this framework significantly outperforms existing baselines in long-term structural coherence and overall musicality. These results demonstrate that perception-driven grouping significantly outperforms fixed bar-level representations. Ablation experiments reveal that performance gains stem from the proper encoding of perceptual grouping principles—merely breaking bar isometry without respecting perceptual rules yields no benefit. Although RPPNet significantly outperforms existing baselines, a quality gap remains compared to human compositions (overall 7.47vs.6.697.47vs.6.69), likely attributable to the distributional mismatch in rhythmic patterns (Pearson r=0.44r=0.44). Closing this gap is the central challenge going forward. Future work will proceed along three directions: (1) hybrid data-driven and rule-driven structural strategies; (2) introducing micro-macro feedback mechanisms where Note-level generation revises RPP-level structure; and (3) extending this representation to polyphonic music and accompaniment generation, evaluating its capability under complex musical textures. References [1] H. C. Anna, V. Ashish, U. Jakob, S. Ian, H. Curtis, S. Noam, D. Monica, E. Douglas, et al. (2018) Music transformer: Generating music with long-term structure. arXiv preprint. Cited by: §1. [2] R. Bader (2018) Springer handbook of systematic musicology. Springer. Cited by: §1, §2.3. [3] J. Briot and F. Pachet (2020) Deep learning for music generation: challenges and directions. Neural Computing and Applications 32 (4), p. 981–993. Cited by: §1. [4] F. P. Brooks, A. L. Hopkins, P. G. Neumann, and W. V. Wright (1957) An experiment in musical composition. IRE Transactions on Electronic Computers (3), p. 175–182. Cited by: §2.1. [5] F. Carnovalini and A. Rodà (2020) Computational creativity and music generation systems: An introduction to the state of the art. Frontiers in Artificial Intelligence 3, p. 14. Cited by: §1, §2.3. [6] H. Chu, R. Urtasun, and S. Fidler (2017) Song From PI: A Musically Plausible Network for Pop Music Generation. In 5th International Conference on Learning Representations, ICLR 2017, Toulon, France, April 24-26, 2017, Workshop Track Proceedings, Cited by: §2.1. [7] G. W. Cooper, G. Cooper, and L. B. Meyer (1963) The rhythmic structure of music. University of Chicago press. Cited by: §1, §2.3, §2.3. [8] J. Copet, F. Kreuk, I. Gat, T. Remez, D. Kant, G. Synnaeve, Y. Adi, and A. Défossez (2023) Simple and controllable music generation. Advances in neural information processing systems 36, p. 47704–47720. Cited by: §1. [9] S. Dai, Z. Jin, C. Gomes, and R. B. Dannenberg (2021) Controllable deep melody generation via hierarchical music structure representation. In Proceedings of the 22nd International Society for Music Information Retrieval Conference, ISMIR 2021, Online, November 7-12, 2021, J. H. Lee, A. Lerch, Z. Duan, J. Nam, P. Rao, P. van Kranenburg, and A. Srinivasamurthy (Eds.), p. 143–150. Cited by: §2.2. [10] Z. Dai, Z. Yang, Y. Yang, J. G. Carbonell, Q. Le, and R. Salakhutdinov (2019) Transformer-xl: Attentive language models beyond a fixed-length context. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, p. 2978–2988. Cited by: §2.1. [11] I. Deliege (1987) Grouping conditions in listening to music: An approach to Lerdahl & Jackendoff’s grouping preference rules. Music perception 4 (4), p. 325–359. Cited by: §1, §1, §2.3, §2.3. [12] J. Edworthy (1982) Pitch and contour in music processing.. Psychomusicology: A Journal of Research in Music Cognition 2 (1), p. 44. Cited by: §1. [13] J. Edworthy (1985) Interval and contour in melody processing. Music Perception 2 (3), p. 375–388. Cited by: §1. [14] A. Forte and S. E. Gilbert (1982) Introduction to Schenkerian analysis. (No Title). Cited by: §2.3. [15] N. Fradet, J. Briot, F. Chhel, A. E. F. Seghrouchni, and N. Gutowski (2023) MidiTok: a python package for midi file tokenization. arXiv preprint arXiv:2310.17202. Cited by: §2.1. [16] N. Fradet, N. Gutowski, F. Chhel, and J. Briot (2023) Byte pair encoding for symbolic music. In Proceedings of the 2023 conference on empirical methods in natural language processing, p. 2001–2020. Cited by: §2.1. [17] W. Hsiao, J. Liu, Y. Yeh, and Y. Yang (2021) Compound word transformer: Learning to compose full-song music over dynamic directed hypergraphs. In Proceedings of the AAAI Conference on Artificial Intelligence, Vol. 35, p. 178–186. Cited by: §3.2.3. [18] S. Ji, X. Yang, and J. Luo (2023) A survey on deep learning for symbolic music generation: Representations, algorithms, evaluations, and challenges. ACM Computing Surveys 56 (1), p. 1–39. Cited by: §1. [19] F. Jin, P. Li, and X. Wu (2025) A theme music generation model based on hybrid variational autoencoders and conditional generative adversarial networks. Engineering Applications of Artificial Intelligence 161, p. 112131. Cited by: §2.2. [20] J. Jumper, R. Evans, A. Pritzel, T. Green, M. Figurnov, O. Ronneberger, K. Tunyasuvunakool, R. Bates, A. Žídek, A. Potapenko, et al. (2021) Highly accurate protein structure prediction with AlphaFold. nature 596 (7873), p. 583–589. Cited by: §1. [21] A. Katharopoulos, A. Vyas, N. Pappas, and F. Fleuret (2020) Transformers are rnns: Fast autoregressive transformers with linear attention. In International Conference on Machine Learning, p. 5156–5165. Cited by: §2.1. [22] S. Koelsch, M. Rohrmeier, R. Torrecuso, and S. Jentschke (2013) Processing of hierarchical syntactic structure in music. Proceedings of the National Academy of Sciences 110 (38), p. 15443–15448. Cited by: §2.3. [23] A. Lamont and N. Dibben (2001) Motivic structure and the perception of similarity. Music Perception 18 (3), p. 245–274. Cited by: §1, §2.3, §2.3, §2.3. [24] A. Lerch, C. Arthur, N. Bryan-Kinns, C. Ford, Q. Sun, and A. Vinay (2025-10) Survey on the evaluation of generative models in music. ACM Comput. Surv. 58 (4). External Links: ISSN 0360-0300, Link, Document Cited by: §4.3.1. [25] F. Lerdahl and R. S. Jackendoff (1996) A Generative Theory of Tonal Music, reissue, with a new preface. MIT press. Cited by: §2.3. [26] N. Li, S. Liu, Y. Liu, S. Zhao, and M. Liu (2019) Neural speech synthesis with transformer network. In Proceedings of the AAAI Conference on Artificial Intelligence, Vol. 33, p. 6706–6713. Cited by: §1. [27] J. Liang, H. Zhang, H. Liu, Y. Cao, Q. Kong, X. Liu, W. Wang, M. D. Plumbley, H. Phan, and E. Benetos (2024) WavCraft: audio editing and generation with large language models. In ICLR 2024 Workshop on LLM Agents, External Links: Link Cited by: §1. [28] H. Liu, Z. Chen, Y. Yuan, X. Mei, X. Liu, D. Mandic, W. Wang, and M. D. Plumbley (2023) Audioldm: Text-to-audio generation with latent diffusion models. arXiv preprint arXiv:2301.12503. External Links: 2301.12503 Cited by: §1. [29] Y. Ma, A. Øland, A. Ragni, B. M. Del Sette, C. Saitis, C. Donahue, C. Lin, C. Plachouras, E. Benetos, E. Shatri, et al. (2024) Foundation models for music: A survey. arXiv preprint arXiv:2408.14340. External Links: 2408.14340 Cited by: §1, §2.3. [30] P. Mavromatis (2006) A hidden Markov model of melody production in Greek church chant. Computing in musicology: a directory of research (14), p. 93–112. Cited by: §2.1. [31] P. Mavromatis (2009) HMM Analysis of Musical Structure: Identification of Latent Variables Through Topology-Sensitive Model Selection. In International Conference on Mathematics and Computation in Music, p. 205–217. Cited by: §2.1. [32] K. P. Murphy (2002) Dynamic bayesian networks: representation, inference and learning. University of California, Berkeley. Cited by: §2.1. [33] L. Ou and Y. Wang (2025) PhraseVAE and PhraseLDM: Latent Diffusion for Full-Song Multitrack Symbolic Music Generation. CoRR abs/2512.11348. External Links: 2512.11348, Document Cited by: §2.1, §2.2, §4.2, §4.3.2. [34] Y. Ren, J. He, X. Tan, T. Qin, Z. Zhao, and T. Liu (2020) Popmag: Pop music accompaniment generation. In Proceedings of the 28th ACM International Conference on Multimedia, p. 1198–1206. Cited by: §1. [35] M. Rohrmeier and P. Rebuschat (2012) Implicit learning and acquisition of music. Topics in cognitive science 4 (4), p. 525–553. Cited by: §2.3. [36] P. Schwaller, B. Hoover, J. Reymond, H. Strobelt, and T. Laino (2021) Extraction of organic chemistry grammar from unsupervised learning of chemical reactions. Science Advances 7 (15), p. eabe4166. Cited by: §1. [37] I. V. Serban, A. Sordoni, R. Lowe, L. Charlin, J. Pineau, A. C. Courville, and Y. Bengio (2017) A Hierarchical Latent Variable Encoder-Decoder Model for Generating Dialogues. In Proceedings of the Thirty-First AAAI Conference on Artificial Intelligence, February 4-9, 2017, San Francisco, California, USA, S. Singh and S. Markovitch (Eds.), p. 3295–3301. External Links: Document Cited by: §2.1. [38] Y. Shih, S. Wu, F. Zalkow, M. Müller, and Y. Yang (2022) Theme transformer: Symbolic music generation with theme-conditioned transformer. IEEE Transactions on Multimedia 25, p. 3495–3508. Cited by: §1, §2.2. [39] J. M. J. Valanarasu, P. Oza, I. Hacihaliloglu, and V. M. Patel (2021) Medical transformer: Gated axial-attention for medical image segmentation. In International Conference on Medical Image Computing and Computer-Assisted Intervention, p. 36–46. Cited by: §1. [40] A. Vaswani, N. Shazeer, N. Parmar, J. Uszkoreit, L. Jones, A. N. Gomez, Ł. Kaiser, and I. Polosukhin (2017) Attention is all you need. Advances in neural information processing systems 30. Cited by: §2.1, §3.3.1, §3.3.2. [41] G. Wu, S. Liu, and X. Fan (2023) The power of fragmentation: a hierarchical transformer model for structural segmentation in symbolic music generation. IEEE/ACM Transactions on Audio, Speech, and Language Processing 31, p. 1409–1420. Cited by: §2.2. [42] J. Wu, X. Liu, X. Hu, and J. Zhu (2020) PopMNet: Generating structured pop music melodies using neural networks. Artificial Intelligence 286, p. 103303. Cited by: §1, §2.2. [43] S. Wu and Y. Yang (2020) The Jazz Transformer on the Front Line: Exploring the Shortcomings of AI-composed Music through Quantitative Measures. In Proceedings of the 21th International Society for Music Information Retrieval Conference, ISMIR 2020, Montreal, Canada, October 11-16, 2020, J. Cumming, J. H. Lee, B. McFee, M. Schedl, J. Devaney, C. McKay, E. Zangerle, and T. de Reuse (Eds.), p. 142–149. Cited by: §2.1. [44] X. Wu, Z. Huang, K. Zhang, J. Yu, X. Tan, T. Zhang, Z. Wang, and L. Sun (2023) MelodyGLM: Multi-task Pre-training for Symbolic Melody Generation. CoRR abs/2309.10738. External Links: 2309.10738, Document Cited by: §4.1, §4.2, §4.3.2, §4.3.2. [45] L. Yang, S. Chou, and Y. Yang (2017) MidiNet: A Convolutional Generative Adversarial Network for Symbolic-Domain Music Generation. In Proceedings of the 18th International Society for Music Information Retrieval Conference, ISMIR 2017, Suzhou, China, October 23-27, 2017, S. J. Cunningham, Z. Duan, X. Hu, and D. Turnbull (Eds.), p. 324–331. Cited by: §2.1. [46] Z. Yin, F. Reuben, S. Stepney, and T. Collins (2023) Deep learning’s shallow gains: A comparative evaluation of algorithms for automatic music generation. Machine Learning 112 (5), p. 1785–1822. Cited by: §1, §2.3. [47] B. Yu, P. Lu, R. Wang, W. Hu, X. Tan, W. Ye, S. Zhang, T. Qin, and T. Liu (2022) Museformer: Transformer with fine-and coarse-grained attention for music generation. Advances in neural information processing systems 35, p. 1376–1388. Cited by: §1, §2.2, §3.2, 1st item, §4.2, §4.3.1, §4.3.2, Table 1. [48] M. Zeng, X. Tan, R. Wang, Z. Ju, T. Qin, and T. Liu (2021) Musicbert: Symbolic music understanding with large-scale pre-training. In Findings of the Association for Computational Linguistics: ACL-IJCNLP 2021, p. 791–800. Cited by: §2.1. [49] X. Zhang, J. Zhang, Y. Qiu, L. Wang, and J. Zhou (2022) Structure-enhanced pop music generation via harmony-aware learning. In Proceedings of the 30th ACM International Conference on Multimedia, p. 1204–1213. Cited by: §2.2. [50] Y. Zou, P. Zou, Y. Zhao, K. Zhang, R. Zhang, and X. Wang (2022) Melons: generating melody with long-term structure using transformers and structure graph. In ICASSP 2022-2022 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), p. 191–195. Cited by: §1, §2.2, 2nd item, §4.2, §4.3.2, Table 1.