Music playing method and system for music treatment instrument

By constructing a personalized database and calculating the Treatment Effectiveness Index (TEI) in real time, alternative music is screened and the correlation model is updated, which solves the problem of fixed treatment plans in music therapy. It realizes adaptive optimization of music therapy and iterative learning of personalized treatment plans, significantly improving the quantifiability and effectiveness of treatment effects.

CN121565393APending Publication Date: 2026-02-24柳欣茹
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511739831.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-25
Publication Date
2026-02-24

AI Technical Summary

Technical Problem

Current music therapy techniques lack a quantitative evaluation mechanism for treatment effects based on real-time physiological and psychological feedback from patients, resulting in rigid treatment plans, insufficient adaptability, and an inability to achieve iterative learning and adaptive optimization of personalized treatment plans.

Method used

By collecting patients' baseline physiological and psychological indicators to build a personalized database, the Treatment Efficacy Index (TEI) is calculated in real time, alternative music with the highest matching degree with the patient's state is selected, and the music-patient state association model is updated through a deep reinforcement learning framework to achieve adaptive optimization of the treatment plan.

Benefits of technology

It achieves quantifiable, traceable, and optimizable effects of music therapy, significantly improving the effectiveness and precision of music therapy and meeting the clinical need for quantifiable, traceable, and optimizable treatment effects.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121565393A_ABST
    Figure CN121565393A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of music treatment equipment, and discloses a music playing method for a music treatment instrument, and the method comprises the following steps: collecting baseline physiological indexes and baseline psychological state indexes of a patient in a quiet state, and constructing a personalized baseline database; the baseline physiological indexes comprise heart rate variability, skin conductance level, brain wave frequency band energy distribution, blood pressure and respiratory rate; the baseline psychological state index is obtained through facial expression recognition, speech emotion analysis and attention monitoring; performing multi-dimensional feature extraction on the music in the music library, and constructing a music feature vector; the multi-dimensional features comprise acoustic features, frequency spectrum features, emotion features and treatment adaptation features, and the purpose of the invention is to solve the problem that adaptive optimization of a treatment scheme cannot be realized due to lack of a treatment effect quantitative evaluation mechanism based on real-time physiological-psychological comprehensive feedback of a patient. The music playing method and the music playing system for the music treatment instrument are provided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of music therapy equipment technology, specifically to a music playback method and system for a music therapy instrument. Background Technology

[0002] Music therapy, as a non-pharmacological intervention, positively impacts patients' physiological and psychological states through elements such as rhythm, melody, and timbre, and has been widely applied in clinical settings such as anxiety relief, pain management, and cognitive rehabilitation. With the development of sensing technology and artificial intelligence, existing music therapy techniques have gradually achieved automation and personalization: some techniques adjust music playback parameters based on hearing assessments, some switch music tracks in real time by collecting body information, and others use deep learning models to classify music by emotion and develop treatment plans. While these technologies have improved the targeted nature of music therapy to some extent, significant shortcomings remain in the dynamic evaluation and adaptive optimization of treatment effects.

[0003] While existing methods can collect patients' physiological indicators or emotional states for music selection and switching, they lack quantitative indicators that correlate changes in patient state with music characteristics, making it impossible to determine whether the currently played music is producing the expected therapeutic effect. Due to the lack of real-time feedback on therapeutic effects, the system struggles to dynamically adjust music selection strategies, leading to rigid treatment plans and insufficient adaptability. More importantly, current technologies fail to utilize patient feedback data accumulated during treatment to continuously optimize the music-patient state correlation model, hindering iterative learning for personalized treatment plans. These issues severely restrict the precision and effectiveness of music therapy, making it difficult to meet clinical needs for quantifiable, traceable, and optimizable treatment effects. Summary of the Invention

[0004] The purpose of this invention is to address the problem of lacking a quantitative evaluation mechanism for treatment effects based on real-time physiological and psychological feedback from patients, which makes it impossible to achieve adaptive optimization of treatment plans. Therefore, this invention proposes a music playback method and system for music therapy instruments.

[0005] The technical solution of the present invention to solve the above-mentioned technical problems is as follows:

[0006] A method for playing music using a music therapy device includes the following steps:

[0007] S1: Collect baseline physiological and psychological indicators of patients in a resting state to construct a personalized baseline database; the baseline physiological indicators include heart rate variability, skin conductance level, brain wave frequency energy distribution, blood pressure, and respiratory rate; the baseline psychological indicators are obtained through facial expression recognition, voice emotion analysis, and attention monitoring.

[0008] S2: Extract multidimensional features from the music in the music library and construct music feature vectors; the multidimensional features include acoustic features, spectral features, emotional features, and therapeutic adaptation features;

