A dynamic sleep-aid music generation method, electronic device, and storage medium
Patent Information
- Application Number
- CN202610959682.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-30
- Publication Date
- 2026-08-18
AI Technical Summary
[0002]现有助眠音乐生成系统,大多依赖用户的历史静态信息(如个人偏好、既往生理数据等)进行音乐推荐或预置曲目播放,难以实时响应生理状态的动态变化,无法实现真正的动态自适应,导致助眠效果不佳
[0038] This application embodiment determines the user's current sedation need in real time and dynamically adjusts music parameters based on this need to generate matching sleep-aid music in real time. This ensures that the music always changes with the user's physiological state; when the user is tense, the music tends to be calming, and when the user is relaxed, the music tends to be natural. This achieves dynamic tracking between sleep-aid music and the user's physiological state, significantly improving the sleep-aid effect and user experience. At the same time, this application embodiment can adapt to the differentiated needs of different users at different times without manual intervention, further improving the personalized adaptability and effectiveness of sleep-aid music for each user.
Smart Images

Figure CN122582438A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of audio technology, and in particular to a method for generating dynamic sleep-aid music, an electronic device, and a storage medium. Background Technology
[0002] Most existing sleep-aid music generation systems rely on users' historical static information (such as personal preferences, past physiological data, etc.) to recommend music or play preset tracks. They are unable to respond to dynamic changes in physiological state in real time and cannot achieve true dynamic self-adaptation, resulting in poor sleep-aid effects.
[0003] Therefore, improvements to existing technologies are necessary.
[0004] The above information is provided as background information only to aid in understanding this application and does not constitute an assertion or admission that any of the above content can be used as prior art relative to this application. Summary of the Invention
[0005] This application provides a method for generating dynamic sleep-aid music, as well as an electronic device and storage medium, which can dynamically generate sleep-aid music that adapts to the user's current physiological state to enhance the sleep-aid effect.
[0006] To achieve the above objectives, this application provides the following technical solution:
[0007] In a first aspect, embodiments of this application provide a method for generating dynamic sleep-aid music, including:
[0008] The user's current sedation need level is determined in real time, and the current sedation need level is used to characterize the intensity of sedation intervention corresponding to the user's current physiological state;
[0009] Music parameters are calculated based on the current sedation requirement. The music parameters include pitch, loudness, vibrato speed and / or vibrato depth, and the current sedation requirement is negatively correlated with the pitch, loudness, vibrato speed and vibrato depth.
[0010] Based on the music parameters, sleep-inducing music is generated to promote relaxation for the user.
[0011] Optionally, determining the user's current sedation need includes:
[0012] The system obtains the user's baseline heart rate and the user's heart rate value sequence within a preset time window; the preset time window is a time interval formed by tracing back a preset duration from the current moment.
[0013] Based on the baseline heart rate and the heart rate value sequence, the user's current heart rate characteristic index is calculated. The current heart rate characteristic index includes the relative average heart rate used to characterize whether the current physiological state is tense or relaxed, the heart rate fluctuation intensity used to characterize the degree of instability of the current heart rate, and / or the heart rate change trend used to characterize the change trend of the current physiological state.
[0014] The current sedation requirement is calculated based on the heart rate characteristic indicators.
[0015] Optionally, the calculation method for the current heart rate characteristic index includes:
[0016] The relative average heart rate is the difference between the average heart rate value sequence and the baseline heart rate.
[0017] The heart rate fluctuation intensity is the standard deviation of each heart rate value in the heart rate value sequence.
[0018] The heart rate change trend is the ratio of the difference between the current heart rate value and the heart rate value at the time before the preset duration to the preset duration.
[0019] Optionally, the current sedation requirement is calculated using the following formula:
[0020] S=min(max((dr / 30 + std / 10 + max(0,slope / 1)) / 3,0),1);
[0021] Where S represents the current sedation requirement, dr represents the relative average heart rate, std represents the intensity of heart rate fluctuations, and slope represents the trend of heart rate changes.
[0022] Optionally, the pitch range is [60Hz, 100Hz], the loudness range is [0.1, 0.4], the vibrato speed range is [0.3Hz, 0.8Hz], and the vibrato depth range is [0.05, 0.15].
[0023] Optionally, the music parameters are calculated according to the following formula:
[0024] f = 60 + 40 * (1 - S);
[0025] a = 0.1 + 0.3 * (1 - S);
[0026] r = 0.3 + 0.5 * (1 - S);
[0027] d = 0.05 + 0.1 * (1 - S);
[0028] in, Given the current level of sedation demand, For pitch, For loudness, For vibrato speed, This refers to the vibrato depth.
[0029] Optionally, generating sleep-inducing music to promote relaxation for the user based on the music parameters includes:
[0030] A vibrato modulation factor is generated based on the vibrato velocity and the vibrato depth;
[0031] Based on the pitch, the loudness, and the vibrato modulation factor, a main audio frequency is generated using a sine wave as the carrier wave;
[0032] Background audio is generated according to a preset fixed frequency;
[0033] The main audio and the background audio are superimposed and amplitude-limited to keep the output signal amplitude within the range of digital audio standards, thus outputting the sleep-aid music.
[0034] Optionally, the preset fixed frequency can be set within the range of [50Hz, 80Hz].
[0035] Secondly, embodiments of this application provide an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the dynamic sleep-aid music generation method described above.
[0036] Thirdly, embodiments of this application provide a computer-readable storage medium storing computer-executable instructions thereon, which are executed by a computer processor to implement the dynamic sleep-aid music generation method described above.
[0037] Compared with the prior art, this application has the following beneficial effects:
[0038] This application embodiment determines the user's current sedation need in real time and dynamically adjusts music parameters based on this need to generate matching sleep-aid music in real time. This ensures that the music always changes with the user's physiological state; when the user is tense, the music tends to be calming, and when the user is relaxed, the music tends to be natural. This achieves dynamic tracking between sleep-aid music and the user's physiological state, significantly improving the sleep-aid effect and user experience. At the same time, this application embodiment can adapt to the differentiated needs of different users at different times without manual intervention, further improving the personalized adaptability and effectiveness of sleep-aid music for each user.
[0039] This application has other features and advantages that will be apparent from or will be set forth in detail in the accompanying drawings and following detailed description, which together serve to explain the particular principles of this application. Attached Figure Description
[0040] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0041] Figure 1 This is a flowchart of the dynamic sleep-aid music generation method provided in the embodiments of this application. Detailed Implementation
[0042] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0043] Traditional sleep-aid music systems rely solely on users' historical static information (such as personal preferences and past physiological data) to generate music recommendations or preset tracks, making it difficult to respond in real time to the dynamic changes in users' physiological states. This results in poor sleep-aid effects and experience.
[0044] Therefore, this application provides a dynamic sleep aid music generation method that can adaptively generate matching sleep aid music according to the dynamic changes in the user's physiological state, thereby significantly improving the sleep aid effect and user experience.
[0045] Please refer to Figure 1 The dynamic sleep-aid music generation method provided in this application includes:
[0046] S1. Determine the user's current sedation need level in real time. The current sedation need level is used to characterize the intensity of sedation intervention corresponding to the user's current physiological state.
[0047] This step is performed continuously or intermittently at a certain sampling frequency, rather than all at once, so as to ensure that the current sedation requirement can be updated according to the instantaneous changes in the user's physiological state, providing a real-time basis for the dynamic adjustment of subsequent music parameters.
[0048] For example, a user's physiological state can be divided into two main categories: a tense state and a relaxed state. A tense state refers to a state in which the sympathetic nervous system is dominant and the level of physiological arousal is high. This high level of tension can be manifested by physiological characteristics such as increased heart rate, greater heart rate fluctuations, and an upward trend in heart rate. A relaxed state refers to a state of low alertness and parasympathetic nervous system dominance, which corresponds to the pre-sleep state. This state has a relatively low level of tension and is the target state that the user is expected to reach.
[0049] Sedation need is a real-time, dynamically quantified indicator of intervention intensity. A higher value indicates that the user is currently more tense and needs stronger sedation intervention, while a lower value indicates that the user is closer to a relaxed state and does not need additional intervention.
[0050] S2. Calculate music parameters based on the current sedation requirement. The music parameters include pitch, loudness, vibrato speed and / or vibrato depth, and the current sedation requirement is negatively correlated with pitch, loudness, vibrato speed and vibrato depth.
[0051] In this embodiment, all music parameters are adjustable acoustic properties. Among them, pitch determines the main frequency of the sleep-aid music; loudness determines the amplitude of the sound; vibrato speed determines the speed of amplitude fluctuation; and vibrato depth determines the depth of amplitude fluctuation.
[0052] It is important to note that the current calming requirement is negatively correlated with pitch, loudness, vibrato speed, and vibrato depth. This means that all four music parameters decrease as the calming requirement increases, and increase as the calming requirement decreases. This is because: when the user is tense, the calming requirement is high, and the music parameters uniformly decrease—the pitch decreases to make the music more stable, the loudness decreases to reduce auditory stimulation, the vibrato speed decreases to make the fluctuations smoother, and the vibrato depth decreases to make the sound purer—thus promoting the user's transition to a relaxed state with minimal auditory stimulation; when the user is already relatively relaxed, the calming requirement is low, and the music parameters uniformly increase, restoring the music to a natural and comfortable listening state, avoiding auditory fatigue or discomfort caused by continuous excessive suppression.
[0053] S3. Generate sleep-inducing music to promote user relaxation based on music parameters.
[0054] This step uses the four calculated music parameters mentioned above as input to generate an audio signal with corresponding acoustic characteristics in real time and outputs it to the user, rather than matching or playing existing tracks from a preset music library. This ensures that the one-to-one correspondence between the music parameters and the current calming requirement can be accurately mapped to the music actually played.
[0055] In summary, this application embodiment determines the user's current sedation need in real time and dynamically adjusts the music parameters based on the need to generate matching sleep-aid music in real time, so that the music always changes with the changes in the user's physiological state—when the user is tense, the music tends to be calming, and when the user is relaxed, the music tends to be natural, thereby realizing the dynamic tracking of sleep-aid music with the user's physiological state.
[0056] Based on this, the embodiments of this application can respond to the dynamic changes in the user's physiological state in real time, overcoming the problem that music playback in traditional solutions cannot respond to changes in the user's state, and significantly improving the sleep aid effect and user experience; at the same time, the embodiments of this application can adapt to the differentiated needs of different users at different times without manual intervention, further improving the personalized adaptability and effectiveness of sleep aid music for each user.
[0057] In one alternative implementation, the method for determining the user's current sedation need in step S1 includes:
[0058] S11. Obtain the user's baseline heart rate and the user's heart rate value sequence within a preset time window; the preset time window is a time interval formed by tracing back a preset duration from the current moment.
[0059] Baseline heart rate hr base This can be the user's standard heart rate value at rest, serving as a reference for judging whether the user's current heart rate is relatively high or low. This reference heart rate can be the statistical average of the user's daily resting heart rate, or it can be a stable heart rate value measured when the user is in a relaxed state.
[0060] S12. Based on the baseline heart rate and heart rate value sequence, calculate the user's current heart rate characteristic indicators, including the relative average heart rate, heart rate fluctuation intensity and / or heart rate change trend.
[0061] Relative average heart rate is used to characterize the degree to which a user's current overall heart rate level deviates from their baseline heart rate. For example, it is calculated as: Relative average heart rate dr = Average heart rate value - hr base When the relative average heart rate is positive, it indicates that the user's current overall heart rate is high, and the physiological state tends to be tense or excited; when the relative average heart rate is zero or negative, it indicates that the user's current overall heart rate is low, and the physiological state tends to be relaxed.
[0062] Heart rate variability intensity is used to characterize the amplitude of a user's heart rate fluctuation within a preset time window. For example, it is calculated as: heart rate variability intensity std = standard heart rate over 60 seconds. A larger standard deviation indicates a more unstable heart rate, weaker autonomic nervous system regulation, and a higher probability that the user is currently in a state of tension or anxiety; a smaller standard deviation indicates a more stable heart rate, more stable autonomic nervous system regulation, and a higher probability that the user is currently in a relaxed state.
[0063] Heart rate trend refers to the direction and rate of change of heart rate within a preset time window, used to characterize whether the user's physiological state tends towards further tension or further relaxation. For example, the calculation method is: Heart rate trend slope = (Current heart rate value - Heart rate value 60 seconds ago) / 60. When the heart rate trend slope is positive, it indicates that the heart rate is rising, and the user is becoming more tense; when the heart rate trend slope is zero or negative, it indicates that the heart rate is falling, and the user is becoming more relaxed.
[0064] The three heart rate characteristic indicators mentioned above comprehensively characterize the user's current physiological state from three dimensions: "absolute deviation", "fluctuation and instability" and "dynamic change direction", providing a multi-dimensional data foundation for calculating the sedation requirement in this scheme.
[0065] S13. Calculate the current sedation requirement based on heart rate characteristic indicators.
[0066] This step integrates multidimensional heart rate characteristic indicators into a comprehensive quantitative value of intervention intensity, so that the originally scattered physiological indicators can be uniformly mapped to the basis for subsequent music parameter adjustment.
[0067] For example, the formula for calculating the current sedation requirement S is:
[0068] S=min(max((dr / 30 + std / 10 + max(0,slope / 1)) / 3,0),1);
[0069] Among them, the higher the relative average heart rate (dr), the more nervous you are and the more you need to calm down; the higher the heart rate fluctuation intensity (std), the more unstable your heart rate is and the more you need to calm down; as for the heart rate change trend (slope), you only need to increase the degree of calming down when your heart rate is rising, and you do not need to increase the degree of calming down when your heart rate is falling, so as to avoid interfering with natural relaxation.
[0070] It is understood that, by acquiring the current user's baseline heart rate and real-time heart rate value sequence, this application embodiment can perform personalized analysis using the user's own resting heart rate as a reference, avoiding the problem of poor applicability of a uniform threshold among different users. By calculating three complementary indicators—relative average heart rate, heart rate fluctuation intensity, and heart rate change trend—the current physiological state of the user is comprehensively characterized from multiple dimensions, improving the accuracy and reliability of sedation demand calculation. Furthermore, by limiting the preset time window to an interval tracing back from the current moment, it ensures that the analyzed physiological data always reflects the user's recent state changes, giving the subsequently calculated sedation demand good real-time performance and enabling timely updates to keep pace with the dynamic changes in the user's physiological state.
[0071] In one optional implementation, the calculation formulas for the various music parameters in step S2 are as follows:
[0072] (1) The pitch f = 60 + 40 * (1 - S), with a range of 60-100HZ, determines the fundamental frequency of the sound.
[0073] When stressed: Extremely low tones are needed. This is because high-frequency sounds activate the auditory cortex and amygdala, further increasing the excitability of the sympathetic nervous system, while extremely low-frequency sounds are similar to the frequency of bodily vibrations in a resting state, making them less likely to trigger alertness and having an "acoustic calming" effect.
[0074] When relaxed: a slightly higher but still relatively low pitch. This is because the parasympathetic nervous system is dominant at this time, auditory sensitivity decreases, and slightly higher low-frequency sounds will not cause excitement. Instead, they can maintain the continuity of the auditory background and avoid the discomfort caused by the sudden disappearance of music.
[0075] (2) Loudness a = 0.1 + 0.3 * (1 - S), range 0.1-0.4, determines the sound pressure level.
[0076] When stressed: Extremely low volume is needed. This is because, under stress, cortisol levels rise, the auditory threshold decreases (making one more sensitive to sound), and extremely low volume can minimize the auditory input load on the brain, avoiding additional stimulation.
[0077] When relaxed: slightly higher but lower loudness. This is because auditory sensitivity returns to normal when relaxed, which can increase loudness. Soft sounds will not disturb sleep and can also mask environmental noise, improving sleep stability.
[0078] (3) The vibrato speed r = 0.3 + 0.5 * (1 - S), with a range of 0.3-0.8 Hz, determines the frequency of amplitude modulation.
[0079] When stressed: Extremely slow vibrato is needed. This is because rapid vibrato easily induces auditory rhythm following and may activate the motor nervous system, while extremely slow vibrato is close to the steady state during apnea, does not interfere with the activation of the parasympathetic nervous system, and helps the heart rate to stabilize.
[0080] When relaxed: a slightly faster but still relatively slow vibrato. This is because the vibrato can be slightly faster, tending towards the breathing rate in a quiet state, providing a subtle rhythmic guidance without causing active synchronization, thus maintaining a sense of tranquility.
[0081] (4) The vibrato depth d = 0.05 + 0.1 * (1 - S), ranging from 0.05 to 0.15, determines the amplitude of the amplitude change.
[0082] When nervous: a very shallow vibrato is needed. This is because deep amplitude modulation produces an auditory motion sensation of "volume fluctuating," which triggers the brain's sound source localization and avoidance response. A very shallow vibrato is almost equivalent to a pure tone, which will not cause any transient changes in attention, and the hearing remains stable.
[0083] When relaxed: a slightly higher but still shallower vibrato. This is because listening to a completely unchanging pure tone for a long time may lead to auditory adaptation and irritability. Slightly increasing the vibrato can break the monotony of the pure tone without triggering an alert response, thus maintaining a comfortable auditory environment.
[0084] In one optional implementation, the method for generating sleep-inducing music to promote user relaxation in step S3, based on music parameters, may include:
[0085] S31. Set the sampling rate of audio synthesis, sample_rate, and define the time variable t as the absolute time starting from the start of audio synthesis, which is used to provide a unified time reference for the generation of all subsequent time-domain signals.
[0086] S32. Calculate the vibrato modulation factor mod based on vibrato velocity r and vibrato depth d.
[0087] The vibrato modulation factor is used to periodically modulate the amplitude of the main audio, producing a slowly fluctuating auditory effect. This slow fluctuation simulates the amplitude fluctuation characteristics commonly found in natural sounds, which can induce the user's autonomic nervous system to respond synchronously with the sound envelope, thereby helping the user enter a relaxed state.
[0088] For example, the vibrato modulation factor is calculated as: mod = 1 + d * sin(2π * r * t).
[0089] S33. Based on the pitch f, loudness a, and vibrato modulation factor mod, generate the main audio frequency main using a sine wave as the carrier wave.
[0090] The main audio signal (main) is the core signal of the sleep-aid music. Its frequency is determined by the pitch f, its overall amplitude is determined by the loudness a, and its amplitude fluctuates slowly over time, which is introduced by the vibrato modulation factor mod. For example, the formula for calculating the main audio signal (main) is: main = a * mod * sin(2π * f * t).
[0091] S34. Generate background audio bg according to a preset fixed frequency.
[0092] Background audio (bg) serves as a low-frequency acoustic base, independent of and continuously present in relation to the main audio (main), providing stable and continuous underlying auditory support for sleep-aid music. In this embodiment, the preset fixed frequency ranges from 50Hz to 80Hz, preferably 60Hz. It is selected based on an octet of the typical human resting heart rate fundamental frequency, providing a constant and stable low-frequency reference without changing with the user's real-time heart rate, thus enhancing the listener's sense of envelopment and security provided by the sleep-aid music. The frequency of background audio (bg) avoids the main frequency band of the main audio (main), and the combination of the two makes the overall music's spectral distribution more continuous and balanced.
[0093] For example, the formula for calculating the background sound bg is: bg = 0.1 * sin(2π * 60 * t).
[0094] S35. The main audio (main) and background audio (bg) are superimposed, and the superimposed signal is amplitude-limited to ensure that the amplitude of the output signal remains within the effective range of the digital audio standard, avoiding clipping distortion caused by signal overload, and finally outputting sleep-aid music.
[0095] For example, the amplitude limiting process is calculated according to the following formula: sample = max(-1, min(1, main +bg)), where sample refers to the amplitude of a sample point of the final output sleep-aid music signal.
[0096] It should be further explained that, in this embodiment, the main audio is amplitude modulated using a vibrato modulation factor, giving the generated sleep-aid music a slow, continuous, and natural amplitude fluctuation characteristic. This characteristic can induce a synchronous response between the user's autonomic nervous system and the sound envelope, assisting the user in transitioning from a tense state to a relaxed state. By setting a fixed low-frequency background audio independent of the main audio, a stable acoustic foundation is provided for the sleep-aid music in the low-frequency region, enriching the music's spectral structure and enhancing the sense of immersion and envelopment. The background audio uses a fixed frequency of 60Hz and does not dynamically change with the user's heart rate, ensuring both the stability and predictability of the output while avoiding acoustic abrupt changes or auditory discomfort that might be introduced by real-time frequency tracking. Amplitude limiting ensures that the output signal is always within the safe range of digital audio standards, avoiding the damage to the listening experience caused by clipping distortion.
[0097] In summary, this application embodiment continuously tracks changes in various heart rate characteristic indicators of the user and converts them into dynamic audio in real time, allowing the user to unconsciously perceive the immediate "response" of their own physiological state through hearing, thereby forming an adaptive closed-loop biofeedback. Moreover, this application embodiment responds promptly to changes in physiological state, dynamically matching the current relaxation needs without user intervention, significantly improving the targeted nature of sleep aids.
[0098] Secondly, embodiments of this application provide an electronic device, including a memory and a processor, wherein the memory stores a computer program, characterized in that the processor executes the computer program to implement the dynamic sleep-aid music generation method described in any embodiment.
[0099] The above-described device can execute the methods provided in any embodiment of this application, and has the corresponding functional modules and beneficial effects for executing the methods, which will not be described in detail here.
[0100] It is understood that the electronic device can specifically be a terminal device with data processing and audio output functions, such as a smartphone, smartwatch, smart bracelet, smart earphone, sleep aid, smart speaker, tablet, laptop or desktop computer.
[0101] In other words, the electronic device can be a wearable device (such as a smartwatch or smart bracelet) worn on the user's body, which collects the user's physiological signals in real time through an integrated heart rate sensor and processes them locally; or it can be an independent host device (such as a sleep aid or smart speaker), which communicates with an external physiological signal acquisition device (such as a heart rate belt or smartwatch), obtains the user's physiological data, executes the method described in this application, and plays the generated sleep-aid music through a built-in or external audio output device (such as a speaker or headphones).
[0102] This application does not limit the specific product form of the electronic device, as long as it can realize the functions of data collection or acquisition, data processing and audio playback.
[0103] Thirdly, embodiments of this application provide a computer-readable storage medium storing computer-executable instructions that, when executed by a processor, implement the dynamic sleep-aid music generation method provided in all embodiments of this application.
[0104] Any combination of one or more computer-readable media may be used. A computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. 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 (a non-exhaustive list) of computer-readable storage media include: an electrical connection having one or more wires, a portable computer disk, a hard disk, 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 device, magnetic storage device, or any suitable combination thereof. In this document, a computer-readable storage medium can be any tangible medium that contains or stores a program that can be used by or in connection with an instruction execution system, apparatus, or device.
[0105] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, capable of sending, propagating, or transmitting programs for use by or in connection with an instruction execution system, apparatus, or device.
[0106] Program code contained on a computer-readable medium may be transmitted using any suitable medium, including—but not limited to—wireless, wire, optical fiber, RF, etc., or any suitable combination thereof.
[0107] Computer program code for performing the operations of this application can be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, and C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0108] Finally, it should be noted that although the above embodiments have been described in the text and drawings of this application, this should not limit the scope of patent protection of this application. Any technical solutions that are based on the essential concept of this application and utilize the content described in the text and drawings of this application, resulting in equivalent structural or procedural substitutions or modifications, as well as the direct or indirect application of the technical solutions of the above embodiments to other related technical fields, are all included within the scope of patent protection of this application.
Claims
1. A method for generating dynamic sleep-aid music, characterized in that, include: The user's current sedation need level is determined in real time, and the current sedation need level is used to characterize the intensity of sedation intervention corresponding to the user's current physiological state; Music parameters are calculated based on the current sedation requirement. The music parameters include pitch, loudness, vibrato speed and / or vibrato depth, and the current sedation requirement is negatively correlated with the pitch, loudness, vibrato speed and vibrato depth. Based on the music parameters, sleep-inducing music is generated to promote relaxation for the user.
2. The method for generating dynamic sleep-aid music according to claim 1, characterized in that, Determining the user's current sedation requirement includes: The system obtains the user's baseline heart rate and the user's heart rate value sequence within a preset time window; the preset time window is a time interval formed by tracing back a preset duration from the current moment. Based on the baseline heart rate and the heart rate value sequence, the user's current heart rate characteristic index is calculated. The current heart rate characteristic index includes the relative average heart rate used to characterize whether the current physiological state is tense or relaxed, the heart rate fluctuation intensity used to characterize the degree of instability of the current heart rate, and / or the heart rate change trend used to characterize the change trend of the current physiological state. The current sedation requirement is calculated based on the current heart rate characteristics.
3. The method for generating dynamic sleep-aid music according to claim 2, characterized in that, The calculation method for the current heart rate characteristic index includes: The relative average heart rate is the difference between the average of the heart rate values in the heart rate value sequence and the baseline heart rate. The heart rate fluctuation intensity is the standard deviation of each heart rate value in the heart rate value sequence. The heart rate change trend is the ratio of the difference between the current heart rate value and the heart rate value at the time before the preset duration to the preset duration.
4. The method for generating dynamic sleep-aid music according to claim 3, characterized in that, The current sedation requirement is calculated using the following formula: S=min(max((dr / 30 + std / 10 + max(0,slope / 1)) / 3,0),1); Where S represents the current sedation requirement, dr represents the relative average heart rate, std represents the intensity of heart rate fluctuations, and slope represents the trend of heart rate changes.
5. The method for generating dynamic sleep-aid music according to claim 1, characterized in that, The pitch ranges from 60Hz to 100Hz, the loudness ranges from 0.1 to 0.4, the vibrato speed ranges from 0.3Hz to 0.8Hz, and the vibrato depth ranges from 0.05 to 0.
15.
6. The method for generating dynamic sleep-aid music according to claim 1, characterized in that, The music parameters are calculated according to the following formula: f = 60 + 40 * (1 - S); a = 0.1 + 0.3 * (1 - S); r = 0.3 + 0.5 * (1 - S); d = 0.05 + 0.1 * (1 - S); in, Given the current level of sedation demand, For pitch, For loudness, For vibrato speed, This refers to the vibrato depth.
7. The method for generating dynamic sleep-aid music according to claim 1, characterized in that, The step of generating sleep-inducing music to promote relaxation for the user based on the music parameters includes: A vibrato modulation factor is generated based on the vibrato velocity and the vibrato depth; Based on the pitch, the loudness, and the vibrato modulation factor, a main audio frequency is generated using a sine wave as the carrier wave; Background audio is generated according to a preset fixed frequency; The main audio and the background audio are superimposed and amplitude-limited to keep the output signal amplitude within the range of digital audio standards, thus outputting the sleep-aid music.
8. The method for generating dynamic sleep-aid music according to claim 1, characterized in that, The preset fixed frequency range is [50Hz, 80Hz].
9. An electronic device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the dynamic sleep-aid music generation method as described in any one of claims 1-8.
10. A computer-readable storage medium having computer-executable instructions stored thereon, characterized in that, The computer-executable instructions are executed by a computer processor to implement the dynamic sleep-aid music generation method as described in any one of claims 1-8.