Methods, devices, equipment, and storage media for music generation based on electroencephalogram (EEG) signals.

By extracting and mapping multi-dimensional features from EEG signals, the accuracy and quality issues of personalized music generation in existing technologies have been resolved, achieving high-quality generation of personalized music.

CN119701158BActive Publication Date: 2025-10-31SOUTH CHINA NORMAL UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411819393.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-11
Publication Date
2025-10-31
Estimated Expiration
2044-12-11

AI Technical Summary

Technical Problem

Existing brainwave music generation methods ignore the differences in individual brainwave signals, resulting in generated music that cannot accurately reflect individual emotional fluctuations and makes it difficult to achieve personalized, high-quality music generation.

Method used

By performing multi-dimensional feature extraction and music feature mapping on the EEG signals of the test users, including EEG event signal segmentation, music feature extraction, note construction, tonality and chord progression construction, and combining parameters such as amplitude, period and average power of EEG signals, personalized music is generated.

Benefits of technology

It improves the accuracy and quality of music generation, ensuring that the music reflects individual emotional fluctuations and possesses rich harmonic effects and emotional expression.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119701158B_ABST
    Figure CN119701158B_ABST
Patent Text Reader

Abstract

This invention relates to the field of signal processing technology, and in particular to a method for music generation based on electroencephalogram (EEG) signals. The method includes: obtaining EEG signals from several channels of a user; dividing the EEG signals into EEG event signals to obtain several EEG event signals for several channels; extracting music features from the several EEG event signals for several channels to obtain music feature extraction data for the several EEG event signals for several channels; constructing notes based on the music feature extraction data to obtain note sequences for several channels; obtaining the tonality of the EEG signals from several channels; constructing chord progressions and mapping notes based on the tonality to obtain chord sequences for several channels; combining the note sequences from the same channel with the notes in the chord sequences to obtain target note sequences for several channels; and generating music based on the target note sequences for several channels to obtain a music generation result.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of signal processing technology, and in particular to a method, apparatus, device, and storage medium for generating music based on electroencephalogram (EEG) signals. Background Technology

[0002] Brainwave music synthesis technology is a technique that converts electroencephalogram (EEG) signals into music. The development of this technology has gone through several stages, from initial attempts to make brainwaves "speak," to using brainwave signals as material for music creation, to using music created from brainwave signals for biofeedback, and recent research has found that "brain music" created using patients' own brainwaves has a strong hypnotic effect.

[0003] Research in electroencephalography (EEG) has shown that parameters such as amplitude, phase, and frequency of EEG all follow scale-free properties, as does the power spectrum of EEG. Based on this method, the period of EEG corresponds to the duration of a musical note, the amplitude of EEG corresponds to the pitch of a musical note, and the average energy change in EEG corresponds to the intensity of a musical note. Using these 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 brainwave signals. The generated music cannot accurately reflect the individual's emotional fluctuations, making it difficult to achieve accurate and high-quality personalized music generation. Summary of the Invention

[0005] Based on this, the purpose of the present invention is to provide a music generation method, apparatus, device, and storage medium based on electroencephalogram (EEG) signals. By performing multi-dimensional feature extraction and music feature mapping on the EEG signals of the user to be tested, the present invention fully considers the feature information in the EEG signals that is related to music generation, thereby improving the accuracy and quality of music generation.

[0006] In a first aspect, embodiments of this application provide a music generation method based on electroencephalogram (EEG) signals, comprising the following steps:

[0007] The system obtains EEG signals from several channels of the user to be tested, divides the EEG signals into EEG event signals, and obtains several EEG event signals from several channels.

[0008] Music feature extraction is performed on several EEG event signals from several channels to obtain music feature extraction data of several EEG event signals from several channels, wherein the music feature extraction data includes several types of music features;

[0009] Based on the music feature extraction data, note construction is performed to obtain note sequences for several channels, wherein the note sequences include notes of several EEG event signals;