[0009] S3: During music playback, the patient's current physiological and psychological indicators are collected in real time, the deviation value of the current indicators relative to the baseline database is calculated, and the treatment effect index (TEI) is calculated based on the deviation value.

[0010] S4: Determine the therapeutic effect status of the current music based on the Therapeutic Effect Index (TEI). When the TEI is lower than the preset threshold, select the alternative music with the highest matching degree with the patient's current status from the music library.

[0011] S5: Use changes in the patient's physiological and psychological indicators, music feature vectors, and the treatment effect index (TEI) as training samples to update the music-patient state association model and achieve adaptive optimization of the treatment plan.

[0012] Based on the above technical solution, the present invention can be further improved as follows.

[0013] Furthermore, the collection of baseline physiological indicators in S1 includes: setting a resting period of 5-10 minutes before the start of treatment, collecting physiological data every 10 seconds, and taking the average value as the baseline value after denoising and outlier removal of the collected data; the energy distribution of the EEG frequency band includes the power spectral density of alpha waves, beta waves and theta waves.

[0014] Furthermore, the extraction of therapeutic fit features in S2 includes: calculating the rate of change of music rhythm within a time window to obtain a music stability index; analyzing the temporal change trend of music emotional features to obtain an emotional guidance tendency; and calculating cognitive load based on music complexity and information entropy; the time window is 30 seconds.

[0015] Furthermore, the method for calculating the treatment efficacy index TEI in S3 is as follows: first, calculate the physiological improvement index PII and the psychological improvement index MII, and then obtain the TEI through weighted fusion;

[0016] The formula for calculating the Physiological Improvement Index (PII) is as follows:

[0017]

[0018] in, For the first The weighting coefficients of each physiological indicator for Time of the first The deviation of each physiological indicator from the baseline value For the first Baseline values ​​of each physiological indicator As a direction correction factor, when physiological indicators change towards the treatment target... ,on the contrary ; The total number of physiological indicators;

[0019] The formula for calculating the Therapeutic Efficacy Index (TEI) is as follows:

[0020]

[0021] in, , The physiological and psychological weights at the current moment. As the cumulative effect weight, the integral term represents the period from the start of treatment. up to the current moment The cumulative therapeutic effect.

[0022] Furthermore, the calculation method of the Psychological Improvement Index (MII) is as follows: the patient's facial expressions are classified by a convolutional neural network to obtain an emotional state value; the speech signal is analyzed by a recurrent neural network to obtain a psychological state value; and attention concentration is calculated by eye tracking and the proportion of alpha waves in the brain. The normalized rate of change of the above three indicators is weighted and summed to obtain the MII. The weight coefficients are dynamically adjusted according to the type of treatment goal.

[0023] Furthermore, the method for selecting alternative music in S4 includes: when TEI is below a preset threshold for three consecutive samples. The music switching mechanism is triggered on demand; the therapeutic suitability of each song in the music library is calculated. Choose music with the highest compatibility and whose emotional characteristics differ from the current music within an acceptable range as alternative music;

[0024] Therapeutic fit The calculation formula is:

[0025]

[0026] in, This is the target music feature vector calculated based on the patient's current state. For candidate music feature vectors, Score the historical validity of the candidate music. The similarity between the current music and the candidate music. , , The weighting coefficients are and satisfy the following conditions: .

[0027] Furthermore, the music switching adopts a gradual transition strategy: when the rhythmic stability segment of the current music is detected as the switching point, the volume of the current music is reduced starting 15 seconds before the switching point, while the volume of the alternative music is gradually increased, so that the two music tracks complete the volume crossover at the switching point; the volume change curve adopts an S-shaped function to avoid auditory discomfort caused by abrupt changes.

[0028] Furthermore, the music-patient state association model in S5 is constructed using a deep reinforcement learning framework: the patient's current physiological-psychological state is taken as the environmental state, music selection and playback parameter adjustment are taken as the action space, and the treatment effect index (TEI) is taken as the immediate reward; the policy network and value network are trained through the Actor-Critic algorithm, the policy network outputs the optimal music selection policy, and the value network evaluates the long-term value of the state-action pair.

[0029] Furthermore, the update of the association model adopts an incremental learning mechanism: after each complete treatment course, all training samples of this course are added to the experience replay pool; when the number of samples in the experience replay pool exceeds a preset threshold, a batch of samples is randomly selected from it to update the model parameters; at the same time, an independent personalized parameter layer is maintained for each patient, and the underlying feature extraction network of the model is shared to achieve a balance between group knowledge and individual adaptation.

[0030] A music playback system for a music therapy instrument includes:

