Personalized music generation method and system based on electroencephalogram signal analysis
By integrating multi-source information through lightweight EEG acquisition devices and AI collaborative mapping models, the problems of device complexity and low adaptability in personalized music generation are solved, enabling ready-to-use and high-precision personalized music generation that adapts to daily scenarios and improves user experience.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- HANGZHOU HAOSHI TIANHUI TECHNOLOGY CO LTD
- Filing Date
- 2026-04-15
- Publication Date
- 2026-05-12
AI Technical Summary
Existing technologies fail to effectively integrate multi-source information when generating personalized music, ignore user baseline differences and individual characteristics, and cannot adapt to the dynamic changes in users' psychological state in real time, resulting in low music adaptability. Furthermore, the devices are complex to operate and difficult to promote in everyday scenarios.
Using a lightweight head-mounted EEG acquisition device, combined with multi-source data fusion and an AI collaborative mapping model, personalized music is generated through dual feature extraction and real-time feedback dynamic adjustment.
It achieves convenient data collection that can be used immediately upon application, with high data integrity and consistency, improved accuracy in matching music parameters, and the ability to adapt to the user's psychological state in real time and conform to long-term habits, thereby improving the user experience and the reliability of treatment effect evaluation.
Smart Images

Figure CN122006059A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of electroencephalogram (EEG) signal processing technology, and in particular to a personalized music generation method and system based on EEG signal analysis. Background Technology
[0002] Brainwave music synthesis technology, an interdisciplinary field between electroencephalography (EEG) and music engineering, has evolved from early "brainwave vocalization" to practical applications such as biofeedback and hypnotic intervention. Its core relies on the correspondence between EEG parameters and musical elements—EEG period corresponds to pitch, amplitude to volume, and average energy change to intensity. Furthermore, the scale-free nature of EEG signals provides theoretical support for the technology's implementation. With the increasing demand for mental health services and the growing trend towards personalized consumption, user demand for customized music that matches dynamic psychological states has surged, but current technologies still have significant shortcomings.
[0003] Traditional solutions often employ uniform frequency mapping rules, neglecting baseline differences and individual characteristics of different users' EEG signals. This results in music generation failing to accurately capture individual emotional fluctuations, significantly reducing its suitability. Acquisition equipment is mostly heavy-duty industrial-grade instruments, bulky and complex to operate, relying on conductive gel and specialized electromagnetic shielding environments, requiring specialized personnel for operation. This makes them completely unsuitable for the convenient acquisition needs of everyday scenarios, limiting the large-scale promotion of the technology. Data fusion is limited in scope; most solutions rely solely on single EEG data, failing to effectively integrate multi-source information such as psychological assessment results and historical adaptation preferences. Furthermore, feature extraction often focuses on instantaneous states, neglecting long-term historical trends, leading to incomplete characterization of user psychological states and a lack of consistency in music adaptation. In addition, most solutions are one-time generation models, failing to collect user EEG feedback in real-time during music playback and dynamically optimize parameters. This makes them unable to cope with real-time fluctuations in user emotions, resulting in limited long-term adaptation effects and failing to truly achieve the core requirement of dynamic fit. Summary of the Invention
[0004] This invention achieves precise generation of personalized music that matches the user's dynamic psychological state by combining dual feature extraction and AI collaborative mapping model with a real-time EEG feedback dynamic adjustment mechanism.
[0005] The technical solution proposed in this invention is: a personalized music generation method based on electroencephalogram (EEG) signal analysis, the method comprising: Collect multi-dimensional data, including raw EEG data, psychological state assessment data, and historical assessment data. Perform multi-dimensional verification and correlation fusion on the multi-dimensional data to obtain correlated fused data. Based on correlated and fused data, a user psychological feature dataset is constructed through multi-dimensional data structuring. Simultaneously extract the core features of the user's current psychological state and the long-term historical trend features from the user's psychological feature dataset, and establish a dual-feature and music parameter collaborative mapping model; The initial music is generated by combining the core features of the user's current psychological state with long-term historical trend features through a dual-feature weighted fusion algorithm with differentiated weight configuration. Set a treatment cycle, collect the user's psychological state score before and after the treatment cycle, and determine the treatment effect level based on the change in score and preset standards; Based on the treatment effect level, and combined with the dual-feature and music parameter collaborative mapping model and long-term historical trend features, the core parameters of the music are adjusted to generate optimized personalized music.
[0006] Preferably, the specific process for obtaining the multi-source data is as follows: EEG signals are collected from the key monitoring channels of the user under test at a preset sampling frequency to obtain raw EEG data. Based on raw EEG data, psychological state assessment data including depression risk score, anxiety risk score and mood fluctuation level are generated through psychological state quantitative assessment logic. Historical evaluation data is obtained by retrieving users' past evaluation records, adapted music parameters, and feedback data from the system's historical database. Based on user identifiers, raw EEG data, psychological state assessment data, and historical assessment data are correlated and encapsulated to obtain encapsulated data. The identity consistency of the encapsulated data is verified based on the unified user identifier. The temporal relationship of different types of data is aligned by collecting timestamps, and multi-dimensional association verification is completed by combining data collection scenario tags to obtain multi-dimensional data.
[0007] Preferably, the specific process for obtaining the associated fused data is as follows: A multi-source data spatiotemporal alignment algorithm was used to eliminate dimensional differences and calibrate temporal biases in the original EEG data, psychological state assessment data and historical assessment data in the multi-source data to obtain aligned data. An outlier removal algorithm is used to filter and remove outliers from the aligned data, resulting in outlier-free data. The outlier-removing data was normalized using a standardization method to obtain standardized data. Based on the data type, differentiated weights are assigned to standardized data, and Bayesian fusion algorithm is used to perform association and fusion calculations on the standardized data to obtain fused intermediate data; The intermediate data is structured and encapsulated to obtain the associated fused data.
[0008] Preferably, the specific process for obtaining the user psychological feature dataset is as follows: Based on the correlation and fusion of data, a standardized dataset of user psychological characteristics will be constructed; A three-level data structure framework, comprising time-series, feature, and indicator dimensions, is constructed based on a standardized user psychological feature dataset. The time-series dimension links assessment data from different time points, the feature dimension is divided into EEG features, current psychological state features, and historical trend features, and the indicator dimension clarifies the specific quantitative parameters corresponding to each feature; The associated and fused data is classified and populated according to a three-level framework, and the matching of the data with each dimension is verified simultaneously and abnormal data is removed. After completing the data filling and validation, the data is standardized to obtain a user psychological feature dataset.
[0009] Preferably, the specific process for obtaining the core features of the user's current psychological state and the long-term historical trend features is as follows: Using the user identifier as the primary key, the corresponding full feature data set is extracted from the user psychological feature dataset to obtain the user feature set; A parallel extraction framework is built using a dual-branch feature extraction network, which splits the user feature set to obtain the current state feature subset and the historical time series feature subset. The core features of the current psychological state are obtained by filtering and extracting the core features of the current state feature subset through principal component analysis algorithm. A subset of historical time-series features is smoothed using time-series sequence processing, and a trend fitting model is used for trend analysis and feature extraction to obtain initial historical trend features. To remove redundant features from the initial historical trend features by setting a feature filtering threshold, features that have a significant impact on music compatibility are retained, thus obtaining long-term historical trend features. The core features of the current psychological state are synchronously associated and encapsulated with the features of long-term historical trends, thus completing the synchronous extraction of dual features.
[0010] Preferably, the specific process for obtaining the dual-feature and music parameter co-mapping model is as follows: A preset music parameter library contains music parameters and their corresponding ranges for four core dimensions: rhythm, mode, intensity, and timbre. Collect dual-feature samples under different psychological states and corresponding music parameter samples to construct model training dataset and model testing dataset; Using dual features as input variables and music parameters as output variables, a mapping model framework is built using a BP neural network algorithm. The mapping model framework is trained based on the model training dataset to obtain the initial mapping model; The accuracy of the initial mapping model is verified using the model test dataset. When the adaptation error is lower than the preset threshold, the collaborative mapping model of dual features and music parameters is established.
[0011] Preferably, the specific process for obtaining the initial music is as follows: Based on the user's psychological state adaptation priority, differentiated weighted fusion weights are assigned to the core features of the current psychological state and the long-term historical trend features to obtain the weight configuration rules; The two types of features extracted simultaneously are input into a dual-feature weighted fusion algorithm, and the fused feature vector is calculated by combining the weight configuration rules. The fused feature vector is input into the dual feature and music parameter co-mapping model, and the model outputs the adapted initial music parameter combination; The initial music is generated by performing music generation processing based on the initial music parameter combination; Record the feature fusion logic and parameter output results to complete the optimized generation of the initial music.
[0012] Preferably, the specific process for obtaining the optimized personalized music is as follows: Set configurable treatment cycles, with cycle duration adaptively adjusted based on the severity of the user's psychological state and historical treatment feedback; The start and end points of the treatment cycle are determined based on the quantitative assessment logic of psychological state. Psychological state scores before and after treatment are generated through a multi-dimensional data collection and correlation fusion process. Calculate the change in scores before and after treatment, and determine the treatment effect level based on preset standards; Extract the updated long-term historical trend features of the data included in this treatment cycle, and combine the dual-feature and music parameter co-mapping model to adjust the music parameters according to the treatment effect level. Optimized personalized music is generated based on the adjusted parameters.
[0013] The present invention also provides a personalized music generation system based on electroencephalogram (EEG) signal analysis, the system being used to execute the aforementioned personalized music generation method based on EEG signal analysis.
[0014] The present invention also provides a computer-readable storage medium storing a computer program that is executed by a processor to implement the aforementioned personalized music generation method based on electroencephalogram (EEG) signal analysis.
[0015] The beneficial effects of this invention are: 1. Employing a lightweight, head-mounted EEG acquisition device with patch-type Ag / AgCl electrodes and a magnetic connection design, this system allows for convenient data acquisition without the need for conductive gel or electromagnetic shielding. Suitable for everyday scenarios such as home and office, it completely breaks away from the dependence of traditional industrial-grade equipment on specialized environments and personnel, significantly lowering the barrier to entry and facilitating large-scale technology adoption. Simultaneously, by integrating multi-source information including EEG signals, psychological assessment data (depression / anxiety scores, mood levels), and historical adaptation preferences, and through spatiotemporal alignment, dual outlier removal, standardization processing, and Bayesian fusion algorithms, it effectively eliminates data dimensional differences and temporal biases, ensuring data integrity ≥99% and consistency ≥99.5%.
[0016] 2. A dual-branch network is used to simultaneously extract the core features of the user's current psychological state and long-term historical trend features. The PCA algorithm is then used to filter 8-dimensional real-time core features (including...). / By combining power ratio, depression risk score, etc., with moving average and trend fitting models, 3-4 dimensional long-term trend features are extracted, taking into account both instantaneous emotions and long-term preferences, thus solving the problem of inconsistent adaptation caused by traditional solutions that only focus on a single state. A dual-feature and music parameter co-mapping model built on a BP neural network, after training with 10,000 samples, achieves a rhythm adaptation error ≤5 BPM and a mode accuracy ≥85%, significantly improving the personalized matching accuracy of music parameters. Simultaneously, the model supports dynamic updates and incremental learning; the parameter range is optimized every 1000 valid feedbacks, continuously adapting to individual EEG differences among users. The generated music not only matches real-time psychological states but also conforms to long-term adaptation habits, greatly enhancing the user experience.
[0017] 3. Construct a closed-loop system of music generation, periodic scoring assessment, and parameter optimization. Based on the severity of the user's initial psychological state (depression / anxiety score <40 is normal, 40-60 is mild, >60 is severe), adaptively configure the treatment cycle (normal requires no adjustment, mild requires 1-2 weeks, severe requires 3-4 weeks), and collect scoring data in a standardized manner before and after each cycle. By calculating the change in score and combining it with statistical significance testing, accurately determine the treatment effect levels such as significantly effective, effective, mildly effective, ineffective, and worsening. Then, based on a dual-feature mapping model and trend fusion framework, adjust the music parameters in a targeted manner according to the principle of prioritizing core parameters—significantly effective: fine-tune secondary parameters; effective: fine-tune core parameters; mildly effective: optimize core parameters plus secondary parameters; ineffective: regenerate core parameters; worsening: trigger transitional music and secondary data collection. The magnitude of each adjustment is controllable and does not exceed the historical adaptation boundary, avoiding sudden changes in music style. This mechanism effectively addresses the pain points of traditional one-time generation models, which cannot quantify treatment effects and lack long-term adaptability. Through periodic evaluation and up to five gradual fine-tunings, it ensures that the music not only matches the user's real-time psychological state but also continuously adapts to long-term treatment needs, significantly improving intervention effects in scenarios such as emotional relaxation and anxiety relief. At the same time, the generated parameter adjustment reports and treatment effect analysis reports provide a complete basis for subsequent model iterations and effect tracking, further enhancing the practicality and iterability of the solution. Attached Figure Description
[0018] Figure 1 A flowchart of a personalized music generation method based on electroencephalogram (EEG) signal analysis; Figure 2 This is a flowchart illustrating the music generation process of a personalized music generation method based on electroencephalogram (EEG) signal analysis. Detailed Implementation
[0019] The following description is intended to disclose the present invention and enable those skilled in the art to implement it. The preferred embodiments described below are merely examples, and other obvious variations will occur to those skilled in the art. The basic principles of the invention defined in the following description can be applied to other embodiments, modifications, improvements, equivalents, and other technical solutions that do not depart from the spirit and scope of the invention.
[0020] It is understood that the term "a" should be understood as "at least one" or "one or more," that is, in one embodiment, the number of an element can be one, while in another embodiment, the number of the element can be multiple, and the term "a" should not be understood as a limitation on the number.
[0021] like Figure 1 and Figure 2As shown, the process involves collecting multi-dimensional data and fusing it to obtain correlated and fused data. Based on this correlated and fused data, a user psychological feature dataset is constructed through multi-dimensional data structuring. The core features of the user's current psychological state and long-term historical trend features are simultaneously extracted from this dataset, establishing a dual-feature and music parameter co-mapping model. A dual-feature weighted fusion algorithm is used to fuse the core features of the user's current psychological state and long-term historical trend features to optimize and generate initial music. A configurable treatment cycle is set, and user psychological state scores are collected before and after each cycle. The treatment effectiveness level is determined based on the change in scores and a preset standard. Based on the treatment effectiveness level, combined with the dual-feature and music parameter co-mapping model and long-term historical trend features, the core music parameters are adjusted to generate optimized personalized music. Through multi-dimensional data collection and fusion, psychological feature extraction, dual-feature and music parameter mapping, and real-time feedback adjustment, a fully implementable technical system is constructed.
[0022] Furthermore, multi-source data is collected and correlated to obtain correlated and fused data, as detailed below: EEG signals were collected from key monitoring channels of the user under test at a preset sampling frequency to obtain raw EEG data. Based on the raw EEG data, psychological state assessment data including depression risk score, anxiety risk score, and mood fluctuation level were generated through psychological state quantitative assessment logic. Historical assessment data was obtained by retrieving the user's past assessment records, adapted music parameters, and feedback data from the system's historical database. Based on the user identifier, the raw EEG data, psychological state assessment data, and historical assessment data were associated and encapsulated with production events to obtain encapsulated data. The identity consistency of the encapsulated data was verified based on the unified user identifier, and the temporal relationship of different types of data was aligned by the collection timestamp. Multi-dimensional association verification was completed by combining data collection scenario tags to obtain multi-dimensional data.
[0023] The multi-dimensional data acquisition module includes a head-mounted EEG acquisition device (containing the headpiece, EEG electrode pads, and magnetic connecting wires) for EEG signal acquisition, an interactive terminal for psychological assessment, and a database access unit for retrieving historical data. This lightweight data acquisition system, designed for the personalized music generation and perception layer, is located between the user terminal and the central data platform. It achieves comprehensive acquisition of user status data through real-time multi-dimensional data acquisition and preprocessing. This module records complete information on the user's EEG characteristics, psychological state, and historical adaptation preferences from the start to the completion of the acquisition process. It covers the data acquisition needs of users in different psychological states (such as relaxation, anxiety, and focus), is suitable for users aged 18-60, and supports flexible configurations for single acquisition durations ranging from 30 minutes to 2 hours.
[0024] The detailed implementation logic of multi-source data acquisition is as follows: Raw EEG data was acquired using a head-mounted EEG acquisition device with a preset sampling frequency of 250Hz (compliant with Shannon's sampling theorem, covering the 0.5-30Hz emotion-related frequency band). The key monitoring channel was selected in the core forehead region (corresponding to the Fp1 / Fp2 region of the international 10-20 system). Channel positioning strictly followed the international 10-20 system standard, with a positioning error ≤2mm. During acquisition, patch-type Ag / AgCl electrodes (8mm in diameter, impedance ≤5kΩ, ready to use without conductive gel) were used. The electrodes were fixed to the head-mounted device with clips, ensuring close contact with the skin under the earlobe. The signal link was established by magnetically attaching the electrodes to the corresponding interface on the head-mounted device. The data collection environment should meet the requirements of a temperature of 20-25℃ and a relative humidity of 40%-60%. No additional electromagnetic shielding is required. It is suitable for daily scenarios such as offices and homes. At the same time, wear the matching closed headphones (noise reduction rate ≥25dB) to isolate environmental noise and turn on the device's built-in 50Hz notch filter (Q=30, attenuation ≥40dB) and 0.5-30Hz bandpass filter (Butterworth 4th order).
[0025] The specific data collection process is as follows: Take out the main body of the head-mounted EEG device and the patch-type EEG electrodes; insert the patch-type EEG electrodes into the buckles of the head-mounted device; attach the electrodes on both sides to the area below the earlobes of the test subject (ensuring that the electrodes are in close contact with the skin); attach the magnetic connection cable to the corresponding interface of the head-mounted device to complete the signal link connection; wear the matching closed headphones to isolate environmental noise and complete the data collection preparation.
[0026] The core parameters of the device are: 16-bit sampling accuracy, input impedance ≥100MΩ, noise ≤1μVrms@0.1-100Hz, device weight ≤100g, and support for Bluetooth Low Energy transmission (latency ≤100ms). The generation of psychological state assessment data employs a dual-dimensional assessment logic using EEG characteristics and scale standards. The depression risk score combines the Hamilton Depression Rating Scale (HAMD-17, 2017 version) with... / The power-to-weight ratio (HAMD) score ranges from 0 to 100. The calculation method is: Depression Score = 0.6 × (HAMD raw total score / 68 × 100) + 0.4 × ( / The power ratio (×100) and weights were determined by ROC analysis of 500 clinical samples (AUC≥0.85). / A power ratio ≤ 0.8 indicates a high tendency towards depression; anxiety risk scoring was performed using the Self-Rating Anxiety Scale (SAS, 20-item version) and... Wave power density correlation, calculated as anxiety score = 0.5 × ((SAS raw total score - 20) / 60 × 100) + 0.5 × ( Wave power density / 50), Wave power density ≥100 Increased risk of anxiety; mood fluctuation level based on EEG over the past 5 minutes. , , Wave power is categorized into 5 levels based on the combined standard deviation (≤0.1 for level 1, 0.1-0.2 for level 2, 0.2-0.3 for level 3, 0.3-0.4 for level 4, and ≥0.4 for level 5), with an accuracy rate of ≥83%. All assessment data must be reviewed by personnel holding a National Level II Psychological Counselor Certificate, with a review pass rate of ≥95%. Historical assessment data is retrieved from a MySQL cluster database (master-slave replication architecture, latency ≤1 second), covering valid records within the past 3 months (collection time ≥30 minutes, no anomaly indicators), including assessment results, music parameters (rhythm BPM, mode, intensity dB, timbre), and user feedback (satisfaction score 0-5, parameter adjustment records). User identification uses a "UID-XXX-YYYY" combination primary key (XXX is the organization code, and YYYY is the device number). Data integrity verification covers 10 core fields with an effectiveness rate of ≥95%. If fewer than 5 records are retrieved, the default parameters for the same age group / gender are used to supplement them (error ≤10%). After data retrieval, sensitive information such as name and ID number is hidden.
[0027] Specifically, the operations for production event correlation, encapsulation, and multi-dimensional correlation verification are as follows: Based on user identifier primary key matching and timestamp-assisted verification, the data is encapsulated in JSON format. Fields include user identifier, collection timestamp (start and end times, accurate to milliseconds), EEG data segments (stored in 10-second segments), psychological assessment results, historical data summaries (the last 3 key records), and device number. After encapsulation, CRC32 verification ensures transmission integrity. Identity consistency verification uses MD5 encryption to verify the user identifier, preventing data tampering. Time alignment uses linear interpolation to handle time deviations (error ≤ 500ms). For example, if the time difference between EEG collection and psychological assessment is ≤ 2 seconds, interpolation is performed proportionally to the timestamp. During association verification, it is necessary to ensure that the labels of the same data set are consistent. Data that fails verification is marked as abnormal and prompts for re-collection. Ultimately, the multivariate data integrity is ≥ 99.9%, and consistency is ≥ 99.5%. The multi-dimensional data acquisition module enables real-time and multi-dimensional acquisition of user status data. Event association and encapsulation endow the data with a complete business context, and multi-dimensional association verification ensures data consistency and validity, providing high-quality raw data for subsequent association and fusion. The acquisition devices are all mature and lightweight products that support long-term stable operation and are adapted to the daily acquisition needs. The data processing flow complies with industrial-grade data governance standards, ensuring that the data can be directly used for subsequent feature extraction and model training.
[0028] Furthermore, the multi-source data is correlated and fused to obtain correlated and fused data, as detailed below: A multi-source data spatiotemporal alignment algorithm is employed to eliminate dimensional differences and calibrate temporal deviations in the original EEG data, psychological state assessment data, and historical assessment data from a multi-source dataset, resulting in aligned data. An outlier removal algorithm is then used to filter and remove outliers from the aligned data, yielding de-outlier data. A standardization method is used to normalize the de-outlier data, resulting in standardized data. Differential weights are assigned to the standardized data based on data type, and a Bayesian fusion algorithm is used to perform association and fusion calculations on the standardized data, resulting in intermediate fusion data. The intermediate fusion data is then structured and encapsulated to obtain the associated fused data. The core spatiotemporal logic of the multi-source data involves timestamp baseline alignment and dimensional completion. Using the sampling timestamp of the original EEG data as the sole benchmark, the psychological state assessment data (single time point) is evenly distributed to each EEG sampling segment according to the collection duration (e.g., 1 minute of assessment data is distributed to 6 10-second EEG segments). Historical assessment data is matched to the current collection period according to the principle of the closest time (time difference ≤ 1 week is given priority for matching). The time deviation calibration adopts the linear interpolation method to complete the missing time point data. The elimination of dimensional differences is achieved through data format standardization (e.g., the unit of historical music rhythm is unified to BPM, and the unit of sound intensity is unified to dB).
[0029] In detail, the outlier removal algorithm employs 3 A dual approach, combining criteria and domain experience thresholds, ensures accurate identification of outlier data. 3 The criteria determination steps are as follows: group the data according to the collection type (EEG characteristics, psychological scores, historical parameters), and calculate the mean of the numerical data in each group. with unbiased standard deviation Remove those exceeding [ , [Data range; Domain experience threshold determination rule is that the absolute value of the EEG signal voltage is ≥100] (Spirit spike noise) Directly remove the corresponding 10-second data segment. Normal power range: 50-200 , Wave power 30-150 , Wave power 20-100 Any data exceeding the specified range is considered abnormal. Psychological state scores are strictly limited to 0-100 points, and emotional fluctuation levels are limited to 1-5 levels; non-integer levels are considered abnormal. Historical music parameters are defined as follows: tempo 60-120 BPM, intensity 60-85 dB, mode coding 1-14, and timbre coding 1-6; any data exceeding these ranges is considered abnormal. Abnormal data processing employs a removal and imputation strategy. After removing abnormal data segments, the mean of adjacent valid data is used to fill the gaps. If there is no valid data before or after the gap, the average data of users of the same type (same age group, same emotional level) is used to fill the gap. After imputation, the data error is ≤10%, and the data validity rate after anomaly removal is ≥98%.
[0030] Specifically, the standardization process selects the appropriate method based on the data distribution characteristics: normally distributed data (such as power of each frequency band of EEG and psychological scores) uses Z-score standardization, calculated as standardized value = (original value - mean) / standard deviation, resulting in a mean ≈ 0 and a standard deviation ≈ 1 after processing; non-normally distributed data (such as mood fluctuation levels and satisfaction scores) uses Min-Max standardization, mapping to the [0,1] interval, calculated as standardized value = (original value - minimum value) / (maximum value - minimum value). Weight allocation is determined based on the correlation strength between each data type and music adaptation requirements. Multiple batches of experiments have verified that the weights for raw EEG data (0.4, directly reflecting real-time psychological state), psychological state assessment data (0.3, quantifying assessment results), and historical assessment data (0.3, reflecting long-term trends) are the highest. Under this weight allocation, the Pearson correlation coefficient between the fusion features and music adaptation is the highest. The core formula of the Bayesian fusion algorithm is P(A|B)=P(B|A)P(A) / P(B), where A is the fused psychological feature and B is each standardized data point. The prior probability P(A) is obtained through training with over 10,000 historical user data points. The posterior probability is calculated by combining the likelihood probability P(B|A), and the final output is the fused feature value. The intermediate fusion data is structured and encapsulated in JSON-LD format, with fields including user identifier, fusion timestamp, fusion feature values for each dimension, data fusion accuracy (error ≤3%), and fusion algorithm version number. The encapsulated data is stored in a Redis cache (1-hour cache time) and a database (long-term archive), supporting fast retrieval and traceability. The algorithm eliminates dimensional and temporal biases through spatiotemporal alignment of multi-source data, ensures data validity through double outlier removal, unifies data dimensions through standardization, and achieves accurate fusion of multi-dimensional features through the Bayesian fusion algorithm. The entire process is time-efficient and highly accurate, and the fused data comprehensively and accurately depicts the user's psychological state, providing high-quality foundational data for the subsequent construction of psychological feature datasets.
[0031] Furthermore, a user psychological feature dataset is constructed based on the correlated and fused data, the details of which are as follows: Based on the associated and fused data, a standardized user psychological feature dataset is constructed. A three-level data structure framework, comprising time-series, feature, and indicator dimensions, is then built upon this standardized dataset. The time-series dimension associates assessment data from different time points; the feature dimension is divided into EEG features, current psychological state features, and historical trend features; and the indicator dimension specifies the concrete quantitative parameters corresponding to each feature. The associated and fused data is then categorized and populated according to the three-level framework, with simultaneous verification of the data's compatibility with each dimension and removal of mismatched data. After population and verification, the data undergoes format standardization to obtain the user psychological feature dataset.
[0032] The standardized user psychological feature dataset is stored in CSV format (UTF-8 encoding), and the field naming follows the "feature type_parameter name" specification (e.g., "EEG_Alpha_Power" represents EEG). Wave power (Depression_Score represents the depression risk score), data precision is retained to 2 decimal places, missing values are marked as "NA" (to be removed in subsequent processing), stored in directories by user identifier, and supports quick retrieval by time range and user type.
[0033] In detail, the three-level data structure framework is divided as follows: The time-series dimension is divided into 1-hour data collection periods, containing 12 time nodes (one every 5 minutes). Each time node is associated with fused feature data for the corresponding time period, ensuring that the data covers short-term changes in the user's psychological state. The feature dimension is divided into three categories, including EEG features. Wave power (8-13Hz) Wave power (14-30Hz) Wave power (4-7Hz), / Power ratio / The study included six parameters: power ratio, LZC complexity of EEG signal (range 0-1), current psychological state characteristics including depression risk score (0-100 points), anxiety risk score (0-100 points), mood fluctuation level (1-5 levels, standardized 0-1), and subjective emotional feedback (0-5 points), and historical trend characteristics including five parameters: mean depression score in the past month, maximum anxiety score in the past month, rate of change of mood fluctuation level in the past three times, mean historical music rhythm (BPM), and mean historical feedback satisfaction (0-5 points).
[0034] Specifically, the data classification, filling, and validation process is as follows: Each feature value in the associated and fused data is mapped to the corresponding field in the three-level framework according to the "field mapping rules." The filling logic involves adding feature type matching to the corresponding time-series nodes. Matching validation employs a dual mechanism of range validation and trend validation. Range validation ensures that each parameter is within the normal range (e.g., EEG). Wave power 50-200 Trend verification ensures that the data deviation from historical trends is ≤30% (avoiding abrupt changes); abnormal data (such as exceeding the range or sudden trend changes) is marked and removed, and the dataset completeness is ≥97% after filling. Format standardization includes unifying field name capitalization, standardizing data types (float for numeric types, int for categorical types), and supplementing metadata information (collection device model, algorithm version, collection scenario). The final dataset supports both local offline analysis and online system access. By building a three-level data structure framework, the standardized and structured management of user psychological feature data is achieved, facilitating rapid dimensional filtering during subsequent feature extraction; data filling and verification mechanisms ensure dataset quality, and format standardization improves data compatibility. The entire dataset construction process conforms to industrial-grade data management standards, providing clear and reliable data support for dual-feature extraction.
[0035] Furthermore, core features of the user's current psychological state and long-term historical trend features are extracted simultaneously from the user's psychological feature dataset to establish a dual-feature and music parameter co-mapping model, as detailed below: Using user identifiers as the primary key, the corresponding full feature data set is extracted from the user psychological feature dataset to obtain the user feature set. A parallel extraction framework is built using a dual-branch feature extraction network to split the user feature set into a current state feature subset and a historical time series feature subset. Principal component analysis is used to screen and extract core features from the current state feature subset to obtain the core features of the current psychological state. The historical time series feature subset is smoothed according to the time series sequence, and a trend fitting model is used for trend analysis and feature extraction to obtain the initial historical trend features. A feature screening threshold is set to remove redundant features from the initial historical trend features, retaining features that significantly affect music compatibility to obtain the long-term historical trend features. The core features of the current psychological state and the long-term historical trend features are synchronously associated and encapsulated to complete the synchronous extraction of dual features. A dual-feature and music parameter co-mapping model is established based on the dual features and a preset music parameter library. The network architecture details are as follows: the input layer receives a 12×15 feature matrix (12 time nodes × 15 indicators), which is normalized by a BatchNormalization layer (momentum 0.9, epsilon=1e-5); the current state feature branch contains two fully connected layers (the first layer has 64 nodes, ReLU activation function, dropout rate 0.2; the second layer has 32 nodes, ReLU activation function, dropout rate 0.2); the historical time series feature branch contains one LSTM layer (32 nodes, return_sequences=True) and one fully connected layer (16 nodes, ReLU activation function); the outputs of the two branches are concatenated by a concatenation layer to output a feature vector. The network is trained with 8000 samples (BatchSize=64, Epochs=100), with a feature extraction accuracy ≥92% and a single-user extraction time ≤200ms.
[0036] In detail, user feature set extraction uses user identifier as the primary key, filtering for valid data within the past hour (containing at least 8 time points), forming a 12×15 feature matrix (12 time points, 15 indicators per point); the current state feature subset splitting rule is to extract the 15 indicators of the most recent time point and the average of each indicator over the past 5 minutes (6 time points), forming a 30-dimensional feature subset; the historical time series feature subset splitting rule is to extract 5 historical trend indicators from 12 time points within the past hour, forming a 12×5 time series feature matrix. Principal component analysis (PCA) algorithm is used for current core feature filtering, stopping dimensionality reduction when the cumulative variance contribution rate is ≥85%, ultimately retaining 8 core features (…). / Power ratio, depression risk score, anxiety risk score, mood fluctuation level, and the past 5 minutes. Average wave power, last 5 minutes The features selected included mean wave power, subjective emotional feedback, and LZC complexity of EEG signals. After feature selection, 5-fold cross-validation was used, and the explanatory power of the features for music adaptation was ≥75%. Time series smoothing employed a moving average method (window size of 3 time nodes, 15 minutes), calculated as smoothed value = (value of node t-2 + value of node t-1 + value of node t) / 3, eliminating the impact of short-term fluctuations. The trend fitting model used a combination of linear regression and exponential smoothing. Linear regression fitted the long-term trend (e.g., the slope of the depression score change over the past hour), while exponential smoothing (smoothing coefficient) was used. =0.3) Capture the trend change rate and extract 5-dimensional initial historical trend features; the feature selection threshold is set based on the Pearson correlation coefficient, calculate the correlation coefficient between each initial trend feature and the historical adapted music parameters, and |correlation coefficient|≥0.6 is judged as strong correlation. Finally, 3-4-dimensional long-term historical trend features are retained (such as the slope of the depression score change in the past 1 hour, the change rate of the rhythm of the last 3 historical adapted music, and the change trend of feedback satisfaction in the past 1 month).
[0037] Specifically, the dual-feature synchronous association encapsulation adopts JSON format, with fields including user identifier, extraction timestamp, current psychological state core feature vector (8 dimensions), long-term historical trend feature vector (3-4 dimensions), feature extraction accuracy (error ≤ 4%), and feature validity label (valid / invalid). After encapsulation, the data is transmitted to the model training module via an industrial-grade communication protocol and simultaneously stored in the feature database archive. The preset music parameter library is stored in a database and includes four core dimensions: tempo 60-120 BPM (relaxing 60-80 BPM, calm 80-100 BPM, exciting 100-120 BPM), 8 common keys (C major, D minor, etc., encoded 1-8), intensity 60-85 dB, and 6 timbres (piano, violin, etc., encoded 1-6). The parameter library supports dynamic updates, optimizing the parameter range every 1000 valid user feedback data points. The dual-feature and music parameter co-mapping model uses dual features as input and music parameters as output, and adopts a BP neural network framework: 12 nodes in the input layer (designed according to the largest feature dimension), 2 hidden layers (32 nodes + 16 nodes), and 4 nodes in the output layer (corresponding to the four major music parameters); the activation function from the input layer to the hidden layer is ReLU (to avoid gradient vanishing), and the activation function from the hidden layer to the output layer is Sigmoid (mapping to the [0,1] interval); the optimizer is Adam (learning rate 0.001, β1=0). 9, β2=0.999, weight decay 0.0001), the loss function is mean squared error (MSE), the training set has 8000 samples and the test set has 2000 samples, the training rounds are 200, and an early stopping strategy is used (training stops when the validation set loss does not decrease for 10 consecutive rounds). The training objective is that the training set loss ≤0.01 and the validation set loss ≤0.02. The model validation metrics are rhythm adaptation error ≤5BPM, key accuracy ≥85%, intensity error ≤3dB, and timbre accuracy ≥80%. After meeting the standards, it is deployed on the inference server. This section uses a dual-branch network to achieve parallel extraction of dual features, taking into account both real-time status and long-term trends, and improving the comprehensiveness of feature expression; PCA and correlation coefficient screening effectively reduce data dimensionality and reduce model computational overhead; the mapping model is trained on a large number of samples, adapting to the mapping relationship between different user psychological states and music parameters. The model accuracy meets the requirements of industrial applications and provides core algorithmic support for personalized music generation.
[0038] Furthermore, the initial music is optimized by fusing the core features of the user's current psychological state with long-term historical trend features through a dual-feature weighted fusion algorithm, as detailed below: Based on the user's psychological state adaptation priority, differentiated weighted fusion weights are assigned to the core features of the current psychological state and the long-term historical trend features to obtain weight configuration rules; the two types of features extracted simultaneously are input into the dual-feature weighted fusion algorithm, and the fused feature vector is calculated in combination with the weight configuration rules; the fused feature vector is input into the dual-feature and music parameter co-mapping model, and the model outputs the adapted initial music parameter combination; music generation processing is performed based on the initial music parameter combination to obtain the initial music; the feature fusion logic and parameter output results are recorded to complete the optimized generation of the initial music. The weighting rules are determined using the Analytic Hierarchy Process (AHP), combined with scores from five experts in psychology and music engineering and validation using data from 500 users. The core principle is to prioritize the current state and supplement it with historical trends: the default configuration assigns a weight of 0.6 to the core feature of the current psychological state and a weight of 0.4 to the feature of the long-term historical trend. The special scenario adaptation rule is that if the user's historical feedback satisfaction score is ≥4.5 and the consistency between the current psychological state and the historical trend is ≥80%, the weight of the feature of the long-term historical trend is increased to 0.5 and the weight of the current state is decreased to 0.5. The weight adjustment range is limited to ±0.1 to avoid excessive weight fluctuations affecting the fusion effect. The weighting rules are stored in an XML configuration file and support manual fine-tuning.
[0039] In detail, the implementation logic of the dual-feature weighted fusion algorithm is as follows: First, the two types of feature vectors are Min-Max standardized (mapped to the [0,1] interval) to ensure that the weight calculation is effective; the fused feature vector is calculated according to the formula "fusion vector = current core feature vector × current weight + long-term trend feature vector × historical weight", and the vector dimension is uniformly 12-dimensional (0 is added when the long-term trend feature is insufficient); after calculation, it is processed by L2 regularization (the regularized vector = fusion vector / ||fusion vector||2) to avoid overfitting, and finally outputs a 12-dimensional fused feature vector. The fusion process takes ≤50ms.
[0040] Specifically, the initial music parameter combination output process is as follows: the feature vector is fused into the mapping model, and the model inference is accelerated by GPU (inference time ≤ 100ms). The output parameters include rhythm (accurate to 1 BPM), mode (encoding + name, such as 1-C major), intensity (accurate to 1 dB), and timbre (encoding + name, such as 1-piano). At the same time, the adaptation confidence (0-100%) is output. If the confidence is ≥ 80%, it is determined that the adaptation is effective and can be directly used for music generation. If the confidence is < 80%, the default parameters of the same type of users in the parameter library (based on the average parameters of users of the same age and emotion level in the past 3 months) are called to supplement the default parameters. The error of the default parameters is ≤ 10%. Music generation utilizes a MIDI engine, combined with music theory rules: mode matching corresponds to the scale (e.g., C major corresponds to the natural scale), rhythm matching matches the beat (4 / 4 time signature for 60-80 BPM, dotted notes ≤10%), intensity controls volume variation (≤3dB for 60-70dB), and timbre matching prioritizes the vocal range (C4-C6 for piano). Melody generation is based on the Markov chain algorithm (transition probability matrix trained with 1000 classic adapted music tracks), with triads as the primary chord (≥80%). The default music duration is 3 minutes, with custom adjustments from 2-5 minutes supported (2 minutes retains the core segment, 5 minutes adds variations to the main melody, variation range ≤20%). After generation, the music is converted to MP3 format (320kbps bitrate, 44.1kHz sampling rate). The feature fusion logic and parameter output results are recorded in JSON log format, including fusion weights, fusion feature vector values, model output parameters, confidence scores, music generation time, and engine version number. Logs are stored in association with music files, supporting subsequent traceability and model optimization. If the user has historical manual adjustment records, the adjustment direction is referenced during generation (e.g., if the historical tempo was consistently increased by 5 BPM, the current model output is increased by 3 BPM), improving initial adaptability. The initial music generation stage achieves accurate fusion of dual features through scientific weight configuration, ensuring music quality based on a professional MIDI engine and music theory rules. Adaptability is optimized by combining user historical preferences, and log recording supports full-process traceability. The generated initial music not only matches the user's real-time psychological state but also considers long-term preferences, providing a high-quality foundation for subsequent dynamic adjustments.
[0041] Furthermore, the specific process for obtaining the optimized personalized music is as follows: The treatment cycle is set to a configurable range (1-4 weeks), adaptively allocated based on the severity of the user's initial psychological state (depression / anxiety score <40 is normal, 40-60 is mild, >60 is severe) and historical treatment feedback. No adjustment is needed under normal circumstances. Mild cases default to 1-2 weeks, and severe cases default to 3-4 weeks. If there has been an effective or higher level of treatment in the past and the score is stable, the cycle can be shortened by 20%. If there has been no effect or worsening, the cycle can be extended by 30%, ensuring that the treatment cycle matches the intervention needs.
[0042] At the start of the treatment cycle, following a multi-source data collection and fusion process, EEG signals and psychological assessment data are collected simultaneously to generate a pre-treatment score (depression risk score). Anxiety risk score At the end of the treatment cycle, repeat the same data collection process (keeping the data collection equipment, environment, and monitoring channels consistent) to generate a post-treatment score (depression risk score). Anxiety risk score The time window deviation between the two collections is ≤24 hours to ensure the effectiveness of the scoring comparison.
[0043] Calculate the change in rating , The treatment effect level was determined by combining pre-set criteria and statistical significance tests (P < 0.05), with significant effectiveness being [value missing]. ≥10 points and ≥10 points, 5 points or less is considered valid. <10 points and 5 points ≤ <10 points, mild cases are considered effective with 2 points or less <5 points and 2 points ≤ <5 points, invalid <2 points or <2 points, deteriorated to <0 or <0; If a single score change meets the standard but is not statistically significant, it is considered to be potentially effective, and the observation period is extended by 1 week before reassessment.
[0044] We extract updated long-term historical trend features from the user psychological feature dataset, which are included in the data of this treatment cycle. Specifically, these features include the mean and slope of depression / anxiety scores over the past month, the frequency of music playback and feedback satisfaction during this treatment cycle, and the hit rate ranking of historically matched music parameters. This ensures that the features can reflect the latest treatment feedback and long-term preferences.
[0045] Combining a dual-feature and music parameter co-mapping model, music parameters are adjusted according to the principle of prioritizing core parameters and constraining style coherence: when significantly effective, the core parameters of rhythm and mode remain unchanged, while minor parameters are fine-tuned (intensity ±2dB, timbre detail optimization, such as adding overtones to piano timbre and adjusting vibrato amplitude in string timbre), avoiding over-adjustment that disrupts the fit balance; when effective, the core parameters are fine-tuned (rhythm ±5BPM, mode switching to the second highest historical fit type), while minor parameters remain unchanged, balancing fit and user habits; when slightly effective, both core and minor parameters are optimized. (Rhythm ±8 BPM, mode switching to the type with the highest fitting score under the current psychological state, intensity ±3 dB) to enhance the intervention effect; if ineffective, the updated dual-feature data is re-inputted into the mapping model to generate a new combination of core parameters (replacing more than 70% of the original parameters), while the secondary parameters retain the historical high satisfaction configuration; if the condition worsens, transition music is immediately triggered (based on the weighted fusion of the 3 sets of parameters with the best historical fitting effect and the current core features), the transition music lasts for 3 minutes, and a second EEG acquisition and feature re-extraction are initiated at the same time, and the assessment and adjustment are carried out again after 1 week.
[0046] Based on the adjusted parameters, optimized personalized music is generated through the MIDI engine. The music duration is the same as the initial music (default 3 minutes). After generation, the adaptation error is verified by back-calculation through the model (rhythm error ≤ 5 BPM, intensity error ≤ 3 dB). If the error exceeds the standard, the parameters are readjusted.
[0047] The processes described above with reference to the flowcharts in the embodiments disclosed in this invention can be implemented as computer software programs. The embodiments disclosed in this invention include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication component, and / or installed from a removable medium. When the computer program is executed by a central processing unit (CPU), it performs the functions defined in the methods of this application. It should be noted that the computer-readable medium described above in this application can be a computer-readable signal medium or a computer-readable storage medium, or any combination of the two. A computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to: electrical connections having one or more wire segments, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this application, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in connection with an instruction execution system, apparatus, or device. In this application, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium can also be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on a computer-readable medium may be transmitted using any suitable medium, including but not limited to: wireless segments, wire segments, optical fibers, RF, etc., or any suitable combination thereof.
[0048] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present invention. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0049] Those skilled in the art should understand that the embodiments of the present invention described above and shown in the accompanying drawings are merely examples and do not limit the present invention. The purpose of the present invention has been fully and effectively achieved. The functions and structural principles of the present invention have been shown and explained in the embodiments. Without departing from the stated principles, the implementation of the present invention may have any variations or modifications.
Claims
1. A personalized music generation method based on electroencephalogram (EEG) signal analysis, characterized in that, The method includes: Collect multi-dimensional data, including raw EEG data, psychological state assessment data, and historical assessment data. Perform multi-dimensional verification and correlation fusion on the multi-dimensional data to obtain correlated fused data. Based on correlated and fused data, a user psychological feature dataset is constructed through multi-dimensional data structuring. Simultaneously extract the core features of the user's current psychological state and the long-term historical trend features from the user's psychological feature dataset, and establish a dual-feature and music parameter collaborative mapping model; The initial music is generated by combining the core features of the user's current psychological state with long-term historical trend features through a dual-feature weighted fusion algorithm with differentiated weight configuration. Set a treatment cycle, collect the user's psychological state score before and after the treatment cycle, and determine the treatment effect level based on the change in score and preset standards; Based on the treatment effect level, and combined with the dual-feature and music parameter collaborative mapping model and long-term historical trend features, the core parameters of the music are adjusted to generate optimized personalized music.
2. The personalized music generation method based on electroencephalogram (EEG) signal analysis according to claim 1, characterized in that, The specific process for obtaining the multivariate data is as follows: EEG signals are collected from the key monitoring channels of the user under test at a preset sampling frequency to obtain raw EEG data. Based on raw EEG data, psychological state assessment data including depression risk score, anxiety risk score and mood fluctuation level are generated through psychological state quantitative assessment logic. Historical evaluation data is obtained by retrieving users' past evaluation records, adapted music parameters, and feedback data from the system's historical database. Based on user identifiers, raw EEG data, psychological state assessment data, and historical assessment data are correlated and encapsulated to obtain encapsulated data. The identity consistency of the encapsulated data is verified based on the unified user identifier. The temporal relationship of different types of data is aligned by collecting timestamps, and multi-dimensional association verification is completed by combining data collection scenario tags to obtain multi-dimensional data.
3. The personalized music generation method based on electroencephalogram (EEG) signal analysis according to claim 2, characterized in that, The specific process for obtaining the associated and fused data is as follows: A multi-source data spatiotemporal alignment algorithm was used to eliminate dimensional differences and calibrate temporal biases in the original EEG data, psychological state assessment data and historical assessment data in the multi-source data to obtain aligned data. An outlier removal algorithm is used to filter and remove outliers from the aligned data, resulting in outlier-free data. The outlier-removing data was normalized using a standardization method to obtain standardized data. Based on the data type, differentiated weights are assigned to standardized data, and Bayesian fusion algorithm is used to perform association and fusion calculations on the standardized data to obtain fused intermediate data; The intermediate data is structured and encapsulated to obtain the associated fused data.
4. The personalized music generation method based on electroencephalogram (EEG) signal analysis according to claim 3, characterized in that, The specific process for obtaining the user psychological feature dataset is as follows: Based on the correlation and fusion of data, a standardized dataset of user psychological characteristics will be constructed; A three-level data structure framework, comprising time-series, feature, and indicator dimensions, is constructed based on a standardized user psychological feature dataset. The time-series dimension links assessment data from different time points, the feature dimension is divided into EEG features, current psychological state features, and historical trend features, and the indicator dimension clarifies the specific quantitative parameters corresponding to each feature; The associated and fused data is classified and populated according to a three-level framework, and the matching of the data with each dimension is verified simultaneously and abnormal data is removed. After completing the data filling and validation, the data is standardized to obtain a user psychological feature dataset.
5. The personalized music generation method based on electroencephalogram (EEG) signal analysis according to claim 4, characterized in that, The specific process for obtaining the core features of the user's current psychological state and the long-term historical trend features is as follows: Using the user identifier as the primary key, the corresponding full feature data set is extracted from the user psychological feature dataset to obtain the user feature set; A parallel extraction framework is built using a dual-branch feature extraction network, which splits the user feature set to obtain the current state feature subset and the historical time series feature subset. The core features of the current psychological state are obtained by filtering and extracting the core features of the current state feature subset through principal component analysis algorithm. A subset of historical time-series features is smoothed using time-series sequence processing, and a trend fitting model is used for trend analysis and feature extraction to obtain initial historical trend features. To remove redundant features from the initial historical trend features by setting a feature filtering threshold, features that have a significant impact on music compatibility are retained, thus obtaining long-term historical trend features. The core features of the current psychological state are synchronously associated and encapsulated with the features of long-term historical trends, thus completing the synchronous extraction of dual features.
6. The personalized music generation method based on electroencephalogram (EEG) signal analysis according to claim 5, characterized in that, The specific process for obtaining the dual-feature and music parameter co-mapping model is as follows: A preset music parameter library contains music parameters and their corresponding ranges for four core dimensions: rhythm, mode, intensity, and timbre. Collect dual-feature samples under different psychological states and corresponding music parameter samples to construct model training dataset and model testing dataset; Using dual features as input variables and music parameters as output variables, a mapping model framework is built using a BP neural network algorithm. The mapping model framework is trained based on the model training dataset to obtain the initial mapping model; The accuracy of the initial mapping model is verified using the model test dataset. When the adaptation error is lower than the preset threshold, the collaborative mapping model of dual features and music parameters is established.
7. The personalized music generation method based on electroencephalogram (EEG) signal analysis according to claim 6, characterized in that, The specific process of obtaining the initial music is as follows: Based on the user's psychological state adaptation priority, differentiated weighted fusion weights are assigned to the core features of the current psychological state and the long-term historical trend features to obtain the weight configuration rules; The two types of features extracted simultaneously are input into a dual-feature weighted fusion algorithm, and the fused feature vector is calculated by combining the weight configuration rules. The fused feature vector is input into the dual feature and music parameter co-mapping model, and the model outputs the adapted initial music parameter combination; The initial music is generated by performing music generation processing based on the initial music parameter combination; Record the feature fusion logic and parameter output results to complete the optimized generation of the initial music.
8. The personalized music generation method based on electroencephalogram (EEG) signal analysis according to claim 7, characterized in that, The specific process for obtaining the optimized personalized music is as follows: Set configurable treatment cycles, with cycle duration adaptively adjusted based on the severity of the user's psychological state and historical treatment feedback; The start and end points of the treatment cycle are determined based on the quantitative assessment logic of psychological state. Psychological state scores before and after treatment are generated through a multi-dimensional data collection and correlation fusion process. Calculate the change in scores before and after treatment, and determine the treatment effect level based on preset standards; Extract the updated long-term historical trend features of the data included in this treatment cycle, and combine the dual-feature and music parameter co-mapping model to adjust the music parameters according to the treatment effect level. Optimized personalized music is generated based on the adjusted parameters.
9. A personalized music generation system based on electroencephalogram (EEG) signal analysis, characterized in that, The system is used to execute a personalized music generation method based on electroencephalogram (EEG) signal analysis as described in any one of claims 1-8.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that is executed by a processor to implement a personalized music generation method based on electroencephalogram (EEG) signal analysis as described in any one of claims 1-8.