Music generation method, device and equipment based on electroencephalogram signals and storage medium
By performing multi-dimensional feature extraction and music feature mapping of EEG signals, note and chord sequences are constructed, and chord process construction is carried out in combination with tone, the problem that traditional methods cannot accurately reflect individual emotional fluctuations is solved, and high-quality personalized music generation is achieved.
Patent Information
- Application Number
- CN202411819393.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-11
- Publication Date
- 2025-03-28
- Estimated Expiration
- 2044-12-11
AI Technical Summary
The traditional brain wave music generation method ignores the differences in individual EEG signals, resulting in the generated music being unable to accurately reflect individual emotional fluctuations, making it difficult to achieve high-quality personalized music generation.
By performing multi-dimensional feature extraction and music feature mapping of the EEG signal to be tested, note sequences and chord sequences are constructed, chord process construction and note mapping are constructed based on the tone of the EEG signal, and the target note sequence is finally generated for music generation.
The accuracy and quality of music generation is improved, so that the generated music can better reflect individual emotional fluctuations, and the high-quality generation of personalized music is achieved.
Smart Images

Figure CN119701158A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of signal processing technology, and in particular to a music generation method, device, equipment and storage medium based on electroencephalogram signals. Background Art
[0002] Brainwave music synthesis technology is a technology that converts brainwave signals (EEG) into music. The development of this technology has gone through many stages, from the initial attempt to make brainwaves "sound", to using brainwave signals as materials for music creation, to using music made from brainwave signals for biofeedback, and in recent years, research has found that "brain music" made from the patient's own brainwaves has a strong hypnotic effect.
[0003] Research on EEG has shown that the parameters of EEG, such as amplitude, phase and frequency, are scale-free, and the power spectrum of EEG is also scale-free. According to this method, the period of EEG corresponds to the length of the sound in music, the amplitude of EEG corresponds to the pitch in music, and the average energy change in EEG corresponds to the intensity of the sound in music. Through the above rules, EEG can be directly converted into music in real time.
[0004] However, most traditional brainwave music generation methods use simple frequency mapping, ignoring the differences in individual EEG signals. The generated music cannot accurately reflect the individual's emotional fluctuations, making it difficult to achieve accurate and high-quality generation of personalized music. Summary of the invention
[0005] Based on this, the purpose of the present invention is to provide a music generation method, device, equipment and storage medium based on EEG signals. By performing multi-dimensional feature extraction and music feature mapping on the EEG signals of the user to be tested, the characteristic information related to music generation in the EEG signals is fully considered to generate music, thereby improving the accuracy and quality of music generation.
[0006] In a first aspect, an embodiment of the present application provides a method for generating music based on EEG signals, comprising the following steps:
[0007] Obtaining electroencephalogram signals of several channels of the user to be tested, dividing the electroencephalogram signals into electroencephalogram event signals, and obtaining several electroencephalogram event signals of several channels;
[0008] Performing music feature extraction on a plurality of the EEG event signals of a plurality of channels to obtain music feature extraction data of the plurality of the EEG event signals of a plurality of channels, wherein the music feature extraction data includes a plurality of types of music features;
[0009] Performing note construction according to the music feature extraction data to obtain note sequences of several channels, wherein the note sequences include notes of several of the electroencephalogram event signals;
[0010] Obtaining the tonality of the EEG signals of several channels, constructing a chord progression and performing note mapping according to the tonality, and obtaining chord sequences of several channels, wherein the chord sequence includes several notes corresponding to the chord progression;
[0011] The note sequence of the same channel and the notes in the chord sequence are combined to obtain target note sequences of several channels, and music generation is performed according to the target note sequences of several channels to obtain music generation results.
[0012] In a second aspect, an embodiment of the present application provides a music generation device based on EEG signals, comprising:
[0013] A signal acquisition module is used to obtain EEG signals of several channels of the user to be tested, divide the EEG signals into EEG event signals, and obtain several EEG event signals of several channels;
[0014] A feature extraction module, used for performing music feature extraction on a plurality of the EEG event signals of a plurality of channels, and obtaining music feature extraction data of the plurality of the EEG event signals of a plurality of channels, wherein the music feature extraction data includes a plurality of types of music features;
[0015] A first note construction module, used to construct notes according to the music feature extraction data to obtain note sequences of several channels;
[0016] A second note construction module is used to obtain the tonality of the EEG signals of several channels, and to construct a chord progression and perform note mapping according to the tonality to obtain a chord sequence of several channels, wherein the chord sequence includes several notes corresponding to the chord progression;
[0017] The music generation module is used to combine the note sequence of the same channel and the notes in the chord sequence to obtain target note sequences of several channels, and to generate music according to the target note sequences of several channels to obtain music generation results.
[0018] In a third aspect, an embodiment of the present application provides a computer device, comprising a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the steps of the method for generating music based on EEG signals as described in the first aspect are implemented.
[0019] In a fourth aspect, an embodiment of the present application provides a storage medium storing a computer program, which, when executed by a processor, implements the steps of the method for generating music based on EEG signals as described in the first aspect.
[0020] In an embodiment of the present application, a music generation method, apparatus, device and storage medium based on EEG signals are provided. By performing multi-dimensional feature extraction and music feature mapping on the EEG signals of the user to be tested, feature information associated with music generation in the EEG signals is fully considered for music generation, thereby improving the accuracy and quality of music generation.
[0021] For better understanding and implementation, the present invention is described in detail below with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] Figure 1 A schematic diagram of a process for generating music based on EEG signals according to the first embodiment of the present application;
[0023] Figure 2 A schematic diagram of the process of S2 in the method for generating music based on EEG signals provided in the first embodiment of the present application;
[0024] Figure 3 This is a flowchart of S4 in the method for generating music based on EEG signals provided in the first embodiment of the present application;
[0025] Figure 4 This is a flowchart of S4 in the method for generating music based on EEG signals provided in the first embodiment of the present application;
[0026] Figure 5 A schematic diagram of the process of step S3 in the method for generating music based on EEG signals provided in the second embodiment of the present application;
[0027] Figure 6 A schematic diagram of the process of S3 in the method for generating music based on EEG signals provided in the third embodiment of the present application;
[0028] Figure 7 A schematic diagram of the structure of a music generating device based on EEG signals provided in the fourth embodiment of the present application;
[0029] Figure 8 A schematic diagram of the structure of a computer device provided in the fifth embodiment of the present application. DETAILED DESCRIPTION
[0030] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.
[0031] The terms used in this application are for the purpose of describing specific embodiments only and are not intended to limit this application. The singular forms of "a", "said" and "the" used in this application and the appended claims are also intended to include plural forms unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used herein refers to and includes any or all possible combinations of one or more associated listed items.
[0032] It should be understood that, although the terms first, second, third, etc. may be used in the present application to describe various information, these information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of the present application, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the words "if" / "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determination".
[0033] See also Figure 1 , Figure 1 The flowchart of the method for generating music based on EEG signals provided in the first embodiment of the present application comprises the following steps:
[0034] S1: obtaining EEG signals of several channels of the user to be tested, dividing the EEG signals into EEG event signals, and obtaining several EEG event signals of several channels.
[0035] The executor of the music generation method based on EEG signals is a music generation device of the music generation method based on EEG signals (hereinafter referred to as the music generation device). In an optional embodiment, the music generation device can be a computer device, a server, or a server cluster composed of multiple computer devices.
[0036] In this embodiment, the music generating device may use an electroencephalogram (EEG) interface device to collect original signals from the user to be tested, and convert the original signals into digital signals to obtain EEG signals of several channels.
[0037] In an optional embodiment, the music generating device uses a 0.5-75 Hz bandpass frequency filter to filter the EEG signal to remove interference from non-target frequencies and ensure the correlation between the data and brain waves.
[0038] In addition, to improve processing efficiency, the music generation device down-converts the filtered EEG signals, and uses wavelet denoising technology to eliminate noise through multi-scale analysis, and converts the down-converted EEG signals into new unrelated variables through independent component analysis (ICA), effectively separating the source signal and the noise source, further eliminating interference such as eye movements and electromyography, and improving the purity of EEG signals, thereby improving the quality of EEG signals.
[0039] The music generating device divides the electroencephalogram signal into electroencephalogram event signals to obtain a plurality of electroencephalogram event signals of a plurality of channels.
[0040] S2: extracting music features from a plurality of the electroencephalogram event signals of a plurality of channels, and obtaining music feature extraction data from a plurality of the electroencephalogram event signals of a plurality of channels.
[0041] In order to capture its multi-dimensional characteristics and fully extract the music-related feature information in the EEG signal, in this embodiment, the music generating device performs music feature extraction on several EEG event signals of several channels to obtain music feature extraction data of several EEG event signals of several channels, wherein the music feature extraction data includes several types of music features.
[0042] See also Figure 2 , Figure 2 The flowchart of S2 in the method for generating music based on EEG signals provided in the first embodiment of the present application includes steps S21 to S22, which are as follows:
[0043] S21: performing EEG feature extraction on a plurality of the EEG event signals of a plurality of channels to obtain EEG feature extraction data of a plurality of the EEG event signals of a plurality of channels.
[0044] In this embodiment, the music generating device performs EEG feature extraction on several EEG event signals of several channels to obtain EEG feature extraction data of several EEG event signals of several channels, wherein the EEG feature extraction data includes several types of EEG features; the EEG features include amplitude, period and average power.
[0045] Specifically, the amplitude is directly mapped to the pitch of the note, and the music generating device calculates the difference between the maximum and minimum values of several of the EEG event signals as the amplitude. The music generating device is determined by calculating the zero-crossing points of several of the EEG event signals. The zero-crossing point is the moment when the signal changes from a negative value to a positive value or from a positive value to a negative value, and is usually used to define the beginning and end of a cycle. The music generating device calculates the values of several preset sampling points of several of the EEG event signals, performs cumulative averaging processing, and obtains the average power of several of the EEG event signals.
[0046] S22: Perform music feature mapping according to the amplitude, period and average power in the EEG feature extraction data to obtain music feature extraction data of several EEG event signals of several channels.
[0047] In this embodiment, the music generating device performs music feature mapping according to the amplitude, period and average power in the EEG feature extraction data to obtain music feature extraction data of several EEG event signals of several channels, wherein the music feature extraction data includes several types of music features; the music features include sound length, pitch and sound intensity.
[0048] Specifically, the music generating device determines according to the frequency characteristics, based on the period of several EEG event signals, respectively divided by the preset signal sampling frequency, to obtain the sound length of several EEG event signals. Based on the amplitude of several EEG event signals, the music generating device maps the amplitude to the pitch through a logarithmic relationship to obtain the pitch of several EEG event signals. Based on the average power of several EEG event signals, the music generating device obtains the sound intensity of several EEG event signals according to a preset sound intensity calculation algorithm, wherein the sound intensity calculation algorithm is:
[0049] Dynamics(t)=k·log(P(t))+l
[0050] Where Dynamics(t) is the sound intensity of the t-th EEG event signal, k is the first constant used to control the mapping ratio of power to sound intensity, P(t) is the average power of the t-th EEG event signal, and l is the second constant used to adjust the offset of the sound intensity.
[0051] S3: constructing notes according to the music feature extraction data to obtain note sequences of several channels.
[0052] In this embodiment, the music generating device constructs notes according to the music feature extraction data to obtain note sequences of several channels, wherein the note sequences include several notes of the electroencephalogram event signals.
[0053] S4: Obtaining the tonality of the EEG signals of several channels, constructing a chord progression and performing note mapping according to the tonality, and obtaining chord sequences of several channels.
[0054] In this embodiment, the music generating device obtains the tonality of the EEG signals of several channels, constructs a chord progression and performs note mapping according to the tonality, and obtains a chord sequence of several channels, wherein the chord sequence includes several notes corresponding to the chord progression.
[0055] See also Figure 3 , Figure 3 The flowchart of S4 in the method for generating music based on EEG signals provided in the first embodiment of the present application includes steps S41 to S42, which are as follows:
[0056] S41: Perform power spectrum analysis on the EEG signals of the plurality of channels to obtain power spectrum data of the EEG signals of the plurality of channels.
[0057] In this embodiment, the music generating device performs power spectrum analysis on the EEG signals of several channels to obtain power spectrum data of the EEG signals of several channels, which is used to determine the tonality of the EEG signals of the current channel, wherein the power spectrum data includes peak power spectrum values of the α frequency band and the β frequency band.
[0058] S42: Divide the peak power spectrum values of the α frequency band and the β frequency band in the power spectrum data of the EEG signal of the same channel to obtain the peak power spectrum ratio of the EEG signals of several channels, and obtain the tonality of the EEG signals of several channels according to the peak power spectrum ratio and a preset peak power spectrum ratio threshold.
[0059] The tonality includes major and minor. In music, major keys usually correspond to positive and bright emotions, while minor keys express negative and melancholic emotions. Therefore, at that time, major keys mean more high-frequency activities and a person's state of arousal is high, while minor keys are the opposite.
[0060] In this embodiment, the music generating device divides the peak power spectrum values of the α-band and the β-band in the power spectrum data of the EEG signal of the same channel to obtain the peak power spectrum ratio of the EEG signals of several channels.
[0061] The music generating device obtains the tonality of the EEG signals of several channels according to the peak power spectrum ratio and a preset peak power spectrum ratio threshold. Specifically, the peak power spectrum ratio threshold is set to 1.5. If the peak power spectrum ratio is greater than the peak power spectrum ratio threshold, the music generating device determines that the tonality of the EEG signal is major. If the peak power spectrum ratio is greater than or equal to the peak power spectrum ratio threshold, the music generating device determines that the tonality of the EEG signal is minor.
[0062] See also Figure 4 , Figure 4 The flowchart of S4 in the method for generating music based on EEG signals provided in the first embodiment of the present application includes steps S43 to S44, which are as follows:
[0063] S43: Obtaining the chord progression of the EEG signals of several channels according to the tonality and several preset mapping relationships between tonality and chord progression.
[0064] The chord progression includes the I-IV-VI chord progression, where I, IV, and V are the tonic, subdominant, and dominant chords, respectively. These chord progressions are used to guide the harmonic development of music and enhance the harmony and emotional expression of music.
[0065] In this embodiment, the music generating device obtains the chord progression of the EEG signals of several channels according to the tonality and several preset mapping relationships between tonality and chord progression.
[0066] S44: According to the chord progression of the EEG signals of the channels and the preset mapping relationship between the chord progression and the note set, a note set of the chord progression of the channels is obtained, and a chord sequence of the EEG signals of the channels is constructed.
[0067] In this embodiment, the music generation device obtains the note set of the chord progression of the EEG signals of the channels and the preset mapping relationship between the chord progression and the note set, and constructs the chord sequence of the EEG signals of the channels. It not only ensures the emotional expression of the notes, but also dynamically adjusts the chord structure under different EEG states, so that the music generation not only reflects the EEG characteristics, but also has rich chord changes, which enhances the harmony effect and emotional expression of the music.
[0068] S5: combining the note sequence of the same channel and the notes in the chord sequence to obtain target note sequences of several channels, and performing music generation according to the target note sequences of the several channels to obtain music generation results.
[0069] In this embodiment, the music generation device combines the note sequence and the notes in the chord sequence of the same channel to obtain target note sequences of several channels, and generates music according to the target note sequences of several channels to obtain music generation results. It is possible to extract meaningful features from data of different channels and adjust music elements according to different EEG features. Through complex mathematical mapping and chord processing, efficient analysis and artistic expression of multi-dimensional EEG data are achieved, improving the accuracy and quality of music generation.
[0070] The power spectrum data also includes the peak frequencies of the α band and the β band. Figure 5 , Figure 5 The flowchart of S3 in the method for generating music based on EEG signals provided in the second embodiment of the present application also includes steps S31 to S32, which are as follows:
[0071] S31: Based on the peak frequencies and peak power spectrum values of the α-band and the β-band in the power spectrum data of the EEG signal of the same channel, the reference sound lengths of several channels are obtained according to a preset reference sound length calculation algorithm.
[0072] The reference tone length calculation algorithm is:
[0073]
[0074] In the formula, BD is the reference tone length, f β is the peak frequency of the β band, p α is the peak power spectrum value of the α band, p β is the peak power spectrum value of the β band, f α is the peak frequency of the α band, and T is the preset threshold.
[0075] In this embodiment, the music generating device obtains the reference sound length of several channels based on the peak frequency and peak power spectrum value of the α band and the β band in the power spectrum data of the EEG signal of the same channel and according to a preset reference sound length calculation algorithm.
[0076] S32: According to the reference note lengths of several channels and a preset note length adjustment algorithm, the lengths of the notes in the note sequence of the corresponding channels are adjusted.
[0077] The note length adjustment algorithm is:
[0078] l new =BD*[l orig / BD]
[0079] In the formula, l new is the length of the adjusted note, l origis the initial length of the note, and [·] is the rounding down symbol.
[0080] In this embodiment, the music generating device adjusts the lengths of the notes in the note sequence of the corresponding channels according to the reference note lengths of the channels and a preset note length adjustment algorithm.
[0081] By adopting the beat filtering method, the peak frequencies of the α and β bands are extracted and the length of the notes obtained based on the EEG feature extraction data is adjusted in combination with the individual's emotions and cognitive activities. This can adjust the expressiveness of the music in real time, so that the music not only reflects the static characteristics of the EEG signal, but also makes the original melody closer to a regular beat, thereby improving the quality of music generation.
[0082] See also Figure 6 , Figure 6 The flowchart of S3 in the method for generating music based on EEG signals provided in the third embodiment of the present application also includes steps S33 to S34, which are as follows:
[0083] S33: determining the main tone in the note sequences of the plurality of channels, and obtaining the distances between the main tone and other notes in the note sequences of the plurality of channels according to the note sequences of the plurality of channels and the main tone of the corresponding channels.
[0084] In this embodiment, the music generating device determines the main tone in the note sequence of several channels. Specifically, the music generating device uses a statistical method to traverse the notes in all channels, count the total duration of each note, determine the pitch of each note based on the total duration of each note in the same channel through a modulo 12 operation, obtain the frequency of occurrence of each note in several channels, and the note with the highest frequency of occurrence is selected as the main tone, thereby determining the main tone in the note sequence of several channels.
[0085] The music generating device obtains the distances between other notes in the note sequences of the channels and the main tone of the corresponding channels according to the note sequences of the channels.
[0086] S34: Determine a note stability ranking table of several channels according to the tonality of the EEG signals of several channels; obtain stability values of other notes in the note sequence of several channels according to the distance between other notes and the main note in the note sequence of several channels and the note stability ranking table of the corresponding channels, and delete several other notes in the note sequence of the corresponding channels according to the stability values.
[0087] In this embodiment, the music generating device determines a note stability ranking table of several channels according to the tonality of the EEG signals of the several channels; and obtains the stability values of other notes in the note sequence of the several channels according to the distance between other notes and the main note in the note sequence of the several channels and the note stability ranking table of the corresponding channels.
[0088] The music generating device retains the first few notes with high stability values in the note sequence of the corresponding channel according to the stability value, and deletes several other notes in the note sequence of the corresponding channel, thereby ensuring that the most important notes are retained.
[0089] In an optional embodiment, in order to avoid duplication of notes, the music generation device is set to retain a maximum of two identical notes at the same time. In music, a part refers to an independent melody line or harmony line, and each part is responsible for playing a different combination of notes, which together constitute a complete musical work. For each note, the music generation device attempts to distribute it to four parts of different heights, that is, it traverses each note pitch that is finally screened out, and checks whether the number of occurrences of the pitch in the current part is less than 2 times. If so, the note is added to the part and the count of the pitch is increased. Finally, all notes will be evenly distributed to the four parts to ensure that the number of notes in each part is appropriate to avoid notes that are too concentrated or sparse.
[0090] Please refer to Figure 7 , Figure 7 This is a schematic diagram of the structure of a music generating device based on EEG signals provided in the fourth embodiment of the present application. The device can implement all or part of the music generating device based on EEG signals through software, hardware, or a combination of both. The device 7 includes:
[0091] The signal acquisition module 71 is used to obtain EEG signals of several channels of the user to be tested, divide the EEG signals into EEG event signals, and obtain several EEG event signals of several channels;
[0092] A feature extraction module 72 is used to extract music features from a plurality of the EEG event signals of a plurality of channels, and obtain music feature extraction data of the plurality of the EEG event signals of a plurality of channels, wherein the music feature extraction data includes a plurality of types of music features;
[0093] A first note construction module 73, used to construct notes according to the music feature extraction data to obtain note sequences of several channels;
[0094] A second note construction module 74 is used to obtain the tonality of the EEG signals of the plurality of channels, and to construct a chord progression and perform note mapping according to the tonality to obtain a chord sequence of the plurality of channels, wherein the chord sequence includes a plurality of notes corresponding to the chord progression;
[0095] The music generation module 75 is used to combine the note sequence of the same channel and the notes in the chord sequence to obtain target note sequences of several channels, and to generate music according to the target note sequences of several channels to obtain music generation results.
[0096] In an embodiment of the present application, the EEG signals of several channels of the user to be tested are obtained through a signal acquisition module, and the EEG signals are divided into EEG event signals to obtain several EEG event signals of several channels; the feature extraction module is used to extract music features of several EEG event signals of several channels to obtain music feature extraction data of several EEG event signals of several channels, wherein the music feature extraction data includes several types of music features; the first note construction module is used to construct notes according to the music feature extraction data to obtain note sequences of several channels; the second note construction module is used to obtain the tonality of the EEG signals of several channels, and the chord progression is constructed and the note mapping is performed according to the tonality to obtain chord sequences of several channels, wherein the chord sequence includes several notes corresponding to the chord progression; the music generation module is used to combine the note sequence of the same channel and the notes in the chord sequence to obtain target note sequences of several channels, and music generation is performed according to the target note sequences of several channels to obtain music generation results. By performing multi-dimensional feature extraction and music feature mapping on the EEG signals of the users to be tested, the feature information associated with music generation in the EEG signals is fully considered for music generation, thereby improving the accuracy and quality of music generation.
[0097] Please refer to Figure 8 , Figure 8 The structural diagram of the computer device provided for the fifth embodiment of the present application, the computer device 8 includes: a processor 81, a memory 82, and a computer program 83 stored in the memory 82 and executable on the processor 81; the computer device can store multiple instructions, and the instructions are suitable for the processor 81 to load and execute the method steps of the first to third embodiments shown above. The specific execution process can refer to the specific description of the first to third embodiments shown, which will not be repeated here.
[0098] Among them, the processor 81 may include one or more processing cores. The processor 81 uses various interfaces and lines to connect various parts in the server, and executes various functions and processes data of the music generating device 7 based on brain electrical signals by running or executing instructions, programs, code sets or instruction sets stored in the memory 82, and calling the data in the memory 82. Optionally, the processor 81 can be implemented in at least one hardware form of digital signal processing (Digital Signal Processing, DSP), field programmable gate array (Field-Programmable Gate Array, FPGA), and programmable logic array (Programble Logic Array, PLA). The processor 81 can integrate one or more combinations of a central processing unit 81 (Central Processing Unit, CPU), an image processor 81 (Graphics Processing Unit, GPU) and a modem. Among them, the CPU mainly processes the operating system, user interface and application programs; the GPU is responsible for rendering and drawing the content to be displayed on the touch display; and the modem is used to process wireless communications. It can be understood that the above-mentioned modem may not be integrated into the processor 81, but implemented by a single chip.
[0099] Among them, the memory 82 may include a random access memory 82 (Random Access Memory, RAM), and may also include a read-only memory 82 (Read-Only Memory). Optionally, the memory 82 includes a non-transitory computer-readable storage medium. The memory 82 can be used to store instructions, programs, codes, code sets or instruction sets. The memory 82 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 (such as touch instructions, etc.), instructions for implementing the above-mentioned various method embodiments, etc.; the data storage area may store data involved in the above-mentioned various method embodiments, etc. The memory 82 may also be optionally at least one storage device located away from the aforementioned processor 81.
[0100] An embodiment of the present application also provides a storage medium, which can store multiple instructions. The instructions are suitable for being loaded by a processor and executing the method steps of the first to third embodiments above. The specific execution process can be found in the specific description of the first to third embodiments, which will not be repeated here.
[0101] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.
[0102] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0103] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraint algorithm of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.
[0104] In the embodiments provided by the present invention, it should be understood that the disclosed devices / terminal equipment and methods can be implemented in other ways. For example, the device / terminal equipment embodiments described above are only schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0105] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0106] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0107] If the integrated module / unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present invention implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and when the computer program is executed by a processor, the steps of the above-mentioned method embodiments can be implemented. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form, etc.
[0108] The present invention is not limited to the above-mentioned embodiments. If various changes or modifications to the present invention do not depart from the spirit and scope of the present invention, and if these changes and modifications fall within the scope of the claims and equivalent technologies of the present invention, the present invention is also intended to include these changes and modifications.
Claims
1. A music generation method based on EEG signals, characterized in that: The following steps are involved: Obtaining electroencephalogram signals of several channels of the user to be tested, dividing the electroencephalogram signals into electroencephalogram event signals, and obtaining several electroencephalogram event signals of several channels; Performing music feature extraction on a plurality of the EEG event signals of a plurality of channels to obtain music feature extraction data of the plurality of the EEG event signals of a plurality of channels, wherein the music feature extraction data includes a plurality of types of music features; Performing note construction according to the music feature extraction data to obtain note sequences of several channels, wherein the note sequences include notes of several of the electroencephalogram event signals; Obtaining the tonality of the EEG signals of several channels, constructing a chord progression and performing note mapping according to the tonality, and obtaining chord sequences of several channels, wherein the chord sequence includes several notes corresponding to the chord progression; The note sequence of the same channel and the notes in the chord sequence are combined to obtain target note sequences of several channels, and music generation is performed according to the target note sequences of several channels to obtain music generation results.
2. The method for generating music based on EEG signals according to claim 1, characterized in that: The music feature extraction is performed on a plurality of the electroencephalogram event signals of a plurality of channels to obtain music feature extraction data of a plurality of the electroencephalogram event signals of a plurality of channels, comprising the steps of: Performing EEG feature extraction on a plurality of the EEG event signals of a plurality of channels to obtain EEG feature extraction data of the plurality of the EEG event signals of a plurality of channels, wherein the EEG feature extraction data includes several types of EEG features; the EEG features include amplitude, period and average power; Music feature mapping is performed based on the amplitude, period and average power in the EEG feature extraction data to obtain music feature extraction data of several EEG event signals of several channels, wherein the music feature extraction data includes several types of music features; the music features include sound length, pitch and sound intensity.
3. The method for generating music based on EEG signals according to claim 2, characterized in that: The step of obtaining the tonality of the EEG signals of the plurality of channels comprises the following steps: Performing power spectrum analysis on the EEG signals of the plurality of channels to obtain power spectrum data of the EEG signals of the plurality of channels, wherein the power spectrum data includes peak power spectrum values of the α frequency band and the β frequency band; The peak power spectrum values of the α frequency band and the β frequency band in the power spectrum data of the EEG signal of the same channel are divided to obtain the peak power spectrum ratio of the EEG signals of several channels, and the tonality of the EEG signals of several channels is obtained according to the peak power spectrum ratio and a preset peak power spectrum ratio threshold.
4. The method for generating music based on EEG signals according to claim 3, characterized in that: The step of constructing a chord progression and mapping notes according to the tonality to obtain chord sequences of several channels includes the following steps: According to the tonality and a plurality of preset mapping relationships between tonality and chord progression, obtaining the chord progression of the EEG signals of a plurality of channels; According to the chord progression of the EEG signals of several channels and the preset mapping relationship between the chord progression and the note set, the note set of the chord progression of several channels is obtained, and the chord sequence of the EEG signals of several channels is constructed.
5. The method for generating music based on EEG signals according to claim 3, characterized in that: The power spectrum data also includes the peak frequencies of the α frequency band and the β frequency band; The step of extracting the music feature data and constructing notes to obtain note sequences of several channels also includes the following steps: Based on the peak frequencies and peak power spectrum values of the α band and the β band in the power spectrum data of the EEG signal of the same channel, the reference sound lengths of several channels are obtained according to a preset reference sound length calculation algorithm, wherein the reference sound length calculation algorithm is: In the formula, BD is the reference tone length, f β is the peak frequency of the β band, P α is the peak power spectrum value of the α band, P β is the peak power spectrum value of the β band, f α is the peak frequency of the α band, and T is the preset threshold; According to the reference note lengths of several channels and a preset note length adjustment algorithm, the lengths of the notes in the note sequence of the corresponding channels are adjusted, wherein the note length adjustment algorithm is: l new =BD*[l orig / BD] In the formula, l new is the length of the adjusted note, l orig is the initial length of the note, and [·] is the rounding down symbol.
6. The method for generating music based on EEG signals according to claim 3 or 5, characterized in that: The step of extracting the music feature data and constructing notes to obtain note sequences of several channels includes the following steps: Determine the main tone in the note sequence of the plurality of channels, and obtain the distance between the main tone and other notes in the note sequence of the plurality of channels according to the note sequence of the plurality of channels and the main tone of the corresponding channel; According to the tonality of the EEG signals of several channels, the note stability ranking table of several channels is determined; according to the distance between other notes and the main note in the note sequence of several channels and the note stability ranking table of the corresponding channels, the stability values of other notes in the note sequence of several channels are obtained; according to the stability values, several other notes in the note sequence of the corresponding channels are deleted.
7. A music generating device based on EEG signals, characterized in that: include: A signal acquisition module is used to obtain EEG signals of several channels of the user to be tested, divide the EEG signals into EEG event signals, and obtain several EEG event signals of several channels; A feature extraction module, used for performing music feature extraction on a plurality of the EEG event signals of a plurality of channels, and obtaining music feature extraction data of the plurality of the EEG event signals of a plurality of channels, wherein the music feature extraction data includes a plurality of types of music features; A first note construction module, used for performing note construction according to the music feature extraction data to obtain note sequences of several channels; A second note construction module is used to obtain the tonality of the EEG signals of several channels, and to construct a chord progression and perform note mapping according to the tonality to obtain a chord sequence of several channels, wherein the chord sequence includes several notes corresponding to the chord progression; The music generation module is used to combine the note sequence of the same channel and the notes in the chord sequence to obtain target note sequences of several channels, and to generate music according to the target note sequences of several channels to obtain music generation results.
8. A computer device, characterized in that: It comprises a processor, a memory and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the steps of the method for generating music based on electroencephalogram signals as described in any one of claims 1 to 6 are implemented.
9. A storage medium, characterized in that: The storage medium stores a computer program, which, when executed by a processor, implements the steps of the method for generating music based on electroencephalographic signals as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Brain wave music generation method
CN102999701A
Audio generation method and device, computer equipment and storage medium
CN114333744A
Alpha brainwave music generation method, product, medium and equipment
CN119015567A
Method and system for translation of brain signals into ordered music
US20220343882A1