CN-115721830-B - Sleep-aiding music generation method and device, computer equipment and storage medium
Abstract
The invention discloses a generation method and device of sleep-aiding music, computer equipment and a storage medium, relating to the technical field of computers, wherein the specific implementation scheme is that a plurality of sleep-aiding music frequency spectrums are acquired; and processing the plurality of sleep-aiding music frequency spectrums by utilizing a genetic algorithm to obtain a sleep-aiding music frequency spectrum chain, and generating sleep-aiding music according to the sleep-aiding music frequency spectrum chain. Therefore, the sleep-aiding music frequency spectrum can be used as genetic material, and sleep-aiding music is generated by utilizing a genetic algorithm, so that not only is the effect and reliability of the sleep-aiding music ensured, but also the cost of the sleep-aiding music is reduced.
Inventors
- ZHANG CONG
- MENG ZI
- ZHU GUOKANG
- YU DIE
Assignees
- 安徽华米健康科技有限公司
Dates
- Publication Date
- 20260505
- Application Date
- 20210825
Claims (12)
- 1. A method for generating sleep-aiding music, comprising the steps of: acquiring a plurality of sleep-aiding music frequency spectrums; Processing the plurality of sleep-aiding music frequency spectrums by utilizing a genetic algorithm to obtain a sleep-aiding music frequency spectrum chain; Generating sleep-aiding music according to the sleep-aiding music frequency spectrum chain; The processing the plurality of sleep-aiding music spectrums by using a genetic algorithm to obtain a sleep-aiding music spectrum chain includes: selecting a target sleep-aiding music frequency spectrum to be processed from the plurality of sleep-aiding music frequency spectrums according to sleep-aiding values corresponding to each sleep-aiding music frequency spectrum, and generating target sub-sleep-aiding music frequency spectrums of all levels according to the target sleep-aiding music frequency spectrums by utilizing a genetic algorithm; Determining the sleep-aiding music frequency spectrum chain according to the target sleep-aiding music frequency spectrum and the generated target sleep-aiding music frequency spectrums of all levels; the sleep-aiding value is used for representing the sleep-aiding effect of the sleep-aiding music frequency spectrum.
- 2. A method as recited in claim 1, wherein said obtaining a plurality of sleep-aiding music spectrums comprises: Obtaining m reference music frequency spectrums; identifying each reference music frequency spectrum by utilizing an identification model generated by training so as to determine a sleep-aiding value corresponding to each reference music frequency spectrum; and determining n reference music spectrums with corresponding sleep aiding values larger than a first threshold value in the m reference music spectrums as sleep aiding music spectrums, wherein m is larger than n, and n is a natural number larger than 1.
- 3. A method as recited in claim 1, wherein said generating each level of target sub-sleep-aiding music spectrum from said target sleep-aiding music spectrum using a genetic algorithm comprises: Performing cross operation and/or mutation operation on the target sleep-aiding music frequency spectrum respectively to generate a plurality of first-level sub sleep-aiding music frequency spectrums; selecting a target primary sub-sleep-aiding music frequency spectrum from the multiple primary sub-sleep-aiding music frequency spectrums according to sleep-aiding values corresponding to the primary sub-sleep-aiding music frequency spectrums; And returning to repeatedly execute the crossover operation and/or the mutation operation based on the target first-level sub-sleep-aiding music frequency spectrum until the operation times reach a preset value, and determining the sleep-aiding music frequency spectrum chain according to the target sleep-aiding music frequency spectrum and the generated target sub-sleep-aiding music frequency spectrums.
- 4. A method as claimed in any one of claims 1 to 3, further comprising, after said generating sleep-aiding music: Acquiring the sleep state of a user in the process of playing the sleep-aiding music; determining a sleep-aiding value of a sleep-aiding music frequency spectrum for generating the sleep-aiding music according to the sleep state; And removing the sleep-aiding music frequency spectrum generating any sleep-aiding music from the sleep-aiding music frequency spectrums under the condition that the sleep-aiding value of any sleep-aiding music is smaller than a second threshold value so as to acquire updated sleep-aiding music frequency spectrums.
- 5. The method of claim 4, wherein the acquiring the sleep state of the user comprises: Collecting a plurality of physiological parameters of the user by using wearable equipment, wherein the physiological parameters comprise at least one of rolling times, heart rate, blood pressure, respiratory rate and head movement frequency; and determining the sleep state of the user according to the physiological parameters.
- 6. A sleep-aiding music generating device, comprising: The first acquisition module is used for acquiring a plurality of sleep-aiding music frequency spectrums; The second acquisition module is used for processing the plurality of sleep-aiding music frequency spectrums by utilizing a genetic algorithm so as to acquire a sleep-aiding music frequency spectrum chain; The first generation module is used for generating sleep-aiding music according to the sleep-aiding music frequency spectrum chain; The second acquisition module includes: The processing unit is used for selecting a target sleep-aiding music frequency spectrum to be processed from the plurality of sleep-aiding music frequency spectrums according to the sleep-aiding value corresponding to each sleep-aiding music frequency spectrum, and generating target sub sleep-aiding music frequency spectrums of all levels according to the target sleep-aiding music frequency spectrums by utilizing a genetic algorithm; Determining the sleep-aiding music frequency spectrum chain according to the target sleep-aiding music frequency spectrum and the generated target sleep-aiding music frequency spectrums of all levels; the sleep-aiding value is used for representing the sleep-aiding effect of the sleep-aiding music frequency spectrum.
- 7. The apparatus of claim 6, wherein the first acquisition module is specifically configured to: Obtaining m reference music frequency spectrums; identifying each reference music frequency spectrum by utilizing an identification model generated by training so as to determine a sleep-aiding value corresponding to each reference music frequency spectrum; and determining n reference music spectrums with corresponding sleep aiding values larger than a first threshold value in the m reference music spectrums as sleep aiding music spectrums, wherein m is larger than n, and n is a natural number larger than 1.
- 8. The apparatus of claim 6, wherein the processing unit is configured to: Performing cross operation and/or mutation operation on the target sleep-aiding music frequency spectrum respectively to generate a plurality of first-level sub sleep-aiding music frequency spectrums; selecting a target primary sub-sleep-aiding music frequency spectrum from the multiple primary sub-sleep-aiding music frequency spectrums according to sleep-aiding values corresponding to the primary sub-sleep-aiding music frequency spectrums; And returning to repeatedly execute the crossover operation and/or the mutation operation based on the target first-level sub-sleep-aiding music frequency spectrum until the operation times reach a preset value, and determining the sleep-aiding music frequency spectrum chain according to the target sleep-aiding music frequency spectrum and the generated target sub-sleep-aiding music frequency spectrums.
- 9. The apparatus of any of claims 6-8, wherein the first generation module comprises: the first acquisition unit is used for acquiring the sleep state of the user in the process of playing the sleep-aiding music; The first generation unit is used for determining a sleep-aiding value of a sleep-aiding music frequency spectrum for generating the sleep-aiding music according to the sleep state; And the second generating unit is used for removing the sleep-aiding music frequency spectrum for generating any sleep-aiding music from the sleep-aiding music frequency spectrums when the sleep-aiding value of any sleep-aiding music is smaller than a second threshold value so as to acquire a plurality of updated sleep-aiding music frequency spectrums.
- 10. The apparatus of claim 9, wherein the first acquisition unit is specifically configured to: Collecting a plurality of physiological parameters of the user by using wearable equipment, wherein the physiological parameters comprise at least one of rolling times, heart rate, blood pressure, respiratory rate and head movement frequency; and determining the sleep state of the user according to the physiological parameters.
- 11. An electronic device, comprising: at least one processor, and A memory communicatively coupled to the at least one processor, wherein, The memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-5.
- 12. A non-transitory computer readable storage medium storing computer instructions for causing the computer to perform the method of any one of claims 1-5.
Description
Sleep-aiding music generation method and device, computer equipment and storage medium Technical Field The present disclosure relates to the field of computer technologies, and in particular, to a method, an apparatus, a computer device, and a storage medium for generating sleep-aiding music. Background The sleep can eliminate fatigue and enable people to generate new vigor, and has close relation with the capability of improving immunity and resisting diseases, and good immunity is derived from high-quality sleep. Music is used as a multimedia carrier, is easy to obtain and accepted by people, and becomes a main means for helping sleep. The music-based sleep-aiding means belongs to the category of psychological intervention and aims at decompressing a person and obtaining physical and mental relaxation so as to achieve the sleep-aiding effect. Sleep-aiding music used in the related art is mostly created manually. However, the emotion expressed by the artificially created sleep-aiding music has subjective colors of musicians, and the effect and the application range are limited. Therefore, how to scientifically and effectively realize the generation of sleep-aiding music is a problem to be solved currently. Disclosure of Invention The present disclosure provides a method, apparatus, device, and storage medium for generating sleep-aiding music. According to a first aspect of the present disclosure, there is provided a method for generating sleep-aiding music, including: acquiring a plurality of sleep-aiding music frequency spectrums; Processing the plurality of sleep-aiding music frequency spectrums by utilizing a genetic algorithm to obtain a sleep-aiding music frequency spectrum chain; And generating sleep-aiding music according to the sleep-aiding music frequency spectrum chain. Optionally, the acquiring a plurality of sleep-aiding music spectrums includes: Obtaining m reference music frequency spectrums; identifying each reference music frequency spectrum by utilizing an identification model generated by training so as to determine a sleep-aiding value corresponding to each reference music frequency spectrum; and determining n reference music spectrums with corresponding sleep aiding values larger than a first threshold value in the m reference music spectrums as sleep aiding music spectrums, wherein m is larger than n, and n is a natural number larger than 1. Optionally, the processing the plurality of sleep-aiding music spectrums by using a genetic algorithm to obtain a sleep-aiding music spectrum chain includes: And processing the plurality of sleep-aiding music frequency spectrums by utilizing a genetic algorithm based on the sleep-aiding value corresponding to each sleep-aiding music frequency spectrum so as to acquire a sleep-aiding music frequency spectrum chain. Optionally, the processing, by using a genetic algorithm, the plurality of sleep-aiding music spectrums based on the sleep-aiding value corresponding to each sleep-aiding music spectrum to obtain a sleep-aiding music spectrum chain includes: selecting a target sleep-aiding music frequency spectrum to be processed from the plurality of sleep-aiding music frequency spectrums according to the sleep-aiding value corresponding to each sleep-aiding music frequency spectrum; Performing cross operation and/or mutation operation on the target sleep-aiding music frequency spectrum respectively to generate a plurality of first-level sub sleep-aiding music frequency spectrums; Selecting a target primary sub-sleep-aiding music frequency spectrum from the multiple primary sub-sleep-aiding audio frequency spectrums according to sleep-aiding values corresponding to the primary sub-sleep-aiding audio frequency spectrums; And returning to repeatedly execute the crossover operation and/or the mutation operation based on the target first-level sub-sleep-aiding music frequency spectrum until the operation times reach a preset value, and determining the sleep-aiding music frequency spectrum chain according to the target sleep-aiding music frequency spectrum and the generated target sub-sleep-aiding music frequency spectrums. Optionally, after the generating the sleep-aiding music, the method further includes: Acquiring the sleep state of a user in the process of playing the sleep-aiding music; determining a sleep-aiding value of a sleep-aiding music frequency spectrum for generating the sleep-aiding music according to the sleep state; And removing the sleep-aiding music frequency spectrum generating any sleep-aiding music from the sleep-aiding music frequency spectrums under the condition that the sleep-aiding value of any sleep-aiding music is smaller than a second threshold value so as to acquire updated sleep-aiding music frequency spectrums. Optionally, the acquiring the sleep state of the user includes: Collecting a plurality of physiological parameters of the user by using wearable equipment, wherein the physiological parameters comprise at least one of