[0010] The tonality of the EEG signals from several channels is obtained, and chord progressions and note mappings are performed based on the tonality to obtain chord sequences from several channels, wherein the chord sequences include several notes corresponding to the chord progressions.

[0011] The notes in the same channel and the notes in the chord sequence are combined to obtain target note sequences for several channels. Music is generated based on the target note sequences for several channels to obtain the music generation result.

[0012] Secondly, embodiments of this application provide a music generation device based on electroencephalogram (EEG) signals, comprising:

[0013] The signal acquisition module is used to acquire EEG signals from several channels of the user under test, divide the EEG signals into EEG event signals, and obtain several EEG event signals from several channels.

[0014] The feature extraction module is used to extract music features from several EEG event signals from several channels to obtain music feature extraction data of several EEG event signals from several channels, wherein the music feature extraction data includes several types of music features.

[0015] The first note construction module is used to extract data based on the musical features to construct notes and obtain note sequences for several channels;

[0016] The second note construction module is used to obtain the tonality of the EEG signals from several channels, construct chord progressions and map notes based on the tonality, and obtain chord sequences from several channels, wherein the chord sequences include several notes corresponding to the chord progressions.

[0017] The music generation module is used to combine the note sequences and chord sequences in the same channel to obtain target note sequences for several channels, and to generate music based on the target note sequences for several channels to obtain the music generation result.

[0018] Thirdly, embodiments of this application provide a computer device, including a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the music generation method based on electroencephalogram signals as described in the first aspect.

[0019] Fourthly, embodiments of this application provide a storage medium storing a computer program that, when executed by a processor, implements the steps of the music generation method based on electroencephalogram (EEG) signals as described in the first aspect.

[0020] In this application embodiment, a method, apparatus, device and storage medium for music generation based on electroencephalogram (EEG) signals are provided. By performing multi-dimensional feature extraction and music feature mapping on the EEG signals of the user to be tested, the feature information in the EEG signals that is related to music generation is fully considered to generate music, thereby improving the accuracy and quality of music generation.

[0021] To better understand and implement this invention, the following detailed description is provided in conjunction with the accompanying drawings. Attached Figure Description

[0022] Figure 1 A flowchart illustrating the music generation method based on electroencephalogram (EEG) signals provided in the first embodiment of this application;

[0023] Figure 2 A flowchart illustrating step S2 in the music generation method based on electroencephalogram (EEG) signals provided in the first embodiment of this application;

[0024] Figure 3 This is a flowchart illustrating step S4 of the music generation method based on electroencephalogram (EEG) signals provided in the first embodiment of this application.

[0025] Figure 4 This is a flowchart illustrating step S4 of the music generation method based on electroencephalogram (EEG) signals provided in the first embodiment of this application.

[0026] Figure 5 This is a flowchart illustrating step S3 of the music generation method based on electroencephalogram (EEG) signals provided in the second embodiment of this application.

[0027] Figure 6 A flowchart illustrating step S3 of the music generation method based on electroencephalogram (EEG) signals provided in the third embodiment of this application;

[0028] Figure 7 This is a schematic diagram of the structure of the music generation device based on electroencephalogram (EEG) signals provided in the fourth embodiment of this application;

[0029] Figure 8 This is a schematic diagram of the structure of a computer device provided in the fifth embodiment of this application. Detailed Implementation

[0030] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.

[0031] The terminology used in this application is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. The singular forms “a,” “the,” and “the” used in this application and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used herein refers to and includes any or all possible combinations of one or more of the associated listed items.

[0032] It should be understood that although the terms first, second, third, etc., may be used in this application to describe various information, such information should not be limited to these terms. These terms are only used to distinguish information of the same type from one another. For example, without departing from the scope of this application, first information may also be referred to as second information, and similarly, second information may also be referred to as first information. Depending on the context, the word "if" as used herein may be interpreted as "when," "when," or "in response to determination."

[0033] Please see Figure 1 , Figure 1 The flowchart of the music generation method based on electroencephalogram (EEG) signals provided in the first embodiment of this application is shown. The method includes the following steps:

