Brain wave sleep-aiding music generation method and device capable of adjusting sleep state, equipment and medium
By combining real-time brain wave music with professional sleep aid music, using the CycleGAN model to generate brain wave sleep aid music, the shortcomings of improving music artisticity and sleep quality in the existing technology are solved, and more efficient sleep state regulation and sleep quality improvement are achieved.
Patent Information
- Application Number
- CN202411821224.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-11
- Publication Date
- 2025-04-08
- Estimated Expiration
- 2044-12-11
AI Technical Summary
The existing brain wave sleep-assisted music generation methods lack the artistic quality of music and the effectiveness of improving sleep quality. Due to the unstableness of EEG signals, the direct mapping of the generated music may have a adverse effect on sleep quality.
By acquiring EEG signals, preprocessing and sleep stage analysis, combining real-time brain wave music with professional sleep aid music, CycleGAN-based music style transfer model generates brain wave sleep aid music for the current sleep state.
The generated brain wave sleep aid music has higher artistic and medical professionalism, which can more accurately regulate the subject's sleep state and improve the quality of sleep.
Smart Images

Figure CN119770062A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of electroencephalogram signal processing, and in particular to a method, device, equipment and medium for generating brainwave sleep-aiding music capable of adjusting sleep state. Background Art
[0002] Brainwave music is a therapy that aims to improve sleep quality and promote relaxation by synchronizing sounds of specific frequencies with brain waves. During sleep, the frequency of brain waves changes, and different sleep stages have different brainwave patterns. The main brainwave frequency bands include delta, theta, alpha and beta, which can provide important information about sleep stages and quality. When people close their eyes, relax or engage in light attention activities, the brain produces alpha waves, indicating that consciousness is awake and in a relaxed state; in the light sleep stage, the brain produces theta waves, indicating that consciousness is interrupted and deeply relaxed; and in the deep sleep state, the brain produces delta waves. In contrast, in a state of tension, stress or fatigue, the brain produces higher-frequency beta waves, and people often have difficulty falling asleep at this time. Some neurological studies have shown that brainwave music helps regulate the brain's activity patterns, thereby improving sleep and relaxation. The theoretical basis is that by listening to sounds of specific frequencies, the brain's frequency can be changed, making it easier for people to enter a deep sleep state. However, it should be noted that due to the significant differences in brain wave patterns between different individuals, different brain wave music has different degrees of applicability to different individuals.
[0003] Brainwave music generation is an innovative technology that combines brainwave science and music creation principles. By using specially designed equipment, the brain's electrophysiological signals are captured and converted into musical sounds and melodies according to specific mapping rules. The human brain produces brainwaves of different frequencies in different states. When we feel relaxed and calm, the brain produces lower-frequency fluctuations; when we are focused and concentrated, the brainwave frequency increases. The brainwave music generation system uses these frequency changes and maps them to specific notes and tones to create music that matches the individual's current brainwave state. In addition to frequency, EEG signals also contain other parameters such as amplitude and phase, which are closely related to the individual's brain activity state, mood, and sleep state. By comprehensively utilizing these different EEG parameters, the brainwave music generation system can improve the effect of brainwave music generation and more accurately serve the individual's brainwave state and changes in sleep, mood, and other states. In this way, the brainwave music generation system can create a more personalized and targeted music experience to meet the individual's needs for more music.
[0004] At present, the brainwave sleep-aiding music generation method mainly analyzes the frequency, amplitude, phase and other parameters of the subject's real-time electrophysiological brain signals, and maps them to the pitch, sound intensity and other indicators of the music. Then, brainwave sleep-aiding music is generated through filtering, multi-channel integration and other operations. However, this method has some shortcomings in terms of the artistry of music and the effectiveness of improving sleep quality. First, in terms of the artistry of music, the existing brainwave-generated music is usually based on statistical models or data-driven methods. This method can only perform pattern recognition and generation through a large amount of data. The beauty and artistry of music often exceed the scope that can be described by statistical models, and it is impossible to truly understand and show the connotation, emotion and depth of music. Secondly, in terms of the sleep-aiding effect, due to the instability of EEG signals, directly generating music by simply mapping and calculating the subject's real-time EEG through rules may cause unreasonable fluctuations in the volume and pitch of the music, which will have an adverse effect on the subject's sleep quality. At the same time, compared with professional sleep-aiding music that has been clinically verified by medicine (such as alpha brainwave music and dual-frequency music on the market), the medical professionalism and effectiveness of music generated by real-time brainwave direct mapping in improving sleep quality still needs to be further improved. Summary of the invention
[0005] In order to solve at least one of the technical problems existing in the prior art to a certain extent, the purpose of the present invention is to provide a method, device, equipment and medium for generating brain wave sleep-aiding music that can adjust the sleep state.
[0006] The first technical solution adopted by the present invention is:
[0007] A method for generating brainwave sleep-aiding music capable of adjusting sleep state comprises the following steps:
[0008] Acquire EEG signals, pre-process the EEG signals, and obtain sleep period samples;
[0009] Perform sleep stage analysis on sleep period samples to obtain sleep status;
[0010] Get corresponding professional sleep-aiding music from your personal brainwave sleep-aiding music library based on your sleep state;
[0011] Extract features from EEG signals and generate real-time brainwave music based on the extracted features;
[0012] Professional sleep-aiding music and real-time brainwave music are input into the music style transfer model to learn the mutual migration relationship between real-time brainwave music and professional sleep-aiding music, and generate brainwave sleep-aiding music targeting the current sleep state.
[0013] Furthermore, the step of obtaining the EEG signal, preprocessing the EEG signal, and obtaining the sleep period sample includes:
[0014] Obtain EEG signals, filter them, remove noise interference and eliminate motion artifacts;
[0015] The filtered EEG signal is sliced according to a preset method to generate a plurality of sleep period samples to be tested.
[0016] Furthermore, the step of performing sleep stage analysis on the sleep period sample to obtain the sleep state includes:
[0017] Use the pre-trained state assessment model to analyze the sleep stages of multiple sleep period samples to determine the current sleep state;
[0018] The state assessment model works as follows:
[0019] A deep convolutional neural network (CNN) is used to perform temporal dimension reduction on each sleep period sample and learn channel-independent temporal features.
[0020] Each EEG channel is regarded as a graph node, and the spatial topology of the brain is modeled through graph neural networks (GNNs) to achieve information transmission and convergence between multiple brain channels;
[0021] By learning the highly discriminative spatiotemporal features of real-time sleep EEG data, the accuracy of sleep staging can be improved, thereby more accurately determining the real-time sleep state of the subject.
[0022] Furthermore, extracting features from the EEG signal and generating real-time brainwave music according to the extracted features includes:
[0023] Acquire the characteristics of the EEG signal, including the frequency, amplitude, and phase of the EEG signal;
[0024] Mapping the acquired features to corresponding note attributes; note attributes include pitch, duration, and intensity;
[0025] Adjust the out-of-tune sound to the closest in-tune sound to ensure better harmony in the music;
[0026] If there are multiple channels of music stored, use music synthesis software to integrate them to form multi-channel stereo brainwave music. Use these music files as preliminary real-time brainwave music to participate in the subsequent brainwave sleep-aiding music generation process.
[0027] Furthermore, the music style transfer model is a music style transfer model based on CycleGAN;
[0028] CycleGAN consists of two GANs arranged in a cyclic manner and trained in unison. The GAN consists of a generator G and a discriminator D. The generator is used to generate real-looking data from noise, and the discriminator is used to distinguish the output of the generator from real data.
[0029] In the brainwave sleep-aiding music generation process, real-time brainwave music is domain A, and professional sleep-aiding music in the real-time sleep state of the subject in the personal sleep-aiding music library is domain B; the generator G of CycleGAN A->B Transfer music samples from domain A to domain B, generator G B->A Migrate music from domain B to domain A; each generator’s output is connected to a discriminator, namely discriminator D A and the discriminator D B ; The generator is used to generate music that can confuse the discriminator by learning the discriminative features that need to be transferred between domains, thereby achieving migration from the source music style to the target music style.
[0030] Furthermore, based on the CycleGAN model, two additional discriminators D A,m and the discriminator D B,m , used to further constrain the generator to learn better high-level features;
[0031] Generator G A->B and the generator G B->A It is a generator of two directions between real-time brainwave music and professional sleep-aiding music. A and D B It is the discriminator corresponding to the two generators, which is used to distinguish the authenticity between the generator music and the single source domain music style;
[0032] M A and M B It is from the personal sleep music library, which contains real-time brainwave music in different sleep states and professional sleep music, combined with M A and M B Training D A,m and the discriminator D B,m These two additional discriminators distinguish between generated music and real-time brainwave music or professional sleep-aiding music in different sleep states.
[0033] Furthermore, the brainwave sleep-aiding music generation method further includes the step of saving the brainwave sleep-aiding music:
[0034] According to the sleep state category, the generated brainwave sleep-aiding music is stored in the subject's personal brainwave sleep-aiding music library;
[0035] Among them, the newly generated brainwave sleep-aiding music is used to continuously enrich and update the brainwave sleep-aiding music library, and participate in subsequent algorithm research and model training, which is conducive to the subsequent generation of higher quality and effective sleep-aiding music.
[0036] The second technical solution adopted by the present invention is:
[0037] A brain wave sleep-aiding music generating device capable of adjusting sleep state, comprising:
[0038] The EEG sample acquisition module is used to acquire EEG signals, pre-process the EEG signals, and obtain sleep period samples;
[0039] A sleep state assessment module is used to analyze the sleep stages of sleep period samples and obtain the sleep state;
[0040] A professional music acquisition module is used to obtain corresponding professional sleep-aiding music from a personal brainwave sleep-aiding music library according to the obtained sleep state;
[0041] A brainwave music generation module is used to extract features from EEG signals and generate real-time brainwave music based on the extracted features;
[0042] The sleep-aiding music generation module is used to input professional sleep-aiding music and real-time brainwave music into the music style transfer model, learn the mutual migration relationship between real-time brainwave music and professional sleep-aiding music, and generate brainwave sleep-aiding music for the current sleep state.
[0043] The third technical solution adopted by the present invention is:
[0044] An electronic device comprises a processor and a memory, wherein the memory stores at least one instruction, at least one program, a code set or an instruction set, and the at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by the processor to implement a method for generating brainwave sleep-aiding music that can adjust the sleep state as described above.
[0045] The fourth technical solution adopted by the present invention is:
[0046] A computer-readable storage medium stores at least one instruction, at least one program, a code set or an instruction set, wherein the at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by a processor to implement a method for generating brainwave sleep-aiding music that can adjust the sleep state as described above.
[0047] The fifth technical solution adopted by the present invention is:
[0048] A computer program product or a computer program includes computer instructions stored in a computer-readable storage medium. A processor of a computer device can read the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the above method.
[0049] The beneficial effect of the present invention is that the present invention generates sleep-aiding brainwave music that regulates the real-time sleep state of the subject based on real-time brainwave music and professional sleep-aiding music. The generated brainwave sleep-aiding music is close to the real-time brainwave activity of the subject's sleep process, has a targeted regulating effect on the different sleep states of the subject, and has higher artistry and medical professionalism, and has important application value in the field of sleep health. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the embodiments of the present invention or the drawings of related technical solutions in the prior art are introduced below. It should be understood that the drawings introduced below are only for the convenience of clearly describing some embodiments of the technical solutions of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0051] Figure 1 is a flow chart of a method for generating brainwave sleep-aiding music in an embodiment of the present invention;
[0052] Figure 2 is a schematic diagram of a real-time brainwave music generation method in an embodiment of the present invention;
[0053] Figure 3 Schematic diagram of a brainwave sleep-aiding music generation model in an embodiment of the present invention;
[0054] Figure 4 This is a flowchart of the steps of a method for generating brainwave sleep-aiding music that can adjust the sleep state in an embodiment of the present invention. DETAILED DESCRIPTION
[0055] The embodiments of the present invention are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and are not to be construed as limitations of the present invention. For the step numbers in the following embodiments, they are only provided for the convenience of explanation, and the order between the steps is not limited in any way, and the execution order of each step in the embodiment can be adaptively adjusted according to the understanding of those skilled in the art.
[0056] In the description of the present invention, it should be understood that descriptions involving orientations, such as up, down, front, back, left, right, etc., and orientations or positional relationships indicated are based on the orientations or positional relationships shown in the accompanying drawings, and are only for the convenience of describing the present invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore should not be understood as a limitation on the present invention.
[0057] In the description of the present invention, "several" means one or more, "more" means more than two, "greater than", "less than", "exceed" etc. are understood as not including the number itself, and "above", "below", "within" etc. are understood as including the number itself. If there is a description of "first" or "second", it is only used for the purpose of distinguishing the technical features, and cannot be understood as indicating or implying the relative importance or implicitly indicating the number of the indicated technical features or implicitly indicating the order of the indicated technical features.
[0058] In the description of the present invention, unless otherwise clearly defined, terms such as setting, installing, connecting, etc. should be understood in a broad sense, and technicians in the relevant technical field can reasonably determine the specific meanings of the above terms in the present invention based on the specific content of the technical solution.
[0059] In response to the existing problems, the present invention proposes a method for generating brainwave sleep-aiding music with adjustable sleep state based on domain migration. Targeted professional sleep-aiding music is selected according to the real-time sleep state of the subject during sleep, and the real-time brainwave music mapped by EEG signals is combined to generate brainwave sleep-aiding music using a music style migration model. The brainwave sleep-aiding music generated by this method overcomes the defects of the lack of artistic authenticity of traditional brainwave music and the lack of theoretical support for the sleep-aiding effect to a certain extent. According to the different stages of the subject's sleep process, a more personalized and professional music sleep-aiding effect is provided, providing more scientific and high-quality support for their sleep health.
[0060] Example 1
[0061] like Figure 1 and Figure 4 As shown, this embodiment provides a method for generating brainwave sleep-aiding music that can adjust the sleep state, and the method specifically includes the following steps:
[0062] S1. Obtaining EEG signals, preprocessing the EEG signals, and obtaining sleep period samples.
[0063] As an implementation method, first, the obtained EEG signal is filtered to remove noise interference and motion artifacts. Next, filtering, amplification and other methods are used to improve the quality of the EEG signal. Finally, according to the international sleep staging standard AASM, the processed EEG data is sliced in 30s time units to generate multiple sleep period samples to be tested. These preprocessing steps can effectively improve the quality of EEG signal data and provide a reliable basis for subsequent signal analysis and brainwave music generation.
[0064] S2. Perform sleep stage analysis on the sleep period samples to obtain the sleep status.
[0065] Exemplarily, in the sleep state determination, an algorithm model is used to perform sleep stage analysis on a plurality of real-time sleep period samples generated after preprocessing to determine the user's current sleep state.
[0066] S3. Obtain corresponding professional sleep-aiding music from a personal brainwave sleep-aiding music library according to the obtained sleep state.
[0067] Select professional sleep-aiding music corresponding to the sleep state from the personal brainwave sleep-aiding music library. Specifically, according to the real-time sleep state determination result of the subject (obtained from step S2), search for professional sleep-aiding music matching the sleep state category in the personal sleep-aiding music library, and participate in the brainwave sleep-aiding music generation in step S5.
[0068] S4. Extract features from the EEG signal and generate real-time brainwave music based on the extracted features.
[0069] In some embodiments, different features extracted from the EEG signal are mapped to corresponding music parameters through mapping rules or algorithms. Using these mapped music parameters, we can use computer software to perform music synthesis and create music works related to the real-time EEG activity of the subject during sleep, which participates in the generation of brainwave sleep-aiding music in step S5.
[0070] S5. Input professional sleep-aiding music and real-time brainwave music into the music style transfer model, learn the mutual transfer relationship between real-time brainwave music and professional sleep-aiding music, and generate brainwave sleep-aiding music for the current sleep state.
[0071] The professional sleep-aiding music selected in step S3 and the real-time brainwave music obtained in step S4 are input into the music style transfer model based on CycleGAN to learn the mutual transfer relationship between real-time brainwave music and professional sleep-aiding music, and generate effective sleep-aiding music for the subject's current sleep state.
[0072] S6. According to the sleep state category, the generated brainwave sleep-aiding music is stored in the subject's personal brainwave sleep-aiding music library.
[0073] Save brainwave sleep music. According to the sleep state category, the brainwave sleep music generated through the above steps is stored in the subject's personal brainwave sleep music library. The newly generated brainwave sleep music can continuously enrich and update the brainwave sleep music library, and participate in subsequent algorithm research and model training, which is conducive to the subsequent generation of higher quality and more effective sleep music.
[0074] In general, the method of this embodiment mainly involves three major modules, namely, selecting professional sleep-aiding music according to the real-time sleep state, generating real-time brainwave music, and generating brainwave sleep-aiding music. This embodiment uses an algorithm model to stage the EEG data of multiple sleep periods, evaluates the sleep state of the subject according to the distribution of the subject's real-time sleep stage, and selects professional sleep-aiding music from the corresponding sleep state category of the personal sleep-aiding music library. At the same time, the method of this embodiment maps the subject's real-time brainwave signal into music according to certain mapping rules and algorithms. The professional sleep-aiding music and real-time brainwave music for the subject's real-time sleep state are jointly input into the music style transfer model based on CycleGAN. The generator in the model is further constrained by two additional discriminators, and finally generates brainwave sleep-aiding music that is superior in professionalism, medical interpretability, and artistic authenticity.
[0075] The following is a supplementary description of each module in the above method in combination with the accompanying drawings and specific implementation methods.
[0076] (1) Sleep status assessment
[0077] Learn channel-independent temporal features. Subsequently, each EEG channel is regarded as a graph node, and the spatial topology of the brain is modeled through graph neural networks (GNNs) to achieve information transmission and convergence between multiple brain channels. By learning the highly discriminative spatiotemporal features of real-time sleep EEG data, the accuracy of sleep staging is improved, so that the real-time sleep state of the subject can be determined more accurately. Through the distribution of the subject's sleep stages, such as observing whether the subject wakes up multiple times during sleep, and whether it is difficult to enter N3 and N4 stages to reach deep sleep, the subject's real-time sleep quality can be evaluated to determine his current sleep state.
[0078] It should be noted that the above sleep state assessment uses a combination of deep CNN networks and graph neural networks GNN to learn spatiotemporal features and obtain sleep staging results. Transformer-based time series models or other spatiotemporal graph convolutional networks can also be used for sleep staging. In addition, other physiological behaviors of the subject during sleep, such as the frequency of snoring, can be considered in the sleep state assessment. These physiological behaviors can be used as auxiliary indicators to help more accurately assess the sleep state. By comprehensively considering these factors, we can have a more comprehensive understanding of the subject's sleep situation, thereby improving the accuracy and reliability of sleep state assessment and generating brainwave sleep-aiding music that has a higher promoting effect on sleep health.
[0079] (2) Real-time brainwave music generation
[0080] See also Figure 2 In the process of generating real-time brainwave music, the statistical features of the subject's real-time brainwave signal will be extracted through mathematical algorithms. These features can include various parameters such as frequency, amplitude, phase, etc. of the brainwave signal. Based on these features, the system will automatically map out the corresponding note attributes, such as pitch, length, intensity, etc. At the same time, modulation filtering will also be used to adjust the out-of-tune sound to the closest in-tune sound to ensure that the music is more harmonious. If there are multiple channels of music, the system will use music synthesis software to integrate them to form multi-channel stereo brainwave music. These music files will serve as preliminary brainwave music and participate in the subsequent brainwave sleep-aiding music generation process. Generating music based on the user's real-time brainwave signal is closer to the subject's brainwave activity, thereby achieving better relaxation and sleep-aiding effects.
[0081] (3) Brainwave sleep-aiding music generation
[0082] See also Figure 3 The music style transfer model used in the brainwave sleep music generation link is based on CycleGAN. CycleGAN consists of two GANs arranged in a cyclic manner and trained in unison. GAN consists of a generator G and a discriminator D. The generator tries to generate real-looking data from noise, while the discriminator tries to distinguish the output of the generator from real data. The generator G and the discriminator D are iteratively trained in a two-person minimax game. The input of the generator is a real sample from the source domain.
[0083] In the brainwave sleep-aiding music generation process, real-time brainwave music is domain A, and professional sleep-aiding music in the real-time sleep state of the subject under the personal sleep-aiding music library is domain B. A->B Transfer music samples from domain A to domain B, generator G B->A Transfer music from domain B to domain A. Each generator output is connected to a discriminator to discriminate D AFor example, D A Used to distinguish the generator G B->A Generative music vs real-time brainwave music.
[0084] CycleGAN uses the generator to generate music that can confuse the discriminator through the discriminative features that need to be transferred between learning domains, thereby achieving the migration from the source music style to the target music style. However, there are some unique but low-discriminative features in both real-time brainwave music and professional sleep-aiding music, and the generator can simply construct these features to try to deceive the discriminator, and ultimately generate music with low realism and poor sleep-aiding effect. To address this limitation of CycleGAN, this embodiment adds two additional discriminators D on the basis of the CycleGAN model. A,m With D B,m , which is used to further constrain the generator to learn better advanced features. Finally, the music generated by the model has a more professional sleep-aiding effect while maintaining the basic structure of brainwave music, and the music has higher artistry and authenticity.
[0085] Figure 3 The architecture of the music style transfer model used in the brainwave sleep music segment is shown. The blue arrows represent the music style transfer from real-time brainwave music to professional sleep music, and the red arrows represent the music style transfer from professional sleep music to real-time brainwave music. A->B and G B->A It is a generator of two directions between real-time brainwave music and professional sleep-aiding music. A and D B The discriminators corresponding to these two generators are used to distinguish the authenticity between the generator music and the single source domain music style. A and M B It is a personal sleep music library that contains real-time brainwave music in different sleep states and professional sleep music. A,m and D B,m These two additional discriminators distinguish generated music from real-time brainwave music or professional sleep-aiding music in different sleep states. A and D B In contrast, they distinguish generated music from music from multiple domains, not just music from a single target domain. The additional discriminator forces the generator to learn higher-level discriminative features related to the domain, constraining the generated music to be closer to real music. A->B and G B->A and the discriminator D A and D B The loss function used is consistent with that of CycleGAN, with an additional discriminator D A,m and D B,mThe loss function used is consistent with the discriminator in GAN.
[0086] It should be noted that the above brainwave sleep music generation uses a music style transfer model based on CycleGAN to learn the mapping relationship between real-time brainwave music and professional sleep music, and finally generate more professional brainwave sleep music. You can also use music generation models based on MusicVAE to achieve the migration task between real-time brainwave music and professional sleep music.
[0087] In summary, the method of the present invention has at least the following advantages and beneficial effects compared to the prior art:
[0088] (1) The brainwave sleep-aiding music generation method of the present invention combines real-time brainwave music of the sleep process and professional sleep-aiding music for specific sleep states, and uses the music style transfer model based on CycleGAN to generate brainwave sleep-aiding music with more professional sleep-aiding effect and stronger artistry.
[0089] Advantages: The music generated by direct mapping of real-time brain waves can reflect the brain wave activity of the subject during sleep. However, due to the instability and high noise of EEG signals, the real-time brain wave music still lacks the professionalism and medical explainability of the sleep-aiding effect compared to clinically verified sleep-aiding music. At the same time, music mapped by EEG signals under simple rules often lacks artistic beauty and musicality. The present invention combines real-time brain wave music with professional sleep-aiding music for specific sleep states to generate brain wave music with higher professionalism, better sleep-aiding effect and better artistic effect. High-quality brain wave sleep-aiding music is used to intervene in the brain activity of the subject during sleep, thereby improving the subject's sleep quality.
[0090] (2) The present invention proposes a brainwave sleep-aiding music generation model. Based on the music style transfer model CycleGAN, two additional multi-source domain music discriminators are added to further constrain the generator to learn and implement the domain discriminative features of brainwave music and professional-level sleep-aiding music, while promoting the authenticity of the music and improving the quality of brainwave sleep-aiding music.
[0091] Advantages: There are some unique but low-discriminative patterns in both real-time brainwave music and professional sleep-aiding music. By focusing on constructing these patterns, the generator can also confuse the discriminator to complete the training, but ultimately generates unrealistic, low-quality sleep-aiding music. Based on CycleGAN, this patent adds two additional discriminators, which are used to distinguish the generated music from brainwave music and professional sleep-aiding music in different sleep states. By introducing data from more domains, the direction of generated music is further standardized, generating brainwave sleep-aiding music that sounds more realistic, and providing subjects with better sleep quality regulation services.
[0092] Example 2
[0093] This embodiment provides a device for generating brainwave sleep-aiding music capable of adjusting sleep state, comprising:
[0094] The EEG sample acquisition module is used to acquire EEG signals, pre-process the EEG signals, and obtain sleep period samples;
[0095] A sleep state assessment module is used to analyze the sleep stages of sleep period samples and obtain the sleep state;
[0096] A professional music acquisition module is used to obtain corresponding professional sleep-aiding music from a personal brainwave sleep-aiding music library according to the obtained sleep state;
[0097] A brainwave music generation module is used to extract features from EEG signals and generate real-time brainwave music based on the extracted features;
[0098] The sleep-aiding music generation module is used to input professional sleep-aiding music and real-time brainwave music into the music style transfer model, learn the mutual migration relationship between real-time brainwave music and professional sleep-aiding music, and generate brainwave sleep-aiding music for the current sleep state.
[0099] Since the device is a brainwave sleep-aiding music generating device capable of adjusting the sleep state according to an embodiment of the present invention, and the principle of solving the problem by the device is similar to that of the method, the implementation of the device can refer to the implementation process of the above-mentioned method embodiment, and the repeated parts will not be repeated.
[0100] Example 3
[0101] An embodiment of the present invention further provides an electronic device, the electronic device comprising a processor and a memory, the memory storing at least one instruction, at least one program, a code set or an instruction set, the at least one instruction, the at least one program, the code set or the instruction set being loaded and executed by the processor to implement the following Figure 1 and Figure 4 A method for generating brainwave sleep-aiding music that can adjust sleep state is shown.
[0102] It is understood that the memory may include a random access memory (RAM) or a read-only memory (ROM). Optionally, the memory includes a non-transitory computer-readable storage medium. The memory may be used to store instructions, programs, codes, code sets, or instruction sets. The memory may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for at least one function, instructions for implementing the above-mentioned various method embodiments, etc.; the data storage area may store data created according to the use of the server, etc.
[0103] The processor may include one or more processing cores. The processor uses various interfaces and lines to connect the various parts of the entire server, and executes various functions of the server and processes data by running or executing instructions, programs, code sets or instruction sets stored in the memory, and calling data stored in the memory. Optionally, the processor can be implemented in at least one hardware form of digital signal processing (DSP), field programmable gate array (FPGA), and programmable logic array (PLA). The processor can integrate one or a combination of a central processing unit (CPU) and a modem. Among them, the CPU mainly processes the operating system and application programs; the modem is used to process wireless communications. It can be understood that the above-mentioned modem may not be integrated into the processor, but implemented separately through a chip.
[0104] Since the electronic device is an electronic device corresponding to the method for generating brainwave sleep-aiding music that can adjust the sleep state in an embodiment of the present invention, and the principle of solving the problem by the electronic device is similar to that of the method, the implementation of the electronic device can refer to the implementation process of the above-mentioned method embodiment, and the repeated parts will not be repeated.
[0105] Example 4
[0106] The embodiment of the present invention further provides a computer-readable storage medium, wherein the storage medium stores at least one instruction, at least one program, code set or instruction set, and the at least one instruction, the at least one program, the code set or instruction set is loaded and executed by a processor to implement the following Figure 1 and Figure 4 A method for generating brainwave sleep-aiding music that can adjust sleep state is shown.
[0107] Those skilled in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing related hardware through a program, and the program can be stored in a computer-readable storage medium, and the storage medium includes a read-only memory (ROM), a random access memory (RAM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), a one-time programmable read-only memory (OTPROM), an electronically erasable rewritable read-only memory (EEPROM), a compact disc (CD-ROM) or other optical disc storage, magnetic disk storage, magnetic tape storage, or any other computer-readable medium that can be used to carry or store data.
[0108] Since the storage medium is the storage medium corresponding to the method for generating brainwave sleep-aiding music that can adjust the sleep state in an embodiment of the present invention, and the principle of solving the problem by the storage medium is similar to that of the method, the implementation of the storage medium can refer to the implementation process of the above-mentioned method embodiment, and the repeated parts will not be repeated.
[0109] Example 5
[0110] In some possible implementations, various aspects of the method of the embodiment of the present invention may also be implemented in the form of a program product, which includes a program code. When the program product is run on a computer device, the program code is used to cause the computer device to execute the steps of the method for generating brainwave sleep-aiding music that can adjust the sleep state according to various exemplary embodiments of the present application described above in this specification. Among them, the executable computer program code or "code" for executing each embodiment can be written in a high-level programming language such as C, C++, C#, Smalltalk, Java, JavaScript, Visual Basic, structured query language (e.g., Transact-SQL), Perl, or in various other programming languages.
[0111] It should be understood that the various parts of the present invention can be implemented by hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, a plurality of steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.
[0112] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples, without contradiction.
[0113] The above embodiments are only for illustrating the technical concept and features of the present invention, and their purpose is to enable ordinary technicians in the field to understand the content of the present invention and implement it accordingly, and they cannot be used to limit the protection scope of the present invention. Any equivalent changes or modifications made based on the essence of the content of the present invention should be included in the protection scope of the present invention.
Claims
1. A method for generating brainwave sleep-aiding music capable of adjusting sleep state, characterized in that: The following steps are involved: Acquire EEG signals, pre-process the EEG signals, and obtain sleep period samples; Perform sleep stage analysis on sleep period samples to obtain sleep status; Get corresponding professional sleep-aiding music from your personal brainwave sleep-aiding music library based on your sleep state; Extract features from EEG signals and generate real-time brainwave music based on the extracted features; Professional sleep-aiding music and real-time brainwave music are input into the music style transfer model to learn the mutual migration relationship between real-time brainwave music and professional sleep-aiding music, and generate brainwave sleep-aiding music targeting the current sleep state.
2. The method for generating brainwave sleep-aiding music capable of adjusting sleep state according to claim 1, characterized in that: The step of obtaining the EEG signal, preprocessing the EEG signal, and obtaining the sleep period sample includes: Obtain EEG signals, filter them, remove noise interference and eliminate motion artifacts; The filtered EEG signal is sliced according to a preset method to generate a plurality of sleep period samples to be tested.
3. The method for generating brainwave sleep-aiding music capable of adjusting sleep state according to claim 1, characterized in that: The step of performing sleep stage analysis on the sleep period sample to obtain the sleep state includes: Use the pre-trained state assessment model to analyze the sleep stages of multiple sleep period samples to determine the current sleep state; The state assessment model works as follows: A deep convolutional neural network is used to perform time-series dimensionality reduction on samples of each sleep period and learn channel-independent time-series features. Each EEG channel is regarded as a graph node, and the spatial topology of the brain is modeled through a graph neural network to achieve information transmission and convergence between multiple brain channels. By learning the highly discriminative spatiotemporal features of real-time sleep EEG data, the accuracy of sleep staging can be improved, thereby more accurately determining the real-time sleep state of the subject.
4. The method for generating brainwave sleep-aiding music capable of adjusting sleep state according to claim 1, characterized in that: The method of extracting features from the EEG signal and generating real-time brainwave music according to the extracted features includes: Acquire the characteristics of the EEG signal, including the frequency, amplitude, and phase of the EEG signal; Mapping the acquired features to corresponding note attributes; note attributes include pitch, duration, and intensity; If there are multiple channels of music stored, use music synthesis software to integrate them to form multi-channel stereo brainwave music. Use these music files as preliminary real-time brainwave music to participate in the subsequent brainwave sleep-aiding music generation process.
5. The method for generating brainwave sleep-aiding music capable of adjusting sleep state according to claim 1, characterized in that: The music style transfer model is a music style transfer model based on CycleGAN; CycleGAN consists of two GANs arranged in a cyclic manner and trained in unison. The GAN consists of a generator G and a discriminator D. In the brainwave sleep-aiding music generation process, real-time brainwave music is domain A, and professional sleep-aiding music in the real-time sleep state of the subject in the personal sleep-aiding music library is domain B; the generator G of CycleGAN A->B Transfer music samples from domain A to domain B, generator G B->A Migrate music from domain B to domain A; each generator’s output is connected to a discriminator, namely discriminator D A and the discriminator D B ; The generator is used to generate music that can confuse the discriminator by learning the discriminative features that need to be transferred between domains, thereby achieving migration from the source music style to the target music style.
6. The method for generating brainwave sleep-aiding music capable of adjusting sleep state according to claim 5, characterized in that: Based on the CycleGAN model, two additional discriminators D are added A,m and the discriminator D B,m , used to further constrain the generator to learn better high-level features; Generator G A->B and the generator G B->A It is a generator of two directions between real-time brainwave music and professional sleep-aiding music. A and D B It is the discriminator corresponding to the two generators, which is used to distinguish the authenticity between the generator music and the single source domain music style; M A and M B It is from the personal sleep music library, which contains real-time brainwave music in different sleep states and professional sleep music, combined with M A and M B Training D A,m and the discriminator D B,m These two additional discriminators distinguish between generated music and real-time brainwave music or professional sleep-aiding music in different sleep states.
7. The method for generating brainwave sleep-aiding music capable of adjusting sleep state according to claim 1, characterized in that: The method for generating brainwave sleep-aiding music also includes the step of saving the brainwave sleep-aiding music: According to the sleep state category, the generated brainwave sleep-aiding music is stored in the subject's personal brainwave sleep-aiding music library; Among them, the newly generated brainwave sleep-aiding music is used to continuously enrich and update the brainwave sleep-aiding music library, and participate in subsequent algorithm research and model training.
8. A device for generating brainwave sleep-aiding music capable of adjusting sleep state, characterized in that: include: The EEG sample acquisition module is used to acquire EEG signals, pre-process the EEG signals, and obtain sleep period samples; A sleep state assessment module is used to analyze the sleep stages of sleep period samples and obtain the sleep state; A professional music acquisition module is used to obtain corresponding professional sleep-aiding music from a personal brainwave sleep-aiding music library according to the obtained sleep state; The brainwave music generation module is used to extract features from EEG signals and generate real-time brainwave music based on the extracted features. The sleep-aiding music generation module is used to input professional sleep-aiding music and real-time brainwave music into the music style transfer model, learn the mutual migration relationship between real-time brainwave music and professional sleep-aiding music, and generate brainwave sleep-aiding music for the current sleep state.
9. An electronic device, characterized in that: The electronic device includes a processor and a memory, wherein the memory stores at least one instruction, at least one program, a code set or an instruction set, and the at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by the processor to implement the method described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The storage medium stores at least one instruction, at least one program, a code set or an instruction set, and the at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by the processor to implement the method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Sleep music playing method and device based on electroencephalogram signals and terminal
CN113995939A
Matching-based brainwave music generation method and device, medium and computer equipment
CN118593861A
Alpha brainwave music generation method, product, medium and equipment
CN119015567A
Method and electronic device for providing sleep-inducing music according to user state determined on basis of biosignal
WO2024228511A1
KR20240161571A
Cited By
Music assisted sleep method and device, electronic equipment and computer readable medium
CN121846461A