[0031] The baseline data acquisition module is used to collect baseline physiological and psychological indicators of patients in a resting state and to construct a personalized baseline database. The baseline data acquisition module includes a physiological signal sensor group, a facial expression recognition unit, a voice emotion analysis unit, and an attention monitoring unit.

[0032] The music feature analysis module is used to extract multi-dimensional features from music in the music library and construct music feature vectors; the music feature analysis module includes an acoustic feature extraction unit, a spectrum feature extraction unit, an emotional feature extraction unit, and a therapy adaptation feature calculation unit;

[0033] The real-time treatment effect assessment module is used to collect the patient's current physiological and psychological indicators in real time during music playback and calculate the treatment effect index (TEI). The real-time treatment effect assessment module includes a real-time data acquisition unit, a deviation calculation unit, and a TEI calculation unit.

[0034] The adaptive music control module is used to determine the therapeutic effect status of the current music based on the Therapeutic Effect Index (TEI) and to select alternative music from the music library for switching when necessary. The adaptive music control module includes an effect judgment unit, a music matching unit, and a progressive switching unit.

[0035] The association model learning module is used to construct training samples from changes in patient physiological and psychological indicators, music feature vectors, and treatment effect index (TEI) to update the music-patient state association model. The association model learning module includes a sample construction unit, a deep reinforcement learning unit, an experience playback pool, and a personalized parameter storage unit.

[0036] The central controller communicates with each of the above modules and is used to coordinate the workflow of each module and store treatment data.

[0037] A music player, connected to the adaptive music control module and the central controller, is used to play music and execute music switching commands.

[0038] Compared with the prior art, the technical solution of this application has the following beneficial technical effects:

[0039] This invention constructs a personalized baseline database by collecting patients' baseline physiological and psychological indicators, providing a personalized reference benchmark for the quantitative evaluation of subsequent treatment effects. It performs multi-dimensional analysis of music's acoustic, spectral, emotional, and therapeutic suitability characteristics, establishing a bridge between music features and treatment effects. By collecting patients' current physiological and psychological indicators in real time and calculating the deviation value relative to the baseline database, it innovatively introduces the Treatment Effectiveness Index (TEI) as a quantitative indicator, achieving real-time dynamic evaluation of the therapeutic effect of currently played music and completely solving the problem that existing technologies cannot determine whether music produces the expected therapeutic effect. Based on the TEI, an automatic music switching mechanism is triggered to select the optimal alternative music, enabling dynamic adjustment of the treatment plan and overcoming the shortcomings of existing technologies such as rigid treatment plans and insufficient adaptability. By using patient feedback data, music features, and the Treatment Effectiveness Index as training samples to continuously update the correlation model, it achieves iterative learning and adaptive optimization of personalized treatment plans, thus making the music therapy effect truly quantifiable, traceable, and optimizable, significantly improving the accuracy and effectiveness of music therapy. Attached Figure Description

[0040] Figure 1 This is a flowchart of the overall method of the present invention. Detailed Implementation

[0041] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0042] like Figure 1As shown, a music playback method for a music therapy instrument according to the present invention includes the following steps:

[0043] S1: Collect baseline physiological and psychological indicators of patients in a resting state to construct a personalized baseline database; baseline physiological indicators include heart rate variability, skin conductance level, brain wave frequency energy distribution, blood pressure and respiratory rate; baseline psychological indicators are obtained through facial expression recognition, voice emotion analysis and attention monitoring.

[0044] S2: Extract multidimensional features from the music library and construct music feature vectors; multidimensional features include acoustic features, spectral features, emotional features, and therapeutic adaptation features;

[0045] S3: During music playback, the patient's current physiological and psychological indicators are collected in real time, the deviation value of the current indicators relative to the baseline database is calculated, and the treatment effect index (TEI) is calculated based on the deviation value.

[0046] S4: Determine the therapeutic effect status of the current music based on the Therapeutic Effect Index (TEI). When the TEI is lower than the preset threshold, select the alternative music with the highest matching degree with the patient's current status from the music library.

[0047] S5: Use changes in the patient's physiological and psychological indicators, music feature vectors, and the treatment effect index (TEI) as training samples to update the music-patient state association model and achieve adaptive optimization of the treatment plan.

[0048] The baseline physiological data collection in S1 included: a 5-10 minute resting period before treatment, with physiological data collected every 10 seconds. The collected data was denoised and outlier removed, and the average value was used as the baseline. The brainwave frequency energy distribution included the power spectral density of alpha waves (8-13Hz), beta waves (13-30Hz), and theta waves (4-8Hz). Before treatment, the system guided the patient to a resting state, specifically by having the patient sit in a comfortable chair, maintain natural breathing, and close their eyes to relax. An 8-minute resting period was set as the baseline data collection time, with data collected every 10 seconds using a physiological signal sensor array, resulting in 48 sets of physiological data samples.