[0034] S1: Obtain EEG signals from several channels of the user to be tested, divide the EEG signals into EEG event signals, and obtain several EEG event signals from several channels.

[0035] The execution subject of the music generation method based on EEG signals is a music generation device based on EEG signals (hereinafter referred to as the music generation device). In an optional embodiment, the music generation device may be a computer device, a server, or a server cluster composed of multiple computer devices.

[0036] In this embodiment, the music generation device can be an EEG interface device to collect the raw signals of the user under test and convert the raw signals into digital signals to obtain EEG signals from several channels.

[0037] In an optional embodiment, the music generation device uses a bandpass frequency filter of 0.5-75Hz to filter the EEG signal, remove interference from non-target frequencies, and ensure that the data is correlated with brain waves.

[0038] In addition, to improve processing efficiency, the music generation device down-frequencys the filtered EEG signals and uses wavelet denoising technology to eliminate noise through multi-scale analysis. Furthermore, Independent Component Analysis (ICA) is used to convert the down-frequency EEG signals into new, uncorrelated variables, effectively separating the source signal from the noise source. This further eliminates interference from eye movements and electromyography, improving the purity of the brainwave signals and thus enhancing the quality of the EEG signals.

[0039] The music generation device divides the EEG signal into EEG event signals to obtain several EEG event signals in several channels.

[0040] S2: Perform music feature extraction on several EEG event signals from several channels to obtain music feature extraction data of several EEG event signals from several channels.

[0041] In order to capture its multidimensional characteristics and fully extract music-related feature information from EEG signals, in this embodiment, the music generation device performs music feature extraction on several EEG event signals from several channels to obtain music feature extraction data of several EEG event signals from several channels, wherein the music feature extraction data includes several types of music features.

[0042] Please see Figure 2 , Figure 2 The flowchart of S2 in the music generation method based on electroencephalogram (EEG) signals provided in the first embodiment of this application includes steps S21 to S22, as follows:

[0043] S21: Perform EEG feature extraction on several EEG event signals from several channels to obtain EEG feature extraction data of several EEG event signals from several channels.

[0044] In this embodiment, the music generation device performs EEG feature extraction on several EEG event signals from several channels to obtain EEG feature extraction data for several EEG event signals from several channels. The EEG feature extraction data includes several types of EEG features, including amplitude, period, and average power.

[0045] Specifically, the amplitude is directly mapped to the pitch of a musical note. The music generation device calculates the difference between the maximum and minimum values ​​of several EEG event signals as the amplitude. The music generation device determines the amplitude by calculating the zero-crossing points of the several EEG event signals. A zero-crossing point is the moment when a 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 generation device calculates the values ​​of several preset sampling points among the several EEG event signals, performs cumulative averaging processing, and obtains the average power of the several EEG event signals.

[0046] S22: Based on the amplitude, period, and average power in the EEG feature extraction data, perform music feature mapping to obtain music feature extraction data of several EEG event signals in several channels.

[0047] In this embodiment, the music generation device performs music feature mapping 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 in several channels. The music feature extraction data includes several types of music features, including duration, pitch, and intensity.

[0048] Specifically, the music generation device determines the duration of several EEG event signals based on frequency characteristics by dividing the period of each signal by a preset sampling frequency. The music generation device then maps the amplitude of the several EEG event signals to pitch using a logarithmic relationship to obtain the pitch of each signal. Finally, the music generation device calculates the intensity of several EEG event signals based on their average power using a preset intensity calculation algorithm, wherein the intensity calculation algorithm is as follows:

[0049] Dynamics(t) = k·log(P(t)) + l

[0050] In the formula, Dynamics(t) is the sound intensity of the t-th EEG event signal, k is the first constant used to control the mapping ratio from 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 sound intensity.

[0051] S3: Construct notes based on the extracted music feature data to obtain note sequences for several channels.

[0052] In this embodiment, the music generation device constructs notes based on the music feature extraction data to obtain a note sequence of several channels, wherein the note sequence includes notes of several EEG event signals.

