Prime number driven multi-part music generation system and method
Patent Information
- Application Number
- CN202611209640.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-11
- Publication Date
- 2026-10-16
AI Technical Summary
现有技术缺少对上述依赖关系的统一建模,难以准确识别局部异常或编辑操作的实际影响范围
本发明通过构建共享素数状态链为不同声部分配素数索引起始位置、索引跨距及相位偏移,使多个声部在共享统一生成状态的同时形成相互区分的状态访问轨迹,提高多声部音序数据生成过程的确定性、可追溯性和状态管理一致性;同时,通过构建多声部音序数据依赖图,在检测到异常音序数据或接收到局部编辑操作时,能够追溯对应的素数状态节点并准确确定受影响音序数据的局部重算窗口,进而减少完整段落或全部声部重新生成造成的重复运算量和缓存读写量,提高缓存音序数据的复用率,缩短异常修正及交互编辑的响应时延,并降低局部修改引起未修改区域音高、时间状态及输出通道状态发生非预期变化的可能性,提高多声部音序数据生成、修正及音频合成输出的连续性和处理效率。
Smart Images

Figure FT_1 
Figure FT_2 
Figure FT_3
Abstract
Description
Technical Field
[0001] This invention relates to the field of data processing technology, and in particular to a multi-part music generation system and method based on prime number-driven methods. Background Technology
[0002] With the development of digital audio processing, computer-aided composition, and audio synthesis technologies, multi-part sequence data generation technology is increasingly being applied to scenarios such as film and television scoring, game audio, digital content production, and interactive music editing. Existing multi-part sequence data generation technologies typically employ random traversal, fixed sequence cyclic stacking logic, or mutually independent part generation states to improve the variability of sequence data.
[0003] However, when using random traversal or independent voice part generation, there is a lack of stable mapping between each sequence data and its index position, state parameters, and preceding state used in the generation process. This leads to different results for the same set of input parameters in different generation processes. Therefore, when sequence data exhibits time overlap, abnormal voice part synchronization, output channel conflict, excessive concurrent vocalizations, or cross-voice data conflict, existing technologies can usually only determine the location of the anomaly, making it difficult to trace the specific generation state that generated the abnormal data and accurately recover the original generation process.
[0004] Meanwhile, complex relationships exist between multi-part sequence data. Sequential data within the same part exhibit temporal dependencies, while sequence data in different parts within the same or overlapping time intervals have synchronization dependencies. These sequence data may share the output channels, buffer space, and concurrent sound resources of the audio synthesis device. When a local sequence data in a particular part becomes abnormal or is modified by the user, its impact will propagate along temporal relationships to subsequent sequence data, or affect other parts through synchronization relationships and output resource occupancy. Existing technologies lack a unified model for these dependencies, making it difficult to accurately identify the actual scope of impact of local anomalies or editing operations.
[0005] When a local anomaly is detected or an interactive modification operation is received, existing technologies typically require recalculating the entire sequence data of the whole paragraph or the entire sequence data after the modification. This results in a large amount of unaffected sequence data being recalculated repeatedly, making it difficult to reuse valid data in the cache. At the same time, since the randomly generated state is difficult to recover accurately, recalculation may cause unexpected changes in the pitch, time, or output channel state of the unmodified area, which in turn leads to a significant increase in processor computation, cache read / write volume, and interactive response latency. Summary of the Invention
[0006] To overcome the defects and shortcomings of existing technologies, this invention provides a multi-part music generation system and method based on prime number driving. By constructing a shared prime number state chain and a multi-part sequence data dependency graph, the reuse rate of cached sequence data is improved, and the global recalculation amount and interactive response latency are effectively reduced.
[0007] To achieve the above objectives, the present invention adopts the following technical solution: In a first aspect, the present invention provides a method for generating multi-part music based on prime number-driven methods, including: Acquire creative control parameters, voice configuration parameters, and audio synthesis device configuration parameters. The creative control parameters include target tonality category, target mood label, tonality operation mode, and texture density coefficient. By constructing an ordered prime number array and performing difference and modulo operations on the array elements, candidate pitch indices are determined and prime number state mapping relationships are established. Based on the target tonality category, the candidate pitch index is converted into candidate pitch, and the candidate pitch is filtered by the target music features corresponding to the target emotion tag to generate target tonality sequence data; Based on the tonality operation mode, the target tonality sequence data is subjected to tonality fusion processing to generate multitonality fused sequence data; A shared prime state chain is constructed based on the prime state mapping relationship, and multi-tone fusion sequence data is selected to generate multi-voice sequence data. Construct a multi-voice sequence data dependency graph, perform visual verification of the multi-voice sequence data, and determine the local recalculation window of the affected sequence data by combining the dependency relationship of each sequence data node; By correcting the sequence data in the local recalculation window, a multi-part sequence synthesis control command sequence is generated and sent to the audio synthesis device for audio synthesis output.
[0008] Furthermore, the step of determining candidate pitch indices and establishing prime number state mapping relationships includes: Extract prime numbers from the range 2 to 100 and construct an ordered prime number array in ascending order of prime numbers; Select the first prime number and the second prime number from the ordered prime number array according to the preset index interval, calculate the difference between the first prime number and the second prime number, and obtain the prime number offset; Perform a modulo-12 operation on the prime number offset and use the remainder as the candidate pitch index corresponding to the twelve-tone equal temperament pitch category; Prime state nodes are generated based on the index positions of the first and second prime numbers in the ordered prime array, the prime number offset, and the candidate pitch index, and prime state node identifiers are assigned to the prime state nodes. Generate a candidate pitch generation record that includes a prime number state node identifier, the index position of the first prime number, the index position of the second prime number, the prime number offset, and the candidate pitch index, and establish a prime number state mapping relationship between the candidate pitch generation record and the corresponding prime number state node.
[0009] Further, the conversion of candidate pitch indices into candidate pitches includes: Based on the target tonality category, the corresponding tonality generation branch is retrieved from the preset standardized tonality information library. The preset standardized tonality information library includes standardized tonality information corresponding to Chinese pentatonic scale, Chinese hexatononic scale, Chinese heptatonic scale, Western major and minor scales, medieval synthetic scales, modern augmented and diminished scales, interval characteristic scales, symmetrical transposed scales, overtone scales, and exotic characteristic scales. The prime number allocation weight of each candidate pitch index is determined based on the value of each prime number in the ordered prime number array, the array position, and the corresponding prime number offset. Candidate pitch indices are selected based on the weights assigned to prime numbers, and the pitch mapping table corresponding to the tonality generation branch is used to determine the pitch encoding of the selected candidate pitch indices within the corresponding tonality structure, and the candidate pitch indices are converted into candidate pitches.
[0010] Furthermore, the step of filtering candidate pitches based on the target music features corresponding to the target emotion tag to generate target tonality sequence data includes: Obtain the target music feature vector corresponding to the target emotion tag from the preset emotion feature database. The target music feature vector includes the pitch change rate and the pitch sequence data density. Extract the pitch change rate and pitch sequence data density of the candidate tonality sequence data formed by each candidate pitch to form a candidate music feature vector; Calculate the feature matching degree between the candidate music feature vector and the target music feature vector, and determine the target tonality sequence data based on the feature matching degree and the prime numbers corresponding to the candidate pitch indices.
[0011] Furthermore, the step of performing tonal fusion processing on the target tonal sequence data according to the tonal operation mode to generate multi-tonal fusion sequence data includes: When the tonality operation mode is static fixed tonality mode, the tonality sequence data is continuously generated according to the tonality mapping table corresponding to the target tonality to obtain multitonality fusion tonality sequence data; When the tonality operation mode is dynamic gradual tonality mode, the tonality conversion cost and tonality conversion window are determined based on the proportion of common pitch levels between adjacent target tones, the differences in tonality characteristics, and the amount of pitch shift. Within the tonality conversion window, the prime number allocation weights of the candidate pitch indices are adjusted step by step according to the tonality conversion direction, so that the tonality mapping table used for the tonality sequence data gradually switches from the tonality before conversion to the tonality after conversion, generating multitonality fused tonality sequence data.
[0012] Furthermore, the step of constructing a shared prime state chain based on the prime state mapping relationship and selecting sequence data in combination with multitonal fusion sequence data to generate multi-part sequence data includes: A shared prime state chain is constructed based on the prime state mapping relationship corresponding to the ordered prime array. The prime index starting position, index span, and phase offset are configured for each voice part according to the number of voice parts. Based on the prime index starting position, index span and phase offset of each voice part, prime state nodes are extracted from the shared prime state chain to generate the hierarchical prime subsequence corresponding to each voice part. Based on the prime state nodes corresponding to each layer of prime subsequences, the sequence data of each voice part is selected from the multitonal fusion sequence data. The pitch encoding of the selected sequence data is mapped to the voice part register according to the range of each voice part. The vocal state of each voice part at different time positions is determined according to the texture density coefficient. Multi-voice sequence data including sequence timestamp, duration, pitch encoding, dynamic parameters, voice part identifier, output channel identifier, and prime state node identifier is generated.
[0013] Furthermore, determining the local recalculation window for the affected sequence data includes: Based on the temporal relationship between adjacent sequence data within the same voice part, the synchronization relationship between sequence data of different voice parts produced simultaneously, and the occupancy relationship of each sequence data on the output resources of the audio synthesis device, a multi-voice sequence data dependency graph is constructed. Based on the preset polyphony counterpoint rule configuration file, the temporal sequence, the range of each voice part, the number of output channels of the audio synthesis device, and the maximum number of concurrent voices, the multi-voice sequence data is constrained to obtain the multi-voice sequence data to be verified. Scan the multi-part sequence data to be verified, identify abnormal sequence data combinations that do not meet the constraints of the polyphony counterpoint rule configuration file, sequence time order, part range, or audio synthesis device output resources, and determine the responsible part and the abnormal prime number state node corresponding to the abnormal sequence data based on the part to which each abnormal sequence data belongs, the sequence locking status, and the dependency propagation range caused by modifying the corresponding sequence data. The visual interactive interface displays the multi-part tone sequence data to be verified and receives drag, cut, recombination or partial modification operations performed on the music segment. The prime number state node corresponding to the tone sequence data involved in the operation is determined as the edit state node. Using abnormal prime number state nodes or edit state nodes as target state nodes, and based on the temporal dependency, synchronization dependency, and output resource consumption dependency of the target state nodes in the multi-voice sequence data dependency graph, all affected sequence data nodes are determined, and a local recalculation window is generated.
[0014] Further, the step of generating a multi-part tone sequence synthesis control command sequence and sending it to the audio synthesis device for audio synthesis output includes:
[0015] Read the prime number status, tonality mapping status and audio synthesis device resource occupancy status of each voice part corresponding to the starting position of the local recalculation window, adjust the starting position of the prime number index, index span, phase offset and prime number allocation weight of the edited voice part in the local recalculation window, generate multiple correction candidate segments, and synchronously update the related voice part sequence data that has a dependency relationship with the edited voice part according to the multi-voice sequence data dependency graph.
[0016] By analyzing the degree of cross-part rule conflict among each candidate segment for correction, the correction evaluation value is determined. The candidate segment that meets the preset constraints and has the best correction evaluation value is selected to replace the original sequence data in the local recalculation window. The cached sequence data outside the local recalculation window is reused to generate a multi-part sequence synthesis control instruction sequence. The multi-part sequence synthesis control instruction sequence is sent to the audio synthesis device for audio synthesis output.
[0017] Secondly, the present invention provides a prime number-driven multi-part music generation system, comprising: The data acquisition module is used to acquire creative control parameters, voice configuration parameters, and audio synthesis device configuration parameters. The creative control parameters include target tonality category, target mood label, tonality operation mode, and texture density coefficient. The prime number operation driver module is used to determine the candidate pitch index and establish the prime number state mapping relationship by constructing an ordered prime number array and performing difference and modulo operations on the array elements. The tonality emotion modeling module is used to convert candidate pitch indices into candidate pitches based on the target tonality category, and to filter the candidate pitches through the target music features corresponding to the target emotion label, thereby generating target tonality sequence data. The tonality fusion processing module is used to perform tonality fusion processing on the target tonality sequence data according to the tonality operation mode, and generate multi-tonality fusion sequence data; The multi-part polyphony generation module is used to construct a shared prime state chain based on the prime state mapping relationship, and select the sequence data by combining the multitonal fusion sequence data to generate multi-part sequence data; The visualization verification module is used to construct a dependency graph of multi-voice sequence data. By visually verifying the multi-voice sequence data and combining the dependency relationships of each sequence data node, the local recalculation window of the affected sequence data is determined. The synthesis output module is used to generate a multi-part sequence synthesis control command sequence by correcting the sequence data in the local recalculation window and sending it to the audio synthesis device for audio synthesis output.
[0018] Thirdly, the present invention provides an electronic device, comprising: a processor and a memory, wherein the memory stores a computer program that can be called by the processor, and the processor executes a prime-driven polyphonic music generation method by calling the computer program stored in the memory.
[0019] Fourthly, the present invention provides a computer-readable storage medium storing instructions that, when executed on a computer, cause the computer to perform a prime-number-driven polyphonic music generation method.
[0020] Compared with the prior art, the present invention has the following advantages and beneficial effects: This invention constructs a shared prime number state chain to assign prime number index starting positions, index spans, and phase offsets to different voice parts. This allows multiple voice parts to form mutually distinguishable state access trajectories while sharing a unified generation state, improving the determinism, traceability, and consistency of state management in the multi-voice sequence data generation process. Simultaneously, by constructing a multi-voice sequence data dependency graph, when abnormal sequence data is detected or a local editing operation is received, the corresponding prime number state node can be traced and the local recalculation window of the affected sequence data can be accurately determined. This reduces the amount of repetitive computation and cache read / write operations caused by regenerating complete segments or all voice parts, improves the reuse rate of cached sequence data, shortens the response latency of anomaly correction and interactive editing, and reduces the possibility of unexpected changes in pitch, time state, and output channel state in unmodified areas caused by local modifications. This improves the continuity and processing efficiency of multi-voice sequence data generation, correction, and audio synthesis output. Attached Figure Description
[0021] Other features, objects, and advantages of the invention will become more apparent from the following detailed description of non-limiting embodiments with reference to the accompanying drawings: Figure 1 This is a flowchart illustrating the multi-part music generation method based on prime number driving provided in an embodiment of the present invention; Figure 2 This is a schematic diagram of the process for generating target tonality sequence data provided in an embodiment of the present invention; Figure 3 This is a schematic diagram of the process for generating multi-part tone sequence data provided in an embodiment of the present invention; Figure 4 This is a schematic diagram of the structure of a prime-driven multi-part music generation system provided in an embodiment of the present invention; Figure 5 This is a schematic diagram of the structure of the electronic device provided in an embodiment of the present invention. Detailed Implementation
[0022] The technical solution of the present invention will be described in detail below with reference to the accompanying drawings and specific embodiments. It should be understood that the embodiments of the present invention and the specific features in the embodiments are detailed descriptions of the technical solution of the present invention, rather than limitations thereof. In the absence of conflict, the embodiments of the present invention and the technical features in the embodiments can be combined with each other.
[0023] Please see Figure 1 , Figure 1 This is a schematic diagram of the overall process of the multi-part music generation method based on prime number driving provided in an embodiment of the present invention, which specifically includes the following steps: S100: Obtain creative control parameters, voice configuration parameters, and audio synthesis device configuration parameters. The creative control parameters include target tonality category, target mood label, tonality operation mode, and texture density coefficient. The configuration parameters for the voice parts include the number of voice parts, the voice part identifier for each voice part, the minimum allowed pitch code, the maximum allowed pitch code, and the range of duration values. The configuration parameters for the audio synthesis device include the number of output channels, the maximum number of concurrent sounds, and the pitch output range of each output channel. S200. By constructing an ordered prime number array and performing difference and modulo operations on the array elements, the candidate pitch index is determined and a prime number state mapping relationship is established. By converting a defined sequence of prime numbers into a recordable, reproducible, and traceable pitch generation state, a unified data foundation is provided for subsequent multi-part sequence data generation. Prime number-driven processing utilizes the characteristics of ordered prime number arrays—fixed element positions, non-uniform differences between adjacent or spaced elements, and unique computational results under the same parameters—to form a deterministic state access trajectory distinct from random sampling. By performing modulo-12 operations on the prime number differences, different numerical offsets are uniformly converted into candidate pitch category indices in the twelve-tone equal temperament, enabling the prime number computation results to be linked with subsequent pitch encoding processing. The prime number state mapping relationship refers to using prime number state node identifiers as indices to map the prime numbers participating in the current computation. A data correspondence is established between prime number positions, prime number differences, candidate pitch indices, and corresponding candidate pitch generation records. Therefore, under the same index interval, array access order, and other input parameters, the same candidate pitch indices can be repeatedly obtained. When a subsequent sequence of notes becomes abnormal or is modified, the prime number position, prime number offset, and modulo operation result of that sequence of notes can be traced back based on its associated prime number state node identifier. This provides a recoverable initial state for abnormal state location, correction of the responsible voice, and local recalculation, reducing the need for a complete sequence recalculation due to unrecoverable random states. The process of determining candidate pitch indices and establishing prime number state mapping relationships includes: Extract prime numbers from the range 2 to 100 and construct an ordered prime number array in ascending order of prime number values. Specifically, iterate through all integers between 2 and 100. For any integer to be judged, determine whether it is divisible only by 1 and itself. If so, the integer is determined as a prime number and added to the prime number set; otherwise, it is not added to the prime number set. After completing the traversal, arrange the prime number set in ascending order of prime number values to obtain the ordered prime number array. By using a fixed range and a fixed sorting method, it is ensured that the element values, number of elements, and index positions of the ordered prime number array remain consistent in each execution process, providing a basis for the unique marking of subsequent state nodes and the reproduction of operation results. Based on a preset index interval, the first and second prime numbers are selected from the ordered prime number array. The difference between the first and second prime numbers is calculated to obtain the prime number offset. Specifically, the preset index interval is set. ,in, , The length of the ordered prime number array is given; the index of the ordered prime number array is given. prime numbers If it is determined to be the first prime number, then the index position is... prime numbers It is determined to be the second prime number, where, ; Calculate prime number offset That is, the difference between the prime number at the high index position and the prime number at the low index position; Perform a modulo-12 operation on the prime number offset, and use the remainder as the candidate pitch index corresponding to the pitch category of the twelve-tone equal temperament. Specifically, the candidate pitch index... ,in, The range of values is These represent the twelve pitch categories in the twelve-tone equal temperament. For example, when the first prime number is 5 and the second prime number is 11, the prime number offset is 6, and the candidate pitch index obtained after performing a modulo 12 operation on 6 is 6; when the first prime number is 7 and the second prime number is 23, the prime number offset is 16, and the candidate pitch index obtained after performing a modulo 12 operation on 16 is 4. Through the modulo 12 operation, the prime number offsets of different numerical ranges can be normalized to a unified twelve-category pitch index space, which facilitates subsequent tonality mapping and voice register mapping according to the same data format. Prime number state nodes are generated based on the index positions of the first and second prime numbers in the ordered prime number array, the prime number offsets, and the candidate pitch indices. Prime number state node identifiers are assigned to the prime number state nodes. Specifically, an independent prime number operation state record is established for each prime number difference and modulo operation. The index positions of the first and second prime numbers, the values of the first and second prime numbers, the prime number offsets, and the candidate pitch indices are written into the prime number operation state record. This prime number operation state record is used as a prime number state node, and a prime number state node identifier is assigned to the prime number state node. The prime number state node identifier can adopt a combination encoding method of task number-round number-first prime number index position-second prime number index position to ensure that the identifiers of different prime number state nodes within the same generation task are not repeated. A candidate pitch generation record is generated, including a prime number state node identifier, the index position of the first prime number, the index position of the second prime number, the prime number offset, and the candidate pitch index. A prime number state mapping relationship is established between the candidate pitch generation record and the corresponding prime number state node. Specifically, a corresponding candidate pitch generation record is created based on each prime number state node, and the prime number state node identifier, the first prime number index position, the second prime number index position, the prime number offset, and the candidate pitch index are set as the basic fields of the candidate pitch generation record. Depending on actual processing needs, the candidate pitch generation record may also include the first prime value, the second prime value, the preset index interval, the array access round, the tone mapping state, the candidate pitch encoding, the record usage state, and the generation time position. Using the prime number state node identifier as the association key, the candidate pitch generation record is written into the state mapping table associated with the corresponding prime number state node, so that each candidate pitch generation record can uniquely point to the prime number state node that generated it, and each prime number state node can query its corresponding candidate pitch index and the corresponding candidate pitch generation record.
[0024] S300. Based on the target tonality category, the candidate pitch index is converted into candidate pitch, and the candidate pitch is filtered by the target music features corresponding to the target emotion label to generate target tonality sequence data. Since the candidate pitch index obtained by modulo-12 operation only represents the relative pitch category between 0 and 11, it cannot directly determine its legal pitch level and specific pitch code in the target tonality. Therefore, by calling the tonality generation branch corresponding to the target tonality, the candidate pitch index is weighted and mapped to tonality. This ensures that the same prime number state, target tonality category, and mapping parameters can produce the same candidate pitch result, avoiding the problem of too many out-of-tonality tones or an unbalanced pitch distribution caused by directly using the modulo-12 result as the final pitch. It also provides unified candidate pitch data for subsequent emotional feature screening, multi-tonality fusion, and multi-voice range mapping. The conversion of the candidate pitch index into candidate pitch includes: Based on the target tonality category, the corresponding tonality generation branch is retrieved from the pre-defined standardized tonality information database. This database includes standardized tonality information for Chinese pentatonic, Chinese hexatononic, and Chinese heptatonic modes, Western major and minor keys, medieval synthetic modes, modern augmented and diminished scales, interval characteristic scales, symmetrical transposed scales, atonal scales, and exotic characteristic scales. Specifically, standardized tonality information is pre-established for each tonality category and stored in the database using the tonality category identifier as the search key. The standardized tonality information includes the tonality category identifier, tonic category, set of legal pitches, semitone offset of each legal pitch relative to the tonic, pitch level parameters, and a tonality mapping table. Among these, the Chinese pentatonic and Chinese hexatononic modes... The standardized tonality information for Chinese heptatonic scales, Western major and minor scales, medieval synthetic scales, modern augmented and diminished scales, interval characteristic scales, symmetrical transposed scales, overtone scales, and exotic characteristic scales corresponds to different sets of legal pitch classes and pitch class level parameters. The tonality mapping table records the correspondence between candidate pitch indices from 0 to 11 and legal pitch classes within the target tonality, as well as the reference pitch code and allowed pitch range corresponding to the candidate pitch indices. By extracting the target tonality category from the creative control parameters, the standardized tonality information corresponding to the category identifier of the target tonality category is retrieved from the standardized tonality information database, and the tonic reference, legal pitch class set, pitch class level parameters, and tonality mapping table are loaded to form the tonality generation branch corresponding to the current generation task. The prime number allocation weights for each candidate pitch index are determined based on the values, array positions, and corresponding prime number offsets of each prime number in the ordered prime number array. Specifically, for each prime number state node, the first and second prime numbers involved in the difference operation, their index positions in the ordered prime number array, and their corresponding prime number offsets are read. The average value of the first and second prime numbers is calculated, and the average value is normalized based on the smallest and largest prime numbers in the ordered prime number array to obtain the prime number value representation. The average index position of the first and second prime numbers is calculated, and the average index position is normalized based on the first and last index positions of the ordered prime number array to obtain the array position representation. Based on all prime number state nodes... The minimum and maximum prime number offsets in the node are normalized to the current prime number offset to obtain the offset representation. When the maximum and minimum values calculated by any normalization are the same, the corresponding representation is set to 0. The value 1 is added to the average of the prime number value representation, the array position representation, and the offset representation to obtain the state contribution value of the current prime number state node. The prime number state nodes are grouped according to the candidate pitch index. The state contribution values of the prime number state nodes with the same modulo 12 result are added to obtain the aggregate contribution value of the corresponding candidate pitch index. The aggregate contribution value of each candidate pitch index is divided by the sum of the aggregate contribution values of all candidate pitch indices to obtain the prime number allocation weight of the candidate pitch index. Candidate pitch indices are selected based on prime number allocation weights. A tonality mapping table corresponding to the tonality generation branch is used to determine the pitch encoding of the selected candidate pitch indices within the corresponding tonality structure. The candidate pitch indices are then converted into candidate pitches. Specifically, the candidate pitch indices are sorted from largest to smallest according to their prime number allocation weights, and a predetermined number of the top-ranked candidate pitch indices are selected. When different candidate pitch indices have the same prime number allocation weight, they are deterministically sorted from smallest to largest according to the position of the first prime number array of their corresponding prime number state nodes. For the selected candidate pitch indices, an initial pitch category is calculated using the tonic category corresponding to the target tonality category. This is achieved by performing a modulo-12 operation on the sum of the tonic category and the corresponding candidate pitch index, and using the remainder as the initial pitch category. Both the tonic category and the initial pitch category use values from 0 to... The pitch category encoding of 11 is used as follows: If the initial pitch category belongs to the set of legal pitch levels corresponding to the target tonality category, then the initial pitch category is used as the legal pitch category corresponding to the candidate pitch index. Otherwise, the cyclic semitone distance between the initial pitch category and each legal pitch level is calculated, and the legal pitch level with the smallest cyclic semitone distance is selected as the legal pitch category corresponding to the candidate pitch index. According to the tonality mapping table corresponding to the target tonality category, the reference pitch code and the allowed pitch range corresponding to the current tonality generation branch are extracted, and the candidate pitch codes corresponding to the legal pitch categories at different octave positions are determined respectively. The pitch codes within the allowed pitch range are selected from the candidate pitch codes, and the pitch code with the smallest difference from the reference pitch code is determined as the pitch code corresponding to the candidate pitch index. The pitch codes adopt MIDI pitch numbering. By converting target emotion tags into target music feature vectors at a uniform scale, and quantitatively comparing the candidate tonality sequence data formed by candidate pitches with the target music feature vectors, this approach avoids selecting sequence data solely based on fixed tonality templates or random results. This ensures the candidate sequence selection process has defined input parameters, calculation criteria, and output results. Simultaneously, coupling feature matching degree with the prime number allocation weights corresponding to candidate pitch indices preserves the correlation between candidate pitches and prime number state nodes while satisfying target music feature constraints. This ensures the final generated target tonality sequence data remains reproducible and traceable. (See also...) Figure 2 , Figure 2 This is a schematic diagram of the process for generating target tonality sequence data provided in an embodiment of the present invention, including:
[0025] Obtain the target music feature vector corresponding to the target emotion tag from the preset emotion feature database. The target music feature vector includes the pitch change rate and the pitch sequence data density.
[0026] The pitch change rate and pitch density of the candidate tonality sequence data formed by each candidate pitch are extracted to form a candidate music feature vector. Specifically, according to the order of the candidate pitch index and the access order of the corresponding prime state nodes, the candidate pitches are divided into multiple candidate tonality sequence data with the same preset time length, and an initial timestamp and duration are configured for each candidate pitch. For any candidate tonality sequence data, the absolute difference between adjacent candidate pitch codes is calculated, and the ratio of the average of all absolute differences to the maximum allowable pitch change of the candidate tonality sequence data is taken as the pitch change rate. The number of sequence data units in the vocal state within the preset time window of the candidate tonality sequence data is counted, and the ratio of the number of sequence data units to the maximum number of sequence data units within the time window is taken as the pitch density. The pitch change rate and pitch density are arranged in the same field order as the target music feature vector to form the candidate music feature vector corresponding to the candidate tonality sequence data. The feature matching degree between candidate music feature vectors and target music feature vectors is calculated, and the target tonality sequence data is determined based on the feature matching degree and the prime number allocation weights corresponding to the candidate pitch indices. Specifically, each feature value in the candidate music feature vector and the target music feature vector is normalized; the average of the absolute differences between each feature value in the normalized candidate music feature vector and the corresponding feature value in the target music feature vector is calculated as the feature offset mean; the difference between the value 1 and the feature offset mean is taken as the feature matching degree of the corresponding candidate tonality sequence data; the duration ratio of each candidate pitch in the candidate tonality sequence data is determined based on the duration of each candidate pitch; the product of the prime number allocation weight of each candidate pitch index and the corresponding duration ratio is summed to obtain the comprehensive prime number allocation weight of the candidate tonality sequence data; the sum of the feature matching degree and the comprehensive prime number allocation weight is taken as the target emotion screening value of the candidate tonality sequence data; the candidate tonality sequence data with the largest target emotion screening value is taken as the target tonality sequence data, so that the target tonality sequence data screening result under the same input parameters remains unique and reproducible.
[0027] S400. Perform tonal fusion processing on the target tonal sequence data according to the tonal operation mode to generate multi-tonal fusion sequence data; Based on the creative control parameters, the role of the target tonality on the timeline is determined, and the target tonality sequence data is converted into sequence data with a fixed tonality mapping state or a progressive tonality conversion state. The tonality operation mode specifies the calling rules of the tonality mapping table during sequence generation: in static fixed tonality mode, the same tonality mapping table is continuously used within the target music segment; in dynamic progressive tonality mode, a tonality conversion window is set between adjacent target tones, and the proportion of different tonality mapping tables' influence on candidate pitch indices is gradually changed within the tonality conversion window. Tonality fusion processing avoids direct switching of tonality mapping tables at adjacent time positions, preventing concentrated abrupt changes in pitch encoding. Simultaneously, each sequence data is associated with a corresponding tonality mapping table identifier, conversion stage parameters, and prime number state node identifier, thus maintaining the continuity and traceability of the tonality processing process and providing unified data input for subsequent multi-part sequence generation driven by a shared prime number state chain. Tonality fusion processing is performed on the target tonality sequence data according to the tonality operation mode to generate multi-tonality fused sequence data, including: When the tonality operation mode is static fixed tonality mode, the tonality sequence data is continuously generated according to the tonality mapping table corresponding to the target tonality to obtain multitonality fusion tonality sequence data; When the tonality operation mode is a dynamic gradual tonality mode, the tonality conversion cost and tonality conversion window are determined based on the proportion of shared pitch levels, differences in tonality characteristics, and pitch shift between adjacent target tones. Specifically, when the tonality operation mode is a dynamic gradual tonality mode, the tonality conversion cost and tonality conversion window are determined based on the proportion of shared pitch levels, differences in tonality characteristics, and pitch shift between adjacent target tones, including: determining the temporally adjacent pre-conversion and post-conversion tones as the first and second target tones, respectively; extracting the legal pitch category set, tonic category, and pitch level parameters of each legal pitch category from the corresponding tonality mapping table; calculating the two... The ratio of the number of pitch categories in the intersection of two sets of legal pitch categories to the number of pitch categories in the union of two sets of legal pitch categories yields the common pitch proportion. The tonic category, legal pitch category distribution, and pitch level parameters of the two target tones are encoded into normalized tonality feature vectors. The weighted sum of the absolute differences of corresponding feature values in the two tonality feature vectors is calculated to obtain the tonality feature difference. For each legal pitch category of the first target tones, the cyclic semitone distance between it and each legal pitch category of the second target tones is calculated. The smallest cyclic semitone distance is taken as the target pitch shift for that legal pitch category. Then, the target pitch shift for all legal pitch categories of the first target tones is calculated. The pitch shift is averaged, and the ratio of this average to the maximum cyclic semitone distance is calculated to obtain the normalized pitch shift. The difference between the value 1 and the common pitch percentage, the tonal characteristic difference, and the normalized pitch shift are summed to obtain the tonal conversion cost. Based on the preset minimum and maximum conversion lengths, the number of sequence data units contained in the tonal conversion window is determined according to the rule that a larger tonal conversion cost results in a longer conversion window. This includes: comparing the tonal conversion cost with the maximum allowed tonal conversion cost, dividing the tonal conversion cost by the maximum allowed tonal conversion cost to obtain a conversion cost ratio ranging from 0 to 1; and calculating the preset maximum conversion length. The length difference between the current key transition cost and the preset minimum transition length is multiplied by the transition cost ratio to obtain the transition length increment corresponding to the current key transition cost. The transition length increment is added to the preset minimum transition length and rounded according to the basic time unit of the tone sequence data to obtain the key transition window and the number of tone sequence data units contained in the corresponding key transition window. Among them, the closer the key transition cost is to 0, the closer the key transition window length is to the preset minimum transition length. The closer the key transition cost is to the maximum allowed key transition cost, the closer the key transition window length is to the preset maximum transition length, so that the key transition window length increases continuously as the key transition cost increases. Within the tonality conversion window, the prime number allocation weights of the candidate pitch indices are adjusted progressively according to the tonality conversion direction. This causes the tonality mapping table used for the sequence data to gradually switch from the pre-conversion tonality to the post-conversion tonality, generating multi-tonality fused sequence data. Specifically, according to the order of the sequence data units within the tonality conversion window, a conversion progress parameter is set for each sequence data unit. The conversion progress parameter at the start of the conversion window is 0, and the conversion progress parameter at the end of the conversion window is 1. The conversion progress parameters of the intermediate sequence data units are increased progressively according to a preset linear or smooth increasing function. For each candidate pitch index, its original prime number allocation weight is calculated by subtracting the current conversion progress parameter from the value 1, and... The current conversion progress parameter is multiplied to obtain the effective allocation weight of the candidate pitch index in the pre-conversion tonality mapping branch and the post-conversion tonality mapping branch. The candidate pitch index is converted into the corresponding candidate pitch code through the pre-conversion tonality mapping table and the post-conversion tonality mapping table respectively. Based on the effective allocation weight of the two candidate pitch codes, the pitch level parameter, and the distance between them and the pitch code of the previous sequence data, the pitch code used at the current time position is determined. After the end of the conversion window, the call to the pre-conversion tonality mapping table is stopped, and only the post-conversion tonality mapping table is used to generate subsequent sequence data. The conversion progress parameter, tonality mapping table identifier, and prime number state node identifier corresponding to each sequence data are recorded to obtain multitonal fusion sequence data.
[0028] S500: Construct a shared prime state chain based on the prime state mapping relationship, and select the sequence data by combining the multitonal fusion sequence data to generate multi-part sequence data; By organizing independent prime state nodes into a unified generation state source that can be jointly invoked by multiple voice parts according to a defined access order, and using different state access parameters to form mutually distinguishable and reproducible sequence generation trajectories for each voice part, the system achieves this. Instead of establishing separate randomly generated states for each voice part, they share the same prime state chain. The order in which each voice part reads prime state nodes is controlled by the prime index start position, index span, and phase offset, ensuring that the sequence data of each voice part can be associated with the corresponding prime state node and candidate pitch generation record. When a local sequence data of a voice part is abnormal or edited, the state access position of that voice part at the corresponding time position can be restored based on the prime state node identifier, without needing to regenerate all sequence data of other unaffected voice parts. Simultaneously, through voice part range mapping, texture density control, and output channel configuration, the pitch data selected in the shared state chain is converted into structured multi-voice sequence data that conforms to the configuration of each voice part and the resource constraints of the audio synthesis equipment. This improves the reproducibility of multi-voice generation results, the state differences between voice parts, the ability to trace anomalies, and the efficiency of subsequent local recalculation. Please refer to [link to relevant documentation]. Figure 3 , Figure 3This is a schematic diagram of the process for generating multi-part tone sequence data provided in an embodiment of the present invention, including: A shared prime state chain is constructed based on the prime state mapping relationship corresponding to the ordered prime number array. The starting position of the prime index, the index span, and the phase offset are configured for each voice part according to the number of voice parts. Specifically, all prime state nodes in the prime state mapping relationship are read and sorted in ascending order according to the array position of the first prime number. When the array positions of the first prime numbers are the same, they are then sorted in ascending order according to the array positions of the second prime numbers. A state transition relationship is then established sequentially, pointing from the current prime state node to the next prime state node, forming a shared prime state chain containing a preset number of prime state nodes. The number of prime state nodes in the shared prime state chain is set as the chain length. State access parameters are configured for each voice part according to the ascending order of voice part identifiers. The shared prime state chain is then divided according to the voice parts. The quantity is divided into equal intervals, and each interval position is determined as the prime index starting position of the corresponding voice part; different values are selected sequentially from the set of positive integers whose greatest common divisor with the chain length is 1 as the index span of each voice part; when the number of selectable spans is less than the number of voice parts, different voice parts are allowed to use the same index span; the number of time positions included in the preset generation cycle is divided into equal intervals according to the number of voice parts, and the interval position corresponding to each voice part is determined as the phase offset. The phase offset is used to represent the step offset of each voice part relative to the unified tempo time position to start executing state chain access; the prime index starting position, index span, phase offset and current state chain version identifier of each voice part are written into the corresponding voice part state configuration record to ensure that the same state access trajectory can be restored under the same voice part configuration parameters. Prime state nodes are extracted from the shared prime state chain according to the prime index starting position, index span, and phase offset of each voice part, generating a hierarchical prime subsequence for each voice part. Specifically, for any voice part, the sequential number of the current time position is added to the phase offset of that voice part, the result is multiplied by the index span of that voice part, and then added to the prime index starting position of that voice part. A cyclic positioning is performed on the result based on the chain length of the shared prime state chain to determine the target chain position corresponding to the current time position, and the prime state node at that target chain position is read. For positions beyond the end of the chain after cyclic positioning, the calculation continues from the beginning of the shared prime state chain. The sequence is performed in order from front to back according to the time positions. Each voice part reads the prime number state nodes, forming a hierarchical prime number subsequence associated with the corresponding voice part. Each subsequence item in the hierarchical prime number subsequence includes a voice part identifier, a musical time position, a shared prime number state chain position, a prime number state node identifier, a candidate pitch index, and a candidate pitch generation record address. Hierarchical means that different voice parts have independent subsequence storage layers and state access cursors, but each subsequence item retains the source association pointing to the same shared prime number state chain. When different voice parts read the same prime number state node at the same musical time position, they retain their respective subsequence items and establish synchronization markers, without merging the corresponding data, thus providing a data foundation for subsequent identification of cross-voice synchronization relationships and resource occupancy relationships. Based on the prime state nodes corresponding to each layered prime subsequence, sequence data for each voice part is selected from the multitonal fusion sequence data. The pitch encoding of the selected sequence data is mapped to the voice part register according to the range of each voice part. The vocal state of each voice part at different time positions is determined based on the texture density coefficient. This generates multi-voice sequence data including sequence timestamps, durations, pitch encodings, dynamic parameters, voice part identifiers, output channel identifiers, and prime state node identifiers. Specifically, for each layered prime subsequence item, the prime state node identifier and its occurrence in the current subsequence are used as the basis for the sequence data. The sequence is used as a combined search key to query sequence data units with the same prime number state node identifier and corresponding occurrence order in multitonal fused sequence data. Its pitch code, duration, dynamic parameters, tonality mapping state, and prime number allocation weight are read. Based on the minimum and maximum allowed pitch codes in the current voice configuration parameters, the selected pitch codes are increased or decreased by integer multiples of 12 to obtain candidate pitch codes within the voice range. For the first pitch of the current voice, the candidate pitch code with the smallest distance from the center pitch of the voice range is selected. For subsequent pitches, the candidate pitch code with the smallest distance from the center pitch of the voice range is selected. The candidate pitch with the smallest distance from the previous pitch of a vocal part is encoded to complete the vocal part register mapping. For each note sequence time position, the texture density coefficient is multiplied by the total number of vocal parts and rounded down to obtain the target number of vocal parts, while limiting the target number of vocal parts to within the maximum concurrent vocal output of the audio synthesis device and the number of currently available output channels. Vocal parts are sorted from largest to smallest according to the prime number allocation weight corresponding to the current note sequence data unit. Vocal parts with the highest target number of vocal parts are set to the vocal state, while the remaining vocal parts are set to the rest state. When the prime number allocation weights are the same, the vocal part is selected according to its identifier. The parts are ordered deterministically from smallest to largest. For parts in the vocal state, the start time corresponding to the current position of the sequence is determined as the sequence timestamp, and the duration, mapped pitch code, velocity parameter, part identifier, configured or currently idle output channel identifier, and prime number state node identifier are written. For parts in the resting state, the sequence timestamp, duration, part identifier, and prime number state node identifier are retained, and the vocal state field is set to rest. No corresponding note start instruction is generated, thus forming multi-part sequence data that can be used for subsequent dependency graph construction and audio synthesis control instruction generation.
[0029] S600. Construct a multi-voice sequence data dependency graph, perform visual verification of the multi-voice sequence data, and determine the local recalculation window of the affected sequence data by combining the dependency relationship of each sequence data node. By converting the temporal transmission relationships, cross-part synchronization relationships, and resource sharing relationships of audio synthesis devices among multi-part sequence data into a computable graph structure, and using this graph structure as the basis for anomaly localization, editing impact analysis, and determination of local recalculation range, a visual interactive interface is used to display sequence data, constraint verification results, and node dependencies, as well as to receive user editing operations. By associating abnormal sequence data and edited sequence data with corresponding prime number state nodes and analyzing their impact propagation range along the dependency graph, it is possible to distinguish between affected sequence data that needs to be recalculated and unaffected sequence data that can continue to be reused. This avoids local anomalies or editing operations causing recalculation of the entire musical segment, all subsequent sequences, or all parts, reducing the amount of repetitive computation and cache read / write operations on the processor. At the same time, it keeps the sequence data outside the local recalculation window and its prime number generation state unchanged, improving the continuity of anomaly tracing, editing response, and audio synthesis output. The local recalculation window for affected sequence data is determined, including: Based on the temporal relationship between adjacent sequence data within the same voice part, the synchronization relationship between sequence data from different voice parts simultaneously produced, and the resource occupancy of each sequence data on the audio synthesis device, a multi-voice sequence data dependency graph is constructed. Specifically, each sequence data unit is set as a sequence data node, and each sequence data node records node identifier, sequence timestamp, duration, end time, pitch encoding, velocity parameter, voice part identifier, output channel identifier, vocal state, sequence lock state, and prime number state node identifier. Sequence data nodes are grouped according to voice part identifiers, and within each group, they are sorted from front to back according to sequence timestamps. A directed temporal dependency edge is established between adjacent sequence data nodes within the same voice part, starting from the previous sequence data node and moving to the next. Points are assigned to the next node, and the time interval, pitch change, and prime number state access continuity between the preceding and following nodes are recorded. For sequence data nodes of different voice parts, it is determined whether their vocal time intervals intersect. When two vocal time intervals overlap, a synchronization dependency edge is established between them, and the overlapping time interval and synchronization time position are recorded. Based on the output channel identifier, vocal time interval, and device resource usage of each sequence data node, sequence data nodes that share the same output channel or are included in the maximum concurrent vocal count within the same time interval are identified, and output resource usage dependency edges are established between the nodes. The sequence data node set, temporal dependency edge set, synchronization dependency edge set, and output resource usage dependency edge set are stored as an adjacency matrix to form a multi-voice sequence data dependency graph. Based on the preset polyphonic counterpoint rule configuration file, the tempo sequence, the range of each voice part, the number of output channels of the audio synthesis device, and the maximum number of concurrent voices, the multi-voice sequence data is constrained to obtain the multi-voice sequence data to be verified. Specifically, the preset polyphonic counterpoint rule configuration file is read, and the allowed range of cross-voice intervals, prohibited interval combinations, restrictions on continuous same-direction intervals, restrictions on voice part crossing, and restrictions on adjacent sequence data connections are parsed into executable rule conditions and corresponding rule identifiers. For each sequence data node, its sequence timestamp is checked to see if it is non-negative, its duration is greater than 0, its end time exceeds the end time of the target music segment, and the time position of the next sequence data node within the same voice part meets the preset order and overlap restrictions. Based on the minimum allowed pitch in the configuration parameters of each voice part... The system encodes and sets the maximum allowed pitch, determining whether the pitch code of each sequence data node is within the corresponding voice range. Based on the number of output channels in the audio synthesis device configuration parameters, it determines whether the output channel identifier of each sequence data node is a valid channel. It also counts the number of sequence data nodes simultaneously emitting sound within each preset time slice and determines whether the number of sequence data nodes exceeds the maximum concurrent sound output. For sequence data nodes of different voices located at the same synchronization time position or with overlapping sound intervals, it performs cross-voice rule judgment item by item according to the polyphonic counterpoint rule configuration file. Finally, it writes the verification status, unmet constraint type, rule identifier, over-limit value, and associated node identifier of each sequence data node into the verification record of that sequence data node, forming a multi-voice sequence data to be verified with constraint verification fields. Scan the multi-part sequence data to be verified, identify abnormal sequence data combinations that do not meet the constraints of the polyphony counterpoint rule configuration file, sequence time order, part range, or audio synthesis device output resources, and determine the responsible part and the abnormal prime number state node corresponding to the abnormal sequence data based on the part to which each abnormal sequence data belongs, the sequence locking status, and the dependency propagation range caused by modifying the corresponding sequence data. The visual interactive interface displays the multi-part tone sequence data to be verified and receives drag, cut, recombination or partial modification operations performed on the music segment. The prime number state node corresponding to the tone sequence data involved in the operation is determined as the edit state node. Nodes in abnormal prime states or edit states are designated as target states. Based on the temporal, synchronous, and output resource dependencies of the target state node in the multi-part sequence data dependency graph, all affected sequence data nodes are identified, and a local recalculation window is generated. Specifically, the sequence data nodes corresponding to the target state node are queried and added to the affected node set. For temporal dependencies, when the pitch encoding, sequence timestamp, duration, prime state access parameters, or vocal state of the target node changes, the system traverses backward along the directed temporal dependency edges of the same voice part, adding subsequent nodes that depend on the previous node to determine the continuous pitch state, time start point, or prime state access position to the affected node set until a node whose state no longer changes is reached. For synchronous dependencies, nodes whose vocal times overlap with those of already affected nodes and require recalculation are identified. Other voice part nodes for the newly verified cross-voice rules are added to the affected node set; for output resource usage dependencies, nodes that share the same output channel with the already affected nodes are added to the affected node set, and this process continues until the device resource usage is restored to the allowable range; the above three types of dependency propagation processing are repeated until the affected node set no longer increases; the earliest sequence timestamp and the latest end time in the affected node set are obtained, and aligned forward and backward to the preset basic time unit boundary, respectively, and the continuous interval between the aligned start time and end time is determined as the local recalculation window; the most recent sequence data node of the same voice part before the start of the local recalculation window is used as the front boundary reference node, and the most recent sequence data node of the same voice part after the end of the window is used as the back boundary reference node; the sequence data and cached results outside the local recalculation window remain unchanged.
[0030] S700: By correcting the sequence data in the local recalculation window, a multi-part sequence synthesis control command sequence is generated and sent to the audio synthesis device for audio synthesis output; By restoring the prime number state, tonality mapping state, and device resource occupancy state of each voice part at the start of the local recalculation window, the continuity of the local recalculation and the sequence data before the window in terms of generation state can be guaranteed. By controlling the adjustment of the prime number index start position, index span, phase offset, and prime number allocation weight of the edited voice part, multiple traceable correction candidate segments can be formed without changing the prime number state chain access trajectory outside the window. By synchronously updating only the associated voice parts that have actual dependencies on the edited voice part through the multi-voice sequence data dependency graph, and reusing the cached sequence data outside the local recalculation window, it is possible to avoid recalculating the complete music segment and all voice parts, reducing processor computation, cache read / write, and audio synthesis waiting time. At the same time, it reduces the possibility of unexpected changes in pitch, time position, and output channel state of unedited areas caused by local editing, improving the continuity, determinism, and audio synthesis output efficiency of the multi-voice sequence correction results. A multi-voice sequence synthesis control instruction sequence is generated and sent to the audio synthesis device for audio synthesis output, including: The system reads the prime number state, tonality mapping state, and audio synthesis device resource usage state of each voice part corresponding to the starting position of the local recalculation window. It adjusts the starting position, index span, phase offset, and prime number allocation weight of the edited voice part within the local recalculation window, generating multiple correction candidate segments. It also synchronously updates the sequence data of related voice parts that have dependencies on the edited voice part based on the multi-voice sequence data dependency graph. Specifically, based on the start time of the local recalculation window, it reads the state checkpoint located before the start time and closest to it from the state cache, and chains the shared prime number states recorded by the state checkpoint. This identifier, the current prime number state node identifier for each voice part, the state chain access cursor, the prime number index start position, the index span, the phase offset, the current tonality map identifier, the tonality conversion progress, the output channel occupancy status, the sequence data of voices that have not yet finished playing, and the current number of concurrent voices are restored to the initial calculation state of the local recalculation window; for the edited voice part, based on its original prime number index start position, index span, phase offset, and prime number allocation weight, candidate parameters are generated within a preset adjustment range, wherein the prime number index start position is adjusted according to the number of nodes moved forward or backward on the shared prime number state chain. The index span is selected from a set of positive integers that are less than the state chain length and coprime to it. The phase offset is adjusted forward or backward according to the preset number of time positions. The prime number allocation weight is increased or decreased according to the preset adjustment step size and then renormalized so that the sum of the prime number allocation weights of all candidate pitch indices is 1. Different candidate parameters are combined, and a candidate segment identifier is assigned to each parameter combination. Starting from the local recalculation window, the window sequence data of the edited voice part is regenerated according to the shared prime number state chain, tonality mapping table, and voice part configuration parameters. For multi-voice voice part sequence data, the data depends on the graph and the selected voice part. For related voice parts with synchronization dependencies, timing dependencies, or output resource occupancy dependencies, determine whether changes in the sequence timestamp, duration, pitch encoding, vocalization state, or output channel occupancy state of the edited voice part's sequence data alter the corresponding dependency conditions. Only when the dependency conditions change are the affected sequence data nodes of the corresponding related voice parts recalculated; for other related voice part nodes, the original data is directly reused. For each candidate parameter combination, generate a corrected candidate segment containing a candidate segment identifier, adjusted parameters, multi-voice sequence data within the window, related prime number state nodes, and a set of affected nodes. By analyzing the degree of cross-voice rule conflict among each candidate correction segment, a correction evaluation value is determined. The candidate correction segment that meets the preset constraints and has the best correction evaluation value is selected to replace the original sequence data within the local recalculation window. Buffered sequence data outside the local recalculation window is reused to generate a multi-voice sequence synthesis control command sequence. This sequence is then sent to the audio synthesis device for audio synthesis output. Specifically, for each candidate correction segment, according to the preset polyphonic counterpoint rule configuration file, the sequence data of different voices that are at the same time position or whose vocal time intervals overlap within the local recalculation window are verified item by item. The occurrence frequency of various cross-voice rule conflicts is counted. Cross-voice rule conflicts include prohibited interval combinations, voice crossing, continuous unidirectional progressions in adjacent synchronous positions, parallel intervals exceeding the preset allowed number, and other cross-voice anomalies specified by the polyphonic counterpoint rule configuration file. The number of each type of conflict is divided by the actual number of checks for the corresponding rule within the local recalculation window to obtain the conflict ratio for each type. A weighted sum is then performed according to the preset conflict weights for each type of rule to obtain the cross-voice rule conflict severity, ranging from 0 to 1. When the actual number of checks for the corresponding rule is 0, the conflict ratio for that type is recorded as 0. A higher conflict severity indicates a higher degree of conflict. The more cross-voice rule conflicts a candidate segment contains, the more likely it is to cause problems. The result of subtracting the degree of cross-voice rule conflict from the value 1 is determined as the correction evaluation value. Candidate segments that do not meet the constraints of temporal order, voice range, temporal lock state, number of output channels, or maximum concurrent vocalizations are eliminated. The segment with the highest correction evaluation value is selected as the target correction segment from the remaining candidate segments. The target correction segment replaces the original temporal data within the local recalculation window, and the cached temporal data before the local recalculation window, the target correction segment, and the cached temporal data after the local recalculation window are concatenated according to temporal order. The concatenation is then processed accordingly. Each subsequent sound sequence data, based on its sequence timestamp, duration, pitch encoding, velocity parameter, and output channel identifier, generates note activation, note deactivation, timbre switching, and channel control commands. These commands are then arranged under the same sequence timestamp in the order of executing the note deactivation command first, followed by the timbre or channel control command, and finally the note activation command, forming a multi-part sequence synthesis control command sequence. This control command sequence is then sent sequentially to the audio synthesis device according to the sequence timestamp, enabling the audio synthesis device to complete the multi-part audio synthesis output based on the corresponding output channel, pitch encoding, velocity parameter, and duration.
[0031] Please see Figure 4 , Figure 4 This is a schematic diagram of the structure of a prime-number-driven multi-part music generation system provided in an embodiment of the present invention, including: The data acquisition module 210 is used to acquire creative control parameters, voice configuration parameters and audio synthesis device configuration parameters. The creative control parameters include target tonality category, target mood label, tonality operation mode and texture density coefficient. The prime number operation driver module 220 is used to determine the candidate pitch index and establish the prime number state mapping relationship by constructing an ordered prime number array and performing difference and modulo operations on the array elements. The tonality emotion modeling module 230 is used to convert candidate pitch indices into candidate pitches according to the target tonality category, and to filter the candidate pitches through the target music features corresponding to the target emotion label to generate target tonality sequence data; The tonality fusion processing module 240 is used to perform tonality fusion processing on the target tonality sequence data according to the tonality operation mode, and generate multi-tonality fusion sequence data; The polyphony generation module 250 is used to construct a shared prime state chain based on the prime state mapping relationship, and select the sequence data by combining the polytonal fusion sequence data to generate polyphonic sequence data. The visualization verification module 260 is used to construct a multi-voice sequence data dependency graph. By visually verifying the multi-voice sequence data and combining the dependency relationships of each sequence data node, the local recalculation window of the affected sequence data is determined. The synthesis output module 270 is used to generate a multi-part sequence synthesis control command sequence by correcting the sequence data in the local recalculation window and sending it to the audio synthesis device for audio synthesis output.
[0032] The parameters and steps of each unit module in the prime number-driven polyphonic music generation system of the present invention that implement the corresponding functions can be referred to the parameters and steps in the embodiments of the prime number-driven polyphonic music generation method described above, and will not be repeated here.
[0033] Please refer to Figure 5 The present invention also provides an electronic device 300, including a memory 310, a processor 320, and a communication bus 330; the memory 310 and the processor 320 are connected via the communication bus 330. The memory 310 stores a multi-part music generation method based on prime number driving, which can be loaded and executed by the processor 320 as provided in the above embodiments.
[0034] The memory 310 can be used to store instructions, programs, code, code sets, or instruction sets. The memory 310 may include a program storage area and a data storage area. The program storage area may store instructions for implementing an operating system, instructions for at least one function, and instructions for implementing the prime number-driven polyphonic music generation method provided in the above embodiments, etc. The data storage area may store data involved in the prime number-driven polyphonic music generation method provided in the above embodiments, etc.
[0035] Processor 320 may include one or more processing cores. Processor 320 executes instructions, programs, code sets, or instruction sets stored in memory 310, and calls data stored in memory 310 to perform various functions and process data according to the present invention. Processor 320 may be at least one of the following: Application Specific Integrated Circuit (ASIC), Digital Signal Processor (DSP), Digital Signal Processing Device (DSPD), Programmable Logic Device (PLD), Field Programmable Gate Array (FPGA), Central Processing Unit (CPU), Controller, Microcontroller, and Microprocessor. It is understood that, for different devices, the electronic devices used to implement the functions of processor 320 may also be other types, and the embodiments of the present invention do not specifically limit this.
[0036] The communication bus 330 may include a path for transmitting information between the aforementioned components. The communication bus 330 may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus, etc. The communication bus 330 can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 5 The symbol is represented by a single double arrow, but this does not mean that there is only one bus or one type of bus.
[0037] This invention provides a computer-readable storage medium storing a computer program that can be loaded by a processor and executed as described in the above embodiments, using a prime-driven polyphonic music generation method.
[0038] In this embodiment of the invention, the computer-readable storage medium can be a tangible device that holds and stores instructions used by an instruction execution device. The computer-readable storage medium can be, but is not limited to, an electrical storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any combination thereof. Specifically, the computer-readable storage medium can be a portable computer disk, a hard disk, a USB flash drive, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), lectern random access memory (SRAM), portable compact disc read-only memory (CD-ROM), digital multifunction disc (DVD), memory stick, floppy disk, optical disk, magnetic disk, mechanical encoding device, or any combination thereof.
[0039] The terms “comprising,” “including,” or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus.
[0040] The above description is merely a preferred embodiment of the present invention and an explanation of the technical principles employed. Those skilled in the art should understand that the scope of this application is not limited to the technical solutions formed by specific combinations of the above-described technical features, but should also cover other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the foregoing concept. For example, technical solutions formed by substituting the above-described features with (but not limited to) technical features with similar functions claimed in this invention.
Claims
1. A method for generating polyphonic music based on prime numbers, characterized in that, include: Acquire creative control parameters, voice configuration parameters, and audio synthesis device configuration parameters. The creative control parameters include target tonality category, target mood label, tonality operation mode, and texture density coefficient. By constructing an ordered prime number array and performing difference and modulo operations on the array elements, candidate pitch indices are determined and prime number state mapping relationships are established. Based on the target tonality category, the candidate pitch index is converted into candidate pitch, and the candidate pitch is filtered by the target music features corresponding to the target emotion tag to generate target tonality sequence data; Based on the tonality operation mode, the target tonality sequence data is subjected to tonality fusion processing to generate multitonality fused sequence data; A shared prime state chain is constructed based on the prime state mapping relationship, and multi-tone fusion sequence data is selected to generate multi-voice sequence data. Construct a multi-voice sequence data dependency graph, perform visual verification of the multi-voice sequence data, and determine the local recalculation window of the affected sequence data by combining the dependency relationship of each sequence data node; By correcting the sequence data in the local recalculation window, a multi-part sequence synthesis control command sequence is generated and sent to the audio synthesis device for audio synthesis output.
2. The method for generating multi-part music based on prime number-driven methods according to claim 1, characterized in that, The process of determining candidate pitch indices and establishing prime number state mapping relationships includes: Extract prime numbers from the range 2 to 100 and construct an ordered prime number array in ascending order of prime numbers; Select the first prime number and the second prime number from the ordered prime number array according to the preset index interval, calculate the difference between the first prime number and the second prime number, and obtain the prime number offset; Perform a modulo-12 operation on the prime number offset and use the remainder as the candidate pitch index corresponding to the twelve-tone equal temperament pitch category; Prime state nodes are generated based on the index positions of the first and second prime numbers in the ordered prime array, the prime number offset, and the candidate pitch index, and prime state node identifiers are assigned to the prime state nodes. Generate a candidate pitch generation record that includes a prime number state node identifier, the index position of the first prime number, the index position of the second prime number, the prime number offset, and the candidate pitch index, and establish a prime number state mapping relationship between the candidate pitch generation record and the corresponding prime number state node.
3. The method for generating multi-part music based on prime number-driven methods according to claim 1, characterized in that, The process of converting candidate pitch indices into candidate pitches includes: Based on the target tonality category, the corresponding tonality generation branch is retrieved from the preset standardized tonality information library. The preset standardized tonality information library includes standardized tonality information corresponding to Chinese pentatonic scale, Chinese hexatononic scale, Chinese heptatonic scale, Western major and minor scales, medieval synthetic scales, modern augmented and diminished scales, interval characteristic scales, symmetrical transposed scales, overtone scales, and exotic characteristic scales. The prime number allocation weight of each candidate pitch index is determined based on the value of each prime number in the ordered prime number array, the array position, and the corresponding prime number offset. Candidate pitch indices are selected based on the weights assigned to prime numbers, and the pitch mapping table corresponding to the tonality generation branch is used to determine the pitch encoding of the selected candidate pitch indices within the corresponding tonality structure, and the candidate pitch indices are converted into candidate pitches.
4. The method for generating multi-part music based on prime number-driven methods according to claim 1, characterized in that, The step of filtering candidate pitches based on target music features corresponding to target emotion tags to generate target tonality sequence data includes: Obtain the target music feature vector corresponding to the target emotion tag from the preset emotion feature database. The target music feature vector includes the pitch change rate and the pitch sequence data density. Extract the pitch change rate and pitch sequence data density of the candidate tonality sequence data formed by each candidate pitch to form a candidate music feature vector; Calculate the feature matching degree between the candidate music feature vector and the target music feature vector, and determine the target tonality sequence data based on the feature matching degree and the prime numbers corresponding to the candidate pitch indices.
5. The method for generating multi-part music based on prime number-driven methods according to claim 1, characterized in that, The step of performing tonal fusion processing on the target tonal sequence data according to the tonal operation mode to generate multi-tonal fused sequence data includes: When the tonality operation mode is static fixed tonality mode, the tonality sequence data is continuously generated according to the tonality mapping table corresponding to the target tonality to obtain multitonality fusion tonality sequence data; When the tonality operation mode is dynamic gradual tonality mode, the tonality conversion cost and tonality conversion window are determined based on the proportion of common pitch levels between adjacent target tones, the differences in tonality characteristics, and the amount of pitch shift. Within the tonality conversion window, the prime number allocation weights of the candidate pitch indices are adjusted step by step according to the tonality conversion direction, so that the tonality mapping table used for the tonality sequence data gradually switches from the tonality before conversion to the tonality after conversion, generating multitonality fused tonality sequence data.
6. The method for generating multi-part music based on prime number-driven methods according to claim 1, characterized in that, The step of constructing a shared prime state chain based on the prime state mapping relationship and selecting sequence data by combining multitonal fusion sequence data to generate multi-part sequence data includes: A shared prime state chain is constructed based on the prime state mapping relationship corresponding to the ordered prime array. The prime index starting position, index span, and phase offset are configured for each voice part according to the number of voice parts. Based on the prime index starting position, index span and phase offset of each voice part, prime state nodes are extracted from the shared prime state chain to generate the hierarchical prime subsequence corresponding to each voice part. Based on the prime state nodes corresponding to each layer of prime subsequences, the sequence data of each voice part is selected from the multitonal fusion sequence data. The pitch encoding of the selected sequence data is mapped to the voice part register according to the range of each voice part. The vocal state of each voice part at different time positions is determined according to the texture density coefficient. Multi-voice sequence data including sequence timestamp, duration, pitch encoding, dynamic parameters, voice part identifier, output channel identifier, and prime state node identifier is generated.
7. The method for generating multi-part music based on prime number-driven methods according to claim 1, characterized in that, The determination of the local recalculation window for the affected sequence data includes: Based on the temporal relationship between adjacent sequence data within the same voice part, the synchronization relationship between sequence data of different voice parts produced simultaneously, and the occupancy relationship of each sequence data on the output resources of the audio synthesis device, a multi-voice sequence data dependency graph is constructed. Based on the preset polyphony counterpoint rule configuration file, the temporal sequence, the range of each voice part, the number of output channels of the audio synthesis device, and the maximum number of concurrent voices, the multi-voice sequence data is constrained to obtain the multi-voice sequence data to be verified. Scan the multi-part sequence data to be verified, identify abnormal sequence data combinations that do not meet the constraints of the polyphony counterpoint rule configuration file, sequence time order, part range, or audio synthesis device output resources, and determine the responsible part and the abnormal prime number state node corresponding to the abnormal sequence data based on the part to which each abnormal sequence data belongs, the sequence locking status, and the dependency propagation range caused by modifying the corresponding sequence data. The visual interactive interface displays the multi-part tone sequence data to be verified and receives drag, cut, recombination or partial modification operations performed on the music segment. The prime number state node corresponding to the tone sequence data involved in the operation is determined as the edit state node. Using abnormal prime number state nodes or edit state nodes as target state nodes, and based on the temporal dependency, synchronization dependency, and output resource consumption dependency of the target state nodes in the multi-voice sequence data dependency graph, all affected sequence data nodes are determined, and a local recalculation window is generated.
8. The method for generating multi-part music based on prime number-driven methods according to claim 1, characterized in that, The process of generating a multi-part tone sequence synthesis control command sequence and sending it to the audio synthesis device for audio synthesis output includes: Read the prime number status, tonality mapping status and audio synthesis device resource occupancy status of each voice part corresponding to the starting position of the local recalculation window, adjust the starting position of the prime number index, index span, phase offset and prime number allocation weight of the edited voice part in the local recalculation window, generate multiple correction candidate segments, and synchronously update the related voice part sequence data that has a dependency relationship with the edited voice part according to the multi-voice sequence data dependency graph. By analyzing the degree of cross-part rule conflict among each candidate segment for correction, the correction evaluation value is determined. The candidate segment that meets the preset constraints and has the best correction evaluation value is selected to replace the original sequence data in the local recalculation window. The cached sequence data outside the local recalculation window is reused to generate a multi-part sequence synthesis control instruction sequence. The multi-part sequence synthesis control instruction sequence is sent to the audio synthesis device for audio synthesis output.
9. A prime-number-driven polyphonic music generation system, used to implement the prime-number-driven polyphonic music generation method according to any one of claims 1-8, characterized in that, The system includes: The data acquisition module is used to acquire creative control parameters, voice configuration parameters, and audio synthesis device configuration parameters. The creative control parameters include target tonality category, target mood label, tonality operation mode, and texture density coefficient. The prime number operation driver module is used to determine the candidate pitch index and establish the prime number state mapping relationship by constructing an ordered prime number array and performing difference and modulo operations on the array elements. The tonality emotion modeling module is used to convert candidate pitch indices into candidate pitches based on the target tonality category, and to filter the candidate pitches through the target music features corresponding to the target emotion label, thereby generating target tonality sequence data. The tonality fusion processing module is used to perform tonality fusion processing on the target tonality sequence data according to the tonality operation mode, and generate multi-tonality fusion sequence data; The multi-part polyphony generation module is used to construct a shared prime state chain based on the prime state mapping relationship, and select the sequence data by combining the multitonal fusion sequence data to generate multi-part sequence data; The visualization verification module is used to construct a dependency graph of multi-voice sequence data. By visually verifying the multi-voice sequence data and combining the dependency relationships of each sequence data node, the local recalculation window of the affected sequence data is determined. The synthesis output module is used to generate a multi-part sequence synthesis control command sequence by correcting the sequence data in the local recalculation window and sending it to the audio synthesis device for audio synthesis output.
10. An electronic device, comprising: A processor and a memory, wherein the memory stores a computer program that can be called by the processor; characterized in that the processor executes the prime-driven polyphonic music generation method as described in any one of claims 1-8 by calling the computer program stored in the memory.