[0049] The physiological signal sensor group includes: an electrocardiogram (ECG) sensor to acquire heart rate variability (HRV), a skin conductance sensor to acquire skin conductance level (SCL), an electroencephalogram (EEG) acquisition device to acquire brain wave signals, a blood pressure monitor to measure blood pressure, and a respiratory monitoring belt to record respiratory rate. For the EEG signals, the system uses Fast Fourier Transform (FFT) to extract the power spectral density of alpha waves (8-13Hz), beta waves (13-30Hz), and theta waves (4-8Hz).

[0050] Data preprocessing includes: using median filtering to remove impulse noise, using the 3σ criterion to remove outliers exceeding the mean ± 3 standard deviations, and taking the arithmetic mean of the data after outlier removal as the baseline value for each indicator. For example, if the collected HRV data sequence is {65, 68, 64, 120, 67, 66...}, where 120 is clearly outlier, the system will remove it and calculate the average value as the HRV baseline value.

[0051] The extraction of therapeutic fit features in S2 includes: calculating the rate of change of music rhythm within a time window to obtain a music stability index; analyzing the temporal trend of music emotional features to obtain emotional guidance tendency; calculating cognitive load based on music complexity and information entropy; the time window is 30 seconds, and the calculation of the music stability index involves dividing the music into 30-second time windows and detecting the rate of change of rhythm tempo within each window. If the... The average rhythm of each window is The rate of change of rhythm is The stability index is obtained by taking the reciprocal of the rate of change of all windows and normalizing it. The higher the value, the more stable the music rhythm.

[0052] Extraction of emotional guidance tendency: By analyzing the temporal trajectory of music on the arousal-pleasure coordinates in the Russell emotion model, the direction vector of the trajectory is calculated. If the music evolves from low arousal to high arousal and from low pleasure to high pleasure, it is marked as positive guidance; if it remains in a certain emotional region, it is marked as stable maintenance.

[0053] Cognitive load is calculated as a comprehensive index based on the harmonic complexity, melodic information entropy, and timbre change frequency of music. Specifically, the Shannon entropy formula is used to calculate the information entropy of the melodic pitch distribution, and the number of chord transitions per unit time is counted as the harmonic complexity. The two are weighted, summed, and normalized to the 0-1 range. The higher the value, the more complex the music and the greater the load on the cognitive system.

[0054] The treatment efficacy index (TEI) in S3 is calculated as follows: first, the physiological improvement index (PII) and the psychological improvement index (MII) are calculated, and then the TEI is obtained by weighted fusion.

[0055] The formula for calculating the Physiological Improvement Index (PII) is as follows:

[0056]

[0057] in, For the first The weighting coefficients of each physiological indicator for Time of the first The deviation of each physiological indicator from the baseline value For the first Baseline values ​​of each physiological indicator As a direction correction factor, when physiological indicators change towards the treatment target... ,on the contrary ; The total number of physiological indicators;

[0058] The formula for calculating the Therapeutic Effectiveness Index (TEI) is as follows:

[0059]

[0060] in, , The physiological and psychological weights at the current moment. As the cumulative effect weight, the integral term represents the period from the start of treatment. up to the current moment The cumulative therapeutic effect, in the calculation of the Physiological Improvement Index (PII), includes the direction correction factor. The determination rules are as follows: For HRV, the treatment goal is usually to increase the HRV value to improve autonomic nerve function, therefore when hour For SCL, the treatment goal for anxiety patients is to reduce SCL, therefore when hour Regarding alpha wave energy in brainwaves, alpha waves should be enhanced in a relaxed state, when... hour Weighting coefficients The weighting is set according to the type of treatment goal. For example, when treating anxiety, HRV and SCL have higher weights, set to 0.3 and 0.25 respectively.

[0061] The cumulative effect term in the Treatment Efficacy Index (TEI) is achieved through numerical integration: the system calculates the PII and MII every 2 seconds, discretizing time into... The integral term is approximated using the trapezoidal rule as follows:

[0062]

[0063] in Seconds. Cumulative effect weight. Set to 0.1 to allow long-term treatment effects to have a moderate impact on TEI. Current time-in weight. and The treatment plan is dynamically adjusted according to the stage of treatment: In the early stages of treatment, the focus is on physiological indicators. , The focus of treatment in the middle and later stages is on psychological improvement. .