[0053] S4: Obtain the tonality of the EEG signals from several channels, construct chord progressions and map notes based on the tonality, and obtain chord sequences from several channels.

[0054] In this embodiment, the music generation device obtains the tonality of the EEG signals from several channels, constructs chord progressions and maps notes based on the tonality, and obtains chord sequences from several channels, wherein the chord sequences include several notes corresponding to the chord progressions.

[0055] Please see Figure 3 , Figure 3 The flowchart of S4 in the music generation method based on electroencephalogram (EEG) signals provided in the first embodiment of this application includes steps S41 to S42, as follows:

[0056] S41: Perform power spectrum analysis on the EEG signals of several channels to obtain power spectrum data of the EEG signals of several channels.

[0057] In this embodiment, the music generation 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 signal of the current channel. The power spectrum data includes the peak power spectrum values ​​of the α band and the β band.

[0058] S42: Divide the peak power spectrum values ​​of the α band and β band in the power spectrum data of the EEG signal in the same channel to obtain the peak power spectrum ratio of the EEG signal in several channels. Based on the peak power spectrum ratio and a preset peak power spectrum ratio threshold, obtain the tone of the EEG signal in several channels.

[0059] The tonality mentioned includes major and minor keys. 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 meant more high-frequency activities and a higher level of arousal, while minor keys were the opposite.

[0060] In this embodiment, the music generation device divides the peak power spectrum values ​​of the α band and β band in the power spectrum data of the EEG signal in the same channel to obtain the peak power spectrum ratio of the EEG signal in several channels.

[0061] The music generation device obtains the tonality of the EEG signals from several channels based on the peak power spectral ratio (PSPR) and a preset PSPR threshold. Specifically, the PSPR threshold is set to 1.5. If the PSPR is greater than the PSPR threshold, the music generation device determines that the tonality of the EEG signal is major. If the PSPR is greater than or equal to the PSPR threshold, the music generation device determines that the tonality of the EEG signal is minor.

[0062] Please see Figure 4 , Figure 4 The flowchart of S4 in the music generation method based on electroencephalogram (EEG) signals provided in the first embodiment of this application includes steps S43 to S44, as follows:

[0063] S43: Based on the tonality and a preset mapping relationship between several tonality and chord progression, obtain the chord progression of the EEG signals of several channels.

[0064] Chord progressions include the I-IV-VI chord progression, where I, IV, and V represent the tonic, subdominant, and dominant chords, respectively. These chord progressions guide the harmonic development of music, enhancing its harmony and emotional expressiveness.

[0065] In this embodiment, the music generation device obtains the chord progressions of the EEG signals from several channels based on the tonality and a preset mapping relationship between several tonality and chord progressions.

[0066] S44: Based on the chord progression of the EEG signals of several channels and the preset mapping relationship between the chord progression and the note set, obtain the note set of the chord progression of several channels, and construct the chord sequence of the EEG signals of several channels.

[0067] In this embodiment, the music generation device obtains the note sets of the chord processes of the EEG signals from several channels and a preset mapping relationship between chord processes and note sets, thus constructing chord sequences of the EEG signals from several channels. This not only ensures the emotional expression of the notes but also dynamically adjusts the chord structure under different EEG states, enabling the music generation to not only reflect EEG characteristics but also possess rich chord variations, thereby enhancing the harmonic effect and emotional expression of the music.

[0068] S5: Combine the note sequences and chord sequences in the same channel to obtain target note sequences for several channels. Generate music based on the target note sequences for several channels to obtain the music generation result.

[0069] In this embodiment, the music generation device combines note sequences from the same channel with notes from chord sequences to obtain target note sequences for several channels. Music is then generated based on these target note sequences to obtain the music generation result. It can extract meaningful features from data from different channels and adjust musical elements according to different EEG characteristics. Through complex mathematical mapping and chord processing, it achieves efficient analysis and artistic expression of multidimensional EEG data, improving the accuracy and quality of music generation.