[0064] The Psychological Improvement Index (MII) is calculated as follows: Facial expressions are classified using a convolutional neural network to obtain an emotional state value; emotional analysis of speech signals is performed using a recurrent neural network to obtain a psychological state value; and attention concentration is calculated using eye tracking and the proportion of alpha waves in brainwaves. The normalized rates of change of these three indicators are weighted and summed to obtain the MII. The weighting coefficients are dynamically adjusted according to the treatment goal type. The facial expression recognition unit uses a ResNet-50 convolutional neural network model to classify seven emotions (pleasure, calmness, sadness, anger, fear, disgust, and surprise) in the patient's facial region, outputting the probability distribution of each category. The seven emotions are mapped to emotional state values ​​in the range [-1, 1]: pleasure corresponds to +1, calmness to 0, and negative emotions to negative values. The comprehensive emotional state value is obtained by weighting the values ​​according to probability. .

[0065] The speech emotion analysis unit uses an LSTM recurrent neural network to process the patient's speech signal (if there is speech interaction during treatment), extracting prosodic features, timbre features, and spectral features, and outputting the probabilities of three types of emotions: positive, neutral, and negative, which are then converted into psychological state values ​​of [-1, 1]. .

[0066] Attention concentration was calculated using a combination of eye-tracking and EEG alpha wave proportions: eye-tracking recorded the degree of dispersion of the gaze point, with low dispersion indicating high concentration; EEG alpha waves showed a higher proportion in a relaxed but focused state. After normalization, both were weighted at a ratio of 0.6:0.4 to obtain the attention concentration score. .

[0067] The Psychological Improvement Index (MII) is calculated as follows:

[0068]

[0069] in To prevent the use of tiny constants that divide by zero, the weights are set to [value missing] when used in anxiety treatment. , , During cognitive rehabilitation, the weight of attention is increased to .

[0070] The method for selecting alternative music in S4 includes: when TEI is below a preset threshold for three consecutive samples. The music switching mechanism is triggered on demand; the therapeutic suitability of each song in the music library is calculated. Choose music with the highest compatibility and whose emotional characteristics differ from the current music within an acceptable range as alternative music;

[0071] Treatment fit The calculation formula is:

[0072]

[0073] in, This is the target music feature vector calculated based on the patient's current state. For candidate music feature vectors, Score the historical validity of the candidate music. The similarity between the current music and the candidate music. , , The weighting coefficients are and satisfy the following conditions: When the system detects that the TEI is below the preset threshold for three consecutive samples (i.e., for 6 consecutive seconds), If the current music therapy is deemed ineffective, a music switching process is initiated.

[0074] Target music feature vector The calculation involves determining the emotional gap that needs to be filled based on the difference between the patient's current state and the target state. For example, if the patient is currently in a state of high arousal and low pleasure (anxiety), and the target state is low arousal and high pleasure (relaxation and pleasure), then... It should have the characteristics of low tempo, high valence, and stable harmony.

[0075] Historical validity score Maintenance: The system maintains a dynamic scoring table for each piece of music, recording the average TEI value of that music in historical treatments. After each use of that music, the score is updated based on the average TEI value of that treatment. Exponential moving averages are used to maintain the continuity of historical information.

[0076] Similarity constraints The calculation uses cosine similarity to measure the similarity between the current music and candidate music in the feature vector space, with a value ranging from [0,1]. Requirements: To avoid choosing overly similar music that would result in monotonous stimulation, and at the same time require... To ensure that the music style does not change abruptly and cause discomfort.

[0077] Treatment fit The weighting coefficients in the formula are set to The system prioritizes feature matching while also considering historical performance and similarity constraints. It calculates the features of all candidate music tracks. The system selects the top 3 songs with the highest scores, and then chooses the final replacement music based on the current treatment stage.

[0078] The music switching employs a gradual transition strategy: A stable rhythmic segment of the current music is detected as the switching point. Fifteen seconds before this point, the volume of the current music decreases while the volume of the alternative music gradually increases, allowing the two tracks to cross over at the switching point. The volume change curve uses an S-shaped function to avoid auditory discomfort caused by abrupt changes. Stable rhythmic segments are detected by the system in real-time analyzing the rhythm envelope of the currently playing music. A stable segment is identified when the rhythmic change rate is less than 5% for five consecutive seconds. Within the stable segment, bar lines are identified as the switching point, ensuring the switching occurs at natural musical boundaries.

[0079] Volume crossover control: Set the switching point time as ,from The volume fade-in / fade-out process begins after a few seconds. The current music volume decays according to an S-shaped function.

[0080]

[0081] The music volume increases in an S-shaped curve:

[0082]

[0083] in This is the initial volume. As the steepness coefficient, the two curves at The crossover at the second mark achieves a smooth transition. The advantage of the S-shaped function is that the rate of change is slow at first, then fast, and then slows down again, which conforms to the natural laws of auditory perception.

[0084] The music-patient state association model in S5 is constructed using a deep reinforcement learning framework: the patient's current physiological and psychological state is considered the environmental state, music selection and playback parameter adjustment are considered the action space, and the Treatment Effectiveness Index (TEI) is considered the immediate reward. The policy network and value network are trained using the Actor-Critic algorithm. The policy network outputs the optimal music selection policy, and the value network evaluates the long-term value of the state-action pair. The environmental state is defined as a 20-dimensional state vector composed of the patient's current 5 physiological indicators, 3 psychological indicators, the current music feature vector (11 dimensions), and the duration of playback. .

[0085] Action space definition: Includes discrete actions such as keeping the current music, switching music A, switching music B, etc. (there are N+1 discrete actions if there are N music tracks in the music library), and continuous actions such as adjusting volume (range 50-100) and adjusting equalizer parameters (0-10 for bass, midrange, and treble). A hybrid action space is used to handle discrete and continuous decisions.

[0086] Actor-Critic Algorithm Implementation: The policy network Actor uses a 3-layer fully connected neural network, with input state... Output action probability distribution The Critic value network is also a 3-layer fully connected network, with input state... and actions Output value Estimate the long-term cumulative reward. The training objective is to maximize the expected return:

[0087]

[0088] in For policy network parameters, For strategy The resulting state distribution.

[0089] Instant reward design: Reward function ,in This is a switching indicator function; it is 1 when switching occurs and 0 otherwise. To switch penalties (to avoid frequent switching). For penalty weights.

[0090] The correlation model is updated using an incremental learning mechanism: after each complete treatment course, all training samples from that course are added to the experience replay pool; when the number of samples in the experience replay pool exceeds a preset threshold, a batch of samples is randomly selected to update the model parameters; simultaneously, an independent personalized parameter layer is maintained for each patient, while sharing the underlying feature extraction network of the model, achieving a balance between group knowledge and individual adaptation. The experience replay pool employs a priority sampling strategy: each training sample... Additional priority weights Priority is positively correlated with TD error, meaning that samples with larger model prediction errors have a higher probability of being selected, thus accelerating learning efficiency. The experience replay pool capacity is set to 10,000 samples. Batch training begins when the number of samples exceeds 500, with 64 samples selected in each batch.

[0091] The personalized parameter layer design: The bottom layer of the model shares a feature extraction network (3 convolutional layers or a Transformer encoder) to learn a general representation of music features. The top layer maintains an independent fully connected layer (2 layers, 128 hidden dimensions) for each patient to learn an individual-specific state-action mapping. New patients initially use group-shared network parameters; as the number of treatments increases, the personalized layer parameters are gradually updated. The personalized layer output weight after the second treatment is set to... The group layer weight is set to Ultimately, the personalization weight will not exceed 70% in order to preserve group knowledge.

[0092] The model update adopts a soft update strategy: target network parameters Adjust the current network parameters in small steps. near: ,in This helps avoid drastic fluctuations in target values ​​during training.

[0093] A music playback system for a music therapy instrument includes:

[0094] The baseline data acquisition module is used to collect baseline physiological and psychological indicators of patients in a resting state and to build a personalized baseline database. The baseline data acquisition module includes a physiological signal sensor group, a facial expression recognition unit, a voice emotion analysis unit, and an attention monitoring unit.

[0095] The music feature analysis module is used to extract multi-dimensional features from the music in the music library and construct music feature vectors. The music feature analysis module includes an acoustic feature extraction unit, a spectrum feature extraction unit, an emotion feature extraction unit, and a therapy adaptation feature calculation unit.

[0096] The real-time treatment effect assessment module is used to collect the patient's current physiological and psychological indicators in real time during music playback and calculate the treatment effect index (TEI). The real-time treatment effect assessment module includes a real-time data acquisition unit, a deviation calculation unit, and a TEI calculation unit.

[0097] The adaptive music control module is used to determine the therapeutic effect status of the current music based on the Therapeutic Effect Index (TEI) and to select alternative music from the music library for switching when necessary. The adaptive music control module includes an effect judgment unit, a music matching unit, and a progressive switching unit.

[0098] The association model learning module is used to construct training samples from changes in patient physiological and psychological indicators, music feature vectors, and treatment effect index (TEI) to update the music-patient state association model. The association model learning module includes a sample construction unit, a deep reinforcement learning unit, an experience playback pool, and a personalized parameter storage unit.

[0099] The central controller communicates with each of the above modules and is used to coordinate the workflow of each module and store treatment data.

[0100] The music player, connected to the adaptive music control module and central controller, is used to play music and execute music switching commands. The baseline data acquisition module's hardware consists of: a physiological signal sensor group including a three-lead ECG sensor, a skin conductance sensor (worn on a finger), a 16-channel EEG cap, an electronic blood pressure monitor, and a chest respiration sensor band. The facial expression recognition unit uses an RGB-D depth camera (1920×1080 resolution, 30fps) to capture facial images. The voice emotion analysis unit uses a directional microphone array. The attention monitoring unit includes an infrared eye tracker and a real-time EEG alpha wave analysis module.