[0070] The power spectrum data also includes the peak frequencies of the α and β bands. Please refer to [link / reference]. Figure 5 , Figure 5 The flowchart of S3 in the music generation method based on electroencephalogram (EEG) signals provided in the second embodiment of this application also includes steps S31 to S32, as follows:

[0071] S31: Based on the peak frequency and peak power spectrum value of the α band and β band in the power spectrum data of the EEG signal in the same channel, the reference pitch length of several channels is obtained according to the preset reference pitch length calculation algorithm.

[0072] The algorithm for calculating the reference pitch length is as follows:

[0073]

[0074] In the formula, BD is the reference pitch length, f β p is the peak frequency of the β band. α p represents the peak power spectral density value of the α band. β f is the peak power spectral density value of the β band. α Here, α is the peak frequency of the α band, and T is a pre-set threshold.

[0075] In this embodiment, the music generation device obtains the reference pitch of several channels based on the peak frequency and peak power spectrum value of the α band and β band in the power spectrum data of the EEG signal of the same channel, according to a preset reference pitch calculation algorithm.

[0076] S32: Adjust the length of the notes in the note sequence of the corresponding channel according to the reference pitch length of several channels and the preset note length adjustment algorithm.

[0077] The note length adjustment algorithm is as follows:

[0078] l new =BD*[l orig / BD]

[0079] In the formula, l new For the adjusted note length, l origThe initial length of the note is [·], and [·] is the floor symbol.

[0080] In this embodiment, the music generation device adjusts the length of the notes in the note sequence of the corresponding channel according to the reference pitch length of several channels and a preset note length adjustment algorithm.

[0081] By employing a beat filtering method, the peak frequencies of the alpha and beta bands are extracted and combined with individual emotions and cognitive activities to adjust the length of notes obtained from EEG feature extraction data. This allows for real-time adjustment of the music's expressiveness, making the music not only reflect the static characteristics of EEG signals but also make the original melody closer to a regular beat, thus improving the quality of music generation.

[0082] Please see Figure 6 , Figure 6 The flowchart of step S3 in the music generation method based on electroencephalogram (EEG) signals provided in the third embodiment of this application also includes steps S33 to S34, as follows:

[0083] S33: Determine the tonic in the note sequence of several channels, and obtain the distance between other notes and the tonic in the note sequence of several channels based on the note sequence of several channels and the tonic of the corresponding channel.

[0084] In this embodiment, the music generation device determines the tonic in the note sequence of several channels. Specifically, the music generation device uses a statistical method to traverse the notes in all channels, count the total duration of each note, and determine the pitch of each note based on the total duration of each note in the same channel through modulo-12 operation. This yields the frequency of occurrence of each note in several channels, and the note with the highest frequency of occurrence is selected as the tonic, thus determining the tonic in the note sequence of several channels.

[0085] The music generation device obtains the distances between other notes and the tonic in the note sequences of several channels based on the note sequences of several channels and the tonic of the corresponding channels.

[0086] S34: Based on the tonality of the EEG signals from several channels, determine a note stability ranking table for several channels; based on the distance between other notes and the tonic in the note sequences of several channels and the note stability ranking table of the corresponding channels, obtain the stability values ​​of other notes in the note sequences of several channels; based on the stability values, delete several other notes in the note sequences of the corresponding channels.

[0087] In this embodiment, the music generation device determines a note stability sorting table for several channels based on the tonality of the EEG signals from several channels; and obtains the stability values ​​of other notes in the note sequences of several channels based on the distance between other notes and the tonic in the note sequences of several channels and the note stability sorting table of the corresponding channels.

[0088] Based on the stability value, the music generation device retains the first few notes with high stability values ​​in the note sequence of the corresponding channel, and deletes several other notes in the note sequence of the corresponding channel, ensuring that the most important notes are preserved.