[0101] The music feature analysis module employs an offline preprocessing method: feature extraction is completed when music is added to the database, and the results are stored in the music feature database. Acoustic feature extraction uses the librosa library, spectral features use Short Time Fourier Transform (STFT), emotional features use a pre-trained music emotion recognition model, and therapeutic adaptation features are calculated using a custom algorithm.

[0102] The workflow of the real-time treatment effect assessment module is as follows: The real-time data acquisition unit synchronously collects all physiological and psychological indicators at a 2-second interval, transmits them to the deviation calculation unit for comparison with the baseline database, and the TEI calculation unit calls the preset formula to output the treatment effect index. The calculation delay is controlled within 200 milliseconds to ensure real-time performance.

[0103] The decision logic of the adaptive music control module is as follows: the effect judgment unit continuously monitors the TEI value and maintains a sliding window with a length of 3. When all TEI values ​​in the window are lower than the threshold, the switching is triggered; the music matching unit calculates the fit score of all candidate music in parallel, which takes about 100 milliseconds; the progressive switching unit controls the audio mixer to realize volume fade-in and fade-out, and uses dual-track playback technology to ensure seamless transition of the switching process.

[0104] The association model learning module is deployed on an edge computing server: the deep reinforcement learning unit uses GPU-accelerated training, the experience replay pool uses a Redis in-memory database for storage to improve read and write speed, and the personalized parameter storage unit creates an independent tablespace for each patient in the database. Model training runs in parallel with the real-time treatment process, without affecting the treatment experience.

[0105] The central controller uses an embedded Linux system to run the main control program, coordinating communication between various modules. The communication protocol uses MQTT message queues to ensure real-time performance and reliability. The music player is a professional-grade audio device, supporting 24bit / 96kHz high-fidelity playback and real-time equalizer adjustment.

[0106] The entire system forms a closed-loop feedback architecture: baseline database → music playback → effect evaluation → adaptive adjustment → model learning → optimization strategy → music playback, realizing continuous iterative optimization of the treatment plan.

[0107] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, 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 a process, method, article, or apparatus. Without further limitations, an element defined by the statement "comprising a…" does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0108] Although embodiments of the invention have been shown and described, it will be understood by those skilled in the art that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the appended claims and their equivalents.

Claims

1. A method for playing music in a music therapy instrument, characterized in that, Includes the following steps: S1: Collect baseline physiological and psychological indicators of patients in a resting state to construct a personalized baseline database; the baseline physiological indicators include heart rate variability, skin conductance level, brain wave frequency energy distribution, blood pressure, and respiratory rate; the baseline psychological indicators are obtained through facial expression recognition, voice emotion analysis, and attention monitoring. S2: Extract multidimensional features from the music in the music library and construct music feature vectors; the multidimensional features include acoustic features, spectral features, emotional features, and therapeutic adaptation features; S3: During music playback, the patient's current physiological and psychological indicators are collected in real time, the deviation value of the current indicators relative to the baseline database is calculated, and the treatment effect index (TEI) is calculated based on the deviation value. S4: Determine the therapeutic effect status of the current music based on the Therapeutic Effect Index (TEI). When the TEI is lower than the preset threshold, select the alternative music with the highest matching degree with the patient's current status from the music library. S5: Use changes in the patient's physiological and psychological indicators, music feature vectors, and the treatment effect index (TEI) as training samples to update the music-patient state association model and achieve adaptive optimization of the treatment plan.

2. The music playback method for a music therapy instrument according to claim 1, characterized in that, The acquisition of baseline physiological indicators in S1 includes: setting a rest period of 5-10 minutes before the start of treatment, collecting physiological data every 10 seconds, and taking the average value as the baseline value after denoising and outlier removal of the collected data; the energy distribution of the EEG frequency band includes the power spectral density of alpha waves, beta waves and theta waves.

3. The music playback method for a music therapy instrument according to claim 1, characterized in that, The extraction of therapeutic fit features in S2 includes: calculating the rate of change of music rhythm within a time window to obtain a music stability index; analyzing the temporal change trend of music emotional features to obtain an emotional guidance tendency; and calculating cognitive load based on music complexity and information entropy; the time window is 30 seconds.

4. The music playback method for a music therapy instrument according to claim 1, characterized in that, The method for calculating the treatment efficacy index (TEI) in S3 is as follows: first, calculate the physiological improvement index (PII) and the psychological improvement index (MII), and then obtain the TEI through weighted fusion. The formula for calculating the Physiological Improvement Index (PII) is as follows: in, For the first The weighting coefficients of each physiological indicator for Time of the first The deviation of each physiological indicator from the baseline value For the first Baseline values ​​of each physiological indicator As a direction correction factor, when physiological indicators change towards the treatment target... ,on the contrary ; The total number of physiological indicators; The formula for calculating the Therapeutic Efficacy Index (TEI) is as follows: in, , The physiological and psychological weights at the current moment. As the cumulative effect weight, the integral term represents the period from the start of treatment. up to the current moment The cumulative therapeutic effect.

5. The music playback method for a music therapy instrument according to claim 4, characterized in that, The calculation method of the Psychological Improvement Index (MII) is as follows: the patient's facial expressions are classified by a convolutional neural network to obtain the emotional state value; the speech signal is analyzed by a recurrent neural network to obtain the psychological state value; and the attention concentration is calculated by eye tracking and the proportion of alpha waves in the brain. The normalized change rates of the above three indicators are weighted and summed to obtain the MII. The weight coefficients are dynamically adjusted according to the type of treatment goal.

6. The music playback method for a music therapy instrument according to claim 1, characterized in that, The method for selecting alternative music in S4 includes: when TEI is below a preset threshold for three consecutive samples. The music switching mechanism is triggered on demand; the therapeutic suitability of each song in the music library is calculated. Choose music with the highest compatibility and whose emotional characteristics differ from the current music within an acceptable range as alternative music; Therapeutic fit The calculation formula is: in, This is the target music feature vector calculated based on the patient's current state. For candidate music feature vectors, Score the historical validity of the candidate music. The similarity between the current music and the candidate music. , , The weighting coefficients are satisfied. .

7. The music playback method for a music therapy instrument according to claim 6, characterized in that, The music switching adopts a gradual transition strategy: the current music's rhythmic stability section is detected as the switching point, and the volume of the current music is reduced starting 15 seconds before the switching point, while the volume of the alternative music is gradually increased, so that the two music tracks complete the volume crossover at the switching point; the volume change curve adopts an S-shaped function to avoid auditory discomfort caused by abrupt changes.

8. The music playback method for a music therapy instrument according to claim 1, characterized in that, The music-patient state association model in S5 is constructed using a deep reinforcement learning framework: the patient's current physiological and psychological state is taken as the environmental state, music selection and playback parameter adjustment are taken as the action space, and the treatment effect index (TEI) is taken as the immediate reward; the policy network and value network are trained by the Actor-Critic algorithm, the policy network outputs the optimal music selection policy, and the value network evaluates the long-term value of the state-action pair.

9. A method for playing music in a music therapy instrument according to claim 8, characterized in that, The update of the correlation model adopts an incremental learning mechanism: after each complete treatment course, all training samples of this course are added to the experience replay pool; when the number of samples in the experience replay pool exceeds a preset threshold, a batch of samples is randomly selected from it to update the model parameters; at the same time, an independent personalized parameter layer is maintained for each patient, and the underlying feature extraction network of the model is shared to achieve a balance between group knowledge and individual adaptation.

10. A music playback system for a music therapy instrument, used to implement the method according to any one of claims 1-9, characterized in that, include: The baseline data acquisition module is used to collect baseline physiological and psychological indicators of patients in a resting state and to build a personalized baseline database. The baseline data acquisition module includes a physiological signal sensor group, a facial expression recognition unit, a voice emotion analysis unit, and an attention monitoring unit; The music feature analysis module is used to extract multi-dimensional features from music in the music library and construct music feature vectors; the music feature analysis module includes an acoustic feature extraction unit, a spectrum feature extraction unit, an emotional feature extraction unit, and a therapy adaptation feature calculation unit; The real-time treatment effect assessment module is used to collect the patient's current physiological and psychological indicators in real time during music playback and calculate the treatment effect index (TEI). The real-time treatment effect assessment module includes a real-time data acquisition unit, a deviation calculation unit, and a TEI calculation unit. An adaptive music control module is used to determine the therapeutic effect status of the current music based on the Therapeutic Effect Index (TEI) and to select alternative music from the music library for switching when necessary. The adaptive music control module includes an effect judgment unit, a music matching unit, and a progressive switching unit. The association model learning module is used to construct training samples from changes in patient physiological and psychological indicators, music feature vectors, and treatment effect index (TEI) to update the music-patient state association model. The association model learning module includes a sample construction unit, a deep reinforcement learning unit, an experience playback pool, and a personalized parameter storage unit. The central controller communicates with each of the above modules and is used to coordinate the workflow of each module and store treatment data. A music player, connected to the adaptive music control module and the central controller, is used to play music and execute music switching commands.