[0089] In an optional embodiment, to avoid note repetition, the music generation device is configured to retain a maximum of two identical notes at any given time. In music, a voice part refers to an independent melody line or harmony line, with each voice part responsible for playing different combinations of notes, collectively forming a complete musical work. For each note, the music generation device attempts to distribute it among the four voice parts of different pitches. That is, it iterates through each of the final selected note pitches, checking if the frequency of that pitch in the current voice part is less than 2. If so, the note is added to that voice part, and the count of that pitch is incremented. Ultimately, all notes are evenly distributed among the four voice parts, ensuring that the number of notes in each voice part is appropriate and avoiding notes being too concentrated or sparse.

[0090] Please refer to Figure 7 , Figure 7 This is a schematic diagram of the structure of a music generation device based on electroencephalogram (EEG) signals provided in the fourth embodiment of this application. This device can be implemented in whole or in part through software, hardware, or a combination of both. The device 7 includes:

[0091] The signal acquisition module 71 is used to acquire the EEG signals of several channels of the user under test, divide the EEG signals into EEG event signals, and obtain several EEG event signals of several channels.

[0092] The feature extraction module 72 is used to extract music features from several EEG event signals from several channels to obtain music feature extraction data of several EEG event signals from several channels, wherein the music feature extraction data includes several types of music features.

[0093] The first note construction module 73 is used to construct notes based on the data extracted from the music features to obtain a note sequence with several channels;

[0094] The second note construction module 74 is used to obtain the tonality of the EEG signals of several channels, construct chord progressions and map notes according to the tonality, and obtain chord sequences of several channels, wherein the chord sequence includes several notes corresponding to the chord progression.

[0095] The music generation module 75 is used to combine the note sequences and chord sequences in the same channel to obtain target note sequences in several channels, and to generate music based on the target note sequences in several channels to obtain music generation results.

[0096] In this embodiment, a signal acquisition module acquires EEG signals from several channels of the user under test, divides the EEG signals into EEG event signals, and obtains several EEG event signals for several channels. A feature extraction module extracts music features from the several EEG event signals for several channels, obtaining music feature extraction data for the several EEG event signals for several channels, wherein the music feature extraction data includes several types of music features. A first note construction module constructs notes based on the music feature extraction data, obtaining note sequences for several channels. A second note construction module obtains the tonality of the EEG signals for several channels, constructs chord progressions and maps notes based on the tonality, obtaining chord sequences for several channels, wherein the chord sequences include several notes corresponding to the chord progressions. A music generation module combines the note sequences of the same channel and the notes in the chord sequences to obtain target note sequences for several channels, and generates music based on the target note sequences for several channels, obtaining music generation results. By performing multi-dimensional feature extraction and music feature mapping on the EEG signals of the test users, the feature information in the EEG signals that is related to music generation is fully considered to generate music, thereby improving the accuracy and quality of music generation.

[0097] Please refer to Figure 8 , Figure 8 This is a schematic diagram of the structure of a computer device provided in the fifth embodiment of this 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, which are applicable to the method steps of the embodiments shown in the first to third embodiments above being loaded and executed by the processor 81. For the specific execution process, please refer to the specific description of the embodiments shown in the first to third embodiments, which will not be repeated here.

[0098] The processor 81 may include one or more processing cores. The processor 81 connects to various parts of the server using various interfaces and lines, and executes various functions and processes data of the brainwave signal-based music generation device 7 by running or executing instructions, programs, code sets, or instruction sets stored in the memory 82, and by calling data from the memory 82. Optionally, the processor 81 may be implemented using at least one hardware form of Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), or Programmable Logic Array (PLA). The processor 81 may integrate one or a combination of several of the following: a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), and a modem. The CPU primarily handles the operating system, user interface, and applications; the GPU is responsible for rendering and drawing the content required to be displayed on the touch screen; and the modem handles wireless communication. It is understood that the modem may also not be integrated into the processor 81 and may be implemented as a separate chip.

[0099] The memory 82 may include random access memory (RAM) or read-only memory. Optionally, the memory 82 may include a non-transitory computer-readable storage medium. The memory 82 can be used to store instructions, programs, code, 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), instructions for implementing the various method embodiments described above, etc.; the data storage area may store data involved in the various method embodiments described above, etc. Optionally, the memory 82 may also be at least one storage device located remotely from the aforementioned processor 81.

[0100] This application also provides a storage medium that can store multiple instructions. These instructions are applicable to being loaded by a processor and executed by the method steps of the first to third embodiments described above. For details of the execution process, please refer to the specific descriptions of the first to third embodiments, which will not be repeated here.

[0101] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is merely an example. In practical applications, the above functions can be assigned to 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 embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit. Furthermore, the specific names of the functional units and modules are only for easy differentiation and are not intended to limit the scope of protection of this application. The specific working process of the units and modules in the above system can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.

[0102] In the above embodiments, the descriptions of each embodiment have different focuses. For parts that are not described in detail or recorded in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0103] Those skilled in the art will recognize that the units and algorithm steps of the various examples 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 implemented in hardware or software depends on the specific application and design constraints of the algorithm. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this invention.

[0104] In the embodiments provided by this invention, it should be understood that the disclosed apparatus / terminal devices and methods can be implemented in other ways. For example, the apparatus / terminal device embodiments described above are merely illustrative. For instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between devices or units may be electrical, mechanical, or other forms.

[0105] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0106] Furthermore, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0107] If the integrated module / unit is implemented as 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, all or part of the processes in the methods of the above embodiments of the present invention can also be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms.

[0108] This invention is not limited to the above-described embodiments. If any modifications or variations to this invention do not depart from the spirit and scope of this invention, and if such modifications and variations fall within the scope of the claims and equivalent technologies of this invention, then this invention also intends to include such modifications and variations.

Claims

1. A method for music generation based on electroencephalogram (EEG) signals, characterized in that, Includes the following steps: The system obtains EEG signals from several channels of the user to be tested, divides the EEG signals into EEG event signals, and obtains several EEG event signals from several channels. Music feature extraction is performed on several EEG event signals from several channels to obtain music feature extraction data of several EEG event signals from several channels, wherein the music feature extraction data includes several types of music features; Based on the music feature extraction data, note construction is performed to obtain note sequences for several channels, wherein the note sequences include notes of several EEG event signals; The tonality of the EEG signals from several channels is obtained, and chord progressions and note mappings are performed based on the tonality to obtain chord sequences from several channels, wherein the chord sequences include several notes corresponding to the chord progressions. The notes in the same channel and the notes in the chord sequence are combined to obtain target note sequences for several channels. Music is generated based on the target note sequences for several channels to obtain the music generation result. The step of constructing chord progressions and mapping notes based on the tonality to obtain chord sequences for several channels includes the following steps: Based on the tonality and a number of preset mapping relationships between tonality and chord progressions, the chord progressions of the EEG signals in several channels are obtained. Based on the chord progression of the EEG signals from 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 from several channels is constructed. The step of constructing note sequences from the extracted music features to obtain a series of notes across several channels includes the following steps: Determine the tonic in the note sequence of several channels, and based on the note sequence of several channels and the tonic of the corresponding channel, obtain the distance between other notes in the note sequence of several channels and the tonic; Based on the tonality of the EEG signals from several channels, a note stability ranking table for several channels is determined; based on the distance between other notes and the tonic in the note sequences of several channels and the note stability ranking table of the corresponding channels, the stability values ​​of other notes in the note sequences of several channels are obtained; based on the stability values, several other notes in the note sequences of the corresponding channels are deleted.

2. The music generation method based on electroencephalogram (EEG) signals according to claim 1, characterized in that, The step of extracting music features from several EEG event signals across several channels to obtain music feature extraction data for several EEG event signals across several channels includes the following steps: EEG feature extraction is performed on several EEG event signals from several channels to obtain EEG feature extraction data for several EEG event signals from several channels. The EEG feature extraction data includes several types of EEG features, including 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 for several EEG event signals in several channels. The music feature extraction data includes several types of music features, including duration, pitch, and intensity.

3. The music generation method based on electroencephalogram (EEG) signals according to claim 2, characterized in that: Obtaining the modulation of the EEG signals from several channels includes the following steps: Power spectrum analysis is performed on the EEG signals of several channels to obtain power spectrum data of the EEG signals of several channels, wherein the power spectrum data includes peak power spectrum values ​​of the α band and the β band. The peak power spectral values ​​of the α band and β band in the power spectral data of the EEG signal in the same channel are divided to obtain the peak power spectral ratio of the EEG signal in several channels. Based on the peak power spectral ratio and a preset peak power spectral ratio threshold, the tone of the EEG signal in several channels is obtained.

4. The music generation method based on electroencephalogram (EEG) signals according to claim 3, characterized in that: The power spectrum data also includes the peak frequencies of the α band and the β band; The step of constructing note sequences based on the extracted music feature data to obtain note sequences for several channels further includes the following steps: Based on the peak frequencies and peak power spectral values ​​of the α and β bands in the power spectrum data of the EEG signal from the same channel, reference pitch lengths for several channels are obtained according to a preset reference pitch length calculation algorithm. The reference pitch length calculation algorithm is as follows: In the formula, As the reference pitch length, The peak frequency of the β band. This represents the peak power spectral density value in the α band. This represents the peak power spectral density value in the β band. This is the peak frequency of the α band. For a pre-set threshold; Based on the reference pitch lengths of several channels and a preset note length adjustment algorithm, the note lengths in the note sequences of the corresponding channels are adjusted, wherein the note length adjustment algorithm is as follows: In the formula, The adjusted note length, The initial length of the note. This is the floor symbol.

5. A music generation device based on electroencephalogram (EEG) signals, characterized in that, include: The signal acquisition module is used to acquire EEG signals from several channels of the user under test, divide the EEG signals into EEG event signals, and obtain several EEG event signals from several channels. The feature extraction module is used to extract music features from several EEG event signals from several channels to obtain music feature extraction data of several EEG event signals from several channels, wherein the music feature extraction data includes several types of music features. The first note construction module is used to extract data based on the musical features to construct notes and obtain note sequences for several channels; The second note construction module is used to obtain the tonality of the EEG signals from several channels, construct chord progressions and map notes based on the tonality, and obtain chord sequences from several channels, wherein the chord sequences include several notes corresponding to the chord progressions. The music generation module is used to combine the note sequences and chord sequences in the same channel to obtain target note sequences in several channels, and to generate music based on the target note sequences in several channels to obtain the music generation result. The step of constructing chord progressions and mapping notes based on the tonality to obtain chord sequences for several channels includes the following steps: Based on the tonality and a number of preset mapping relationships between tonality and chord progressions, the chord progressions of the EEG signals in several channels are obtained. Based on the chord progression of the EEG signals from 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 from several channels is constructed. The step of constructing note sequences from the extracted music features to obtain a series of notes across several channels includes the following steps: Determine the tonic in the note sequence of several channels, and obtain the distance between other notes in the note sequence of several channels and the tonic of the corresponding channel based on the note sequence of several channels; Based on the tonality of the EEG signals from several channels, a note stability ranking table for several channels is determined; based on the distance between other notes and the tonic in the note sequences of several channels and the note stability ranking table of the corresponding channels, the stability values ​​of other notes in the note sequences of several channels are obtained; based on the stability values, several other notes in the note sequences of the corresponding channels are deleted.

6. A computer device, characterized in that, It includes a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the music generation method based on electroencephalogram (EEG) signals as described in any one of claims 1 to 4.

7. A storage medium, characterized in that: The storage medium stores a computer program that, when executed by a processor, implements the steps of the music generation method based on electroencephalogram (EEG) signals as described in any one of claims 1 to 4.

Citation Information

Patent Citations

  • Brain wave music generation method

    CN102999701A

  • Audio generation method and device, computer equipment and storage medium

    CN114333744A