An adaptive brain-computer interaction method and system based on non-heritage music frequency prescription

CN123011012APending Publication Date: 2026-10-30SHENZHEN LIOZHI TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610918839.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-06-24
Publication Date
2026-10-30

AI Technical Summary

Technical Problem

[0004]本发明的目的在于提供一种基于非遗古乐频率处方的自适应脑机交互方法及系统,以解决上述背景技术中提到的现有的缺乏个性化处方的量化生成方法、无法实现基于单通道脑电的实时闭环反馈调整、疗效评估缺乏客观工程指标等问题

Benefits of technology

[0015]由上述技术方案可知,本发明与现有技术相比至少具备以下优点和积极效果:本发明通过建立非遗古乐音频特征库,利用短时傅里叶变换、恒Q变换、Chroma特征提取、基频估计和五声音阶模板匹配等数字信号处理方法,将民族古乐的音高、调式、频谱和节奏特征转化为可量化的处方参数,并与用户实时脑电状态进行映射匹配;相比现有单纯依赖通用音乐曲库的方案,本发明的处方音乐具有明确的文化根源和可计算的频率特征,在实现文化传承的同时确保技术方案的可复现性和可验证性。采用三电极单通道脑电采集结构,有效电极、参考电极和接地电极的配合布局既降低硬件成本和佩戴复杂度,又保证信号质量;通过完整的单通道预处理链路(带通滤波、陷波滤波、小波阈值去噪)和严格的伪迹检测与有效性门控机制(ValidWindow标记),有效剔除肌电、运动和接触不良等干扰,显著提高单通道EEG闭环反馈的可靠性。采用规则库约束与机器学习(或强化学习)模型相融合的决策架构,规则库确保基础安全性和响应及时性,学习型模型根据历史有效会话样本(按结束原因编码赋予差异化样本权重)持续优化决策策略;使多设备端的处方策略能够在不泄露用户原始脑电数据的前提下实现群体进化,随着使用规模的扩大,系统个性化适配能力不断增强。在听觉处方音乐的基础上,可选地集成嗅觉(隐藏式香薰可控释放)、视觉(RGB LED灯光节律)和触觉(振动频率与包络引导)三条辅助交互通道,并通过统一会话时间戳实现多通道信号的毫秒级同步输出;相比单一听觉刺激,四感协同能够营造更加沉浸的干预环境,提高用户的依从性和状态引导效率。通过天维参数(时间节律与日周期)、地维参数(使用场景与环境标签)和人维参数(个体EEG指纹、中医体质标签)的多维度融合,在用户尚未产生任何反馈数据之前即可生成具有个体化基础的初始处方对象;通过EEG指纹特征向量与中医体质分类模型的映射,将传统中医体质学说与现代脑电生理信号建立了可计算的关联,为非遗古乐处方的个体化选择提供具有文化特色和生理依据的初始化策略。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123011012A_ABST
    Figure CN123011012A_ABST
Patent Text Reader

Abstract

The application discloses a kind of adaptive brain-computer interaction method and system based on non-heritage ancient music frequency prescription, comprising: collecting user electroencephalogram and extracting electroencephalogram state feature, obtains non-heritage ancient music audio data and its frequency spectrum feature and five sound label;According to user target state, electroencephalogram state feature and ancient music feature, generate prescription object containing prescription music parameter and output prescription music, while continuously collecting electroencephalogram;According to the difference between real-time electroencephalogram state and target state, adaptively adjust prescription parameter, stop output when meeting end condition and generate prescription execution record.The application realizes personalized, quantifiable, safe and controllable adaptive brain-computer interaction intervention by the deep combination of non-heritage ancient music frequency characteristics and electroencephalogram closed-loop feedback, and can be applied to sleep improvement, emotion regulation, concentration training and meditation assistance and the like.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of artificial intelligence technology, specifically to an adaptive brain-computer interface method and system based on frequency prescriptions of intangible cultural heritage ancient music. Background Technology

[0002] Music therapy, as a non-pharmacological intervention that utilizes musical experiences to improve an individual's physical, psychological, and cognitive health, already has a relatively broad application base. In recent years, with the rapid development of brain-computer interface (BCI) technology, artificial intelligence algorithms, and wearable physiological sensing technology, personalized music intervention based on real-time physiological feedback has gradually become a research hotspot.

[0003] Current music therapy methods often rely on generic playlists or fixed music libraries, failing to adequately consider individual differences in EEG physiological states, psychological traits, and cultural backgrounds. This results in highly variable and inconsistent intervention effects. While some approaches attempt to match music preferences through subjective questionnaires, they lack a quantitative prescription generation mechanism based on objective physiological signals, hindering dynamic adaptation to individuals, times, and scenarios. Existing brain-computer interface (BCI) systems are primarily used for external device control (e.g., robotic arm manipulation, character input), rarely incorporating real-time changes in EEG signals as a basis for adjusting music intervention parameters. Some music intervention systems with feedback capabilities typically employ multi-channel (8 channels or more) medical-grade EEG acquisition equipment, which is costly, complex to wear, and has a high barrier to entry, making it difficult to promote in homes and everyday settings. When using only single-channel consumer-grade EEG acquisition, existing systems generally suffer from insufficient feedback reliability and high misadjustment rates due to signal interference from factors such as electromyography artifacts, motor artifacts, and poor electrode contact, failing to form a robust closed-loop intervention. Current music therapy mainly relies on subjective self-rating scales (such as the Self-Rating Anxiety Scale and Visual Analogue Scale) to evaluate efficacy, lacking a quantitative evaluation system based on objective physiological indicators such as EEG frequency band energy and state index. Furthermore, the intervention strategies of existing systems are mostly based on fixed parameter presets and do not have the ability to learn and optimize prescription strategies from historical conversation data, resulting in the system's inability to continuously improve personalized adaptation effects with the increase in the number of uses. Summary of the Invention

[0004] The purpose of this invention is to provide an adaptive brain-computer interface method and system based on frequency prescriptions of intangible cultural heritage ancient music, so as to solve the problems mentioned in the background art, such as the lack of quantitative generation methods for personalized prescriptions, the inability to achieve real-time closed-loop feedback adjustment based on single-channel EEG, and the lack of objective engineering indicators for efficacy evaluation.

[0005] To achieve the above objectives, the present invention adopts the following technical solution: According to one aspect of the present invention, an adaptive brain-computer interface method based on frequency prescriptions of intangible cultural heritage ancient music is provided, the method comprising: Collect users' brainwave signals and extract brainwave state features to obtain intangible cultural heritage ancient music audio data and ancient music features, wherein the ancient music features include at least one of spectrum features, rhythm features, mode features, timbre features, five-tone tags or prescription tags; Based on the user's target state, the EEG state characteristics, and the ancient music characteristics, a prescription object containing prescription music parameters is generated. Prescription music is output to the user based on the prescription object, and the user's EEG signals are continuously or intermittently collected during the output process. Based on the difference between the real-time or phased collected EEG state and the user's target state, the parameters in the prescription object are adaptively adjusted. When the preset end or pause conditions are met, the prescription output is stopped or paused, and session state information and prescription execution records are generated.

[0006] Based on the aforementioned scheme, the process of collecting the user's EEG signals and extracting EEG state features includes: EEG signals are acquired using a three-electrode single-channel EEG acquisition structure, wherein the three electrodes include an effective EEG electrode, a reference electrode, and a ground electrode. The EEG signal is preprocessed, and the preprocessing includes at least one of bandpass filtering, notch filtering and wavelet thresholding denoising. Artifact detection is performed on the preprocessed EEG signals, and signal windows that meet the artifact criteria are marked as invalid windows and are not included in the EEG state feature extraction. The effective signal window is subjected to spectrum estimation using the Welch method, and at least one of the following is extracted as the EEG state feature: Delta, Theta, Alpha, Beta, Gamma band energy, EEG dominant frequency, band ratio, and state index.

[0007] Based on the aforementioned scheme, the acquisition of intangible cultural heritage ancient music audio data and ancient music characteristics includes: Resampling and loudness normalization were performed on the audio of intangible cultural heritage ancient music; Extract spectral features, rhythmic features, modal features, or timbre features of audio by at least one of short-time Fourier transform, constant Q transform, chroma feature extraction, fundamental frequency estimation, or nonnegative matrix factorization. Based on pentatonic scale template matching, the probability vector of audio segments belonging to Gong, Shang, Jiao, Zhi, and Yu is calculated to generate the five-tone tags.

[0008] Based on the aforementioned scheme, the prescription object also includes playback duration, volume range, mixing ratio, binaural beat difference frequency, modulation depth, and feedback adjustment rules; The prescription music includes four types of tracks: monarch, minister, assistant, and envoy. The proportion of the four types of tracks is adaptively adjusted according to the difference between the user's target state and the current EEG state, and the proportion of each track varies within a preset upper and lower limit range.

[0009] Based on the aforementioned scheme, while outputting prescription music to the user according to the prescription object, at least one of the auxiliary sensory outputs, namely olfactory interaction signal, visual interaction signal or tactile interaction signal, is also output. The olfactory interaction signals include the type of aromatherapy, release rate, release duration, and release interval; The visual interaction signals include light color, brightness, flashing frequency, and breathing light cycle; The tactile interaction signal includes vibration frequency, vibration intensity, vibration envelope, and working duration; The prescription music and the auxiliary sensory output are output in tandem within a preset synchronization threshold via session timestamps.

[0010] Based on the aforementioned scheme, the adaptive adjustment of the parameters in the prescription object includes: Calculate the deviation and trend between the current EEG state and the user's target state; A tiered adjustment mechanism is adopted, with parameter adjustments executed sequentially according to the priority of Level 1, Level 2, and Level 3 adjustments. The first-level adjustments include adjusting volume, fade-in / fade-out time, and mixing ratio. The secondary adjustment includes adjusting the binaural beat difference frequency, modulation depth, and rhythm density; The three-level adjustment includes switching track segments, changing seed sounds, changing aromatherapy types, switching light rhythm modes, or changing vibration modes. When multiple consecutive feedback windows fail to reach the target state, adjust them step by step in order from level one to level three.

[0011] Based on the aforementioned scheme, the adaptive adjustment is limited by the security constraint layer; The safety constraint layer includes a sound pressure safety threshold, a single adjustment limit, and rules for prohibiting actions. The sound pressure safety threshold includes a preset comfortable playback sound pressure range and a preset peak sound pressure upper limit; The single adjustment limit includes: limiting the single change in volume to a preset gradual step size, limiting the single change in binaural beat frequency difference to a preset frequency adjustment step size, and limiting the single change in modulation depth to a preset modulation adjustment step size. Enhanced adjustment actions are prohibited when users report discomfort, the faker rate exceeds the preset threshold, or the target state has been met. When a security constraint is triggered, the system enters a security hold state, allowing only fade-out, de-intensity, or session termination operations.

[0012] According to another aspect of the present invention, an adaptive brain-computer interface system based on frequency prescriptions of intangible cultural heritage ancient music is provided, the system comprising: The EEG signal acquisition module is used to acquire the user's EEG signals and output preprocessed EEG data; The EEG state recognition module is used to extract EEG state features from the EEG data; The Intangible Cultural Heritage Ancient Music Feature Library Module is used to store audio data of intangible cultural heritage ancient music and its ancient music features, wherein the ancient music features include at least one of spectrum features, rhythm features, mode features, timbre features, pentatonic tags or prescription tags; The prescription generation module is used to generate a prescription object containing prescription music parameters based on the user's target state, the EEG state characteristics, and the ancient music characteristics. An interactive output module is used to output prescription music to the user based on the prescription object; A closed-loop feedback module is used to adaptively adjust the parameters in the prescription object based on the difference between the real-time or phased collected EEG state and the user's target state. The session management module is used to determine preset end or pause conditions, and stop or pause prescription output when the conditions are met, as well as generate session status information or prescription execution records.

[0013] Based on the aforementioned scheme, the EEG signal acquisition module is a three-electrode single-channel EEG acquisition module, including an effective EEG electrode, a reference electrode, a ground electrode, an analog-to-digital conversion unit, and an impedance detection unit; The effective EEG electrodes are positioned at FP1 or FP2 on the forehead, while the reference electrode and ground electrode are positioned in the non-hair area. The effective EEG electrode is a silver chloride dry electrode or a flexible electrode. The impedance detection unit is used to continuously monitor the electrode contact impedance during the acquisition process, and generates a prompt signal when the impedance exceeds a preset threshold.

[0014] Based on the aforementioned solution, the interactive output module further includes at least one of the following auxiliary output units: The olfactory output unit, including an aroma capsule chamber, a micropump or micropore array control unit, is used to control the type of aroma, release rate and release interval according to the prescription target; The visual output unit includes an RGB LED light group for controlling the color, brightness, and breathing cycle of the light according to the prescription object; The tactile output unit, including a linear resonant motor or a piezoelectric vibrator, is used to control the vibration frequency, vibration intensity, and vibration envelope according to the prescription object; The prescription music and the output signal of the auxiliary output unit are output in tandem within a preset synchronization threshold through a session timestamp.

[0015] As can be seen from the above technical solution, the present invention has at least the following advantages and positive effects compared with the prior art: The present invention establishes an audio feature library of intangible cultural heritage ancient music, and utilizes digital signal processing methods such as short-time Fourier transform, constant Q transform, Chroma feature extraction, fundamental frequency estimation, and pentatonic scale template matching to transform the pitch, mode, spectrum, and rhythm characteristics of ethnic ancient music into quantifiable prescription parameters, which are then mapped and matched with the user's real-time EEG state. Compared with existing solutions that simply rely on general music libraries, the prescription music of the present invention has clear cultural roots and calculable frequency characteristics, ensuring the reproducibility and verifiability of the technical solution while achieving cultural inheritance. The use of a three-electrode single-channel EEG acquisition structure, with its coordinated layout of effective electrodes, reference electrodes, and ground electrodes, reduces hardware costs and wearing complexity while ensuring signal quality. Through a complete single-channel preprocessing link (bandpass filtering, notch filtering, wavelet threshold denoising) and a strict artifact detection and validity gating mechanism (ValidWindow marker), interference from electromyography, motor, and poor contact is effectively eliminated, significantly improving the reliability of single-channel EEG closed-loop feedback. This system employs a decision-making architecture that integrates rule-based constraints with machine learning (or reinforcement learning) models. The rule base ensures basic security and timely response, while the learning model continuously optimizes decision-making strategies based on historical valid session samples (with differentiated sample weights assigned according to the termination reason encoding). This allows prescription strategies across multiple devices to achieve collective evolution without disclosing users' original EEG data, and the system's personalized adaptation capabilities continuously improve as the scale of use expands. In addition to auditory prescription music, three auxiliary interaction channels can be optionally integrated: olfactory (controlled release of hidden aromatherapy), visual (RGB LED light rhythm), and tactile (vibration frequency and envelope guidance). Millisecond-level synchronous output of multi-channel signals is achieved through a unified session timestamp. Compared to single auditory stimulation, the synergy of these four senses creates a more immersive intervention environment, improving user compliance and state guidance efficiency. By integrating celestial parameters (time rhythm and daily cycle), terrestrial parameters (usage scenarios and environmental labels), and human parameters (individual EEG fingerprints and TCM constitution labels), an initial prescription object with a personalized basis can be generated before the user generates any feedback data. By mapping the EEG fingerprint feature vector with the TCM constitution classification model, a calculable correlation is established between traditional TCM constitution theory and modern electroencephalographic signals, providing an initialization strategy with cultural characteristics and physiological basis for the personalized selection of prescriptions for intangible cultural heritage ancient music.

[0016] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit the invention. Attached Figure Description

[0017] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention. It is obvious that the drawings described below are merely some embodiments of the invention, and those skilled in the art can obtain other drawings based on these drawings without any inventive effort. In the drawings: Figure 1 This is a schematic diagram of an adaptive brain-computer interface method based on frequency prescriptions of intangible cultural heritage ancient music according to the present invention; Figure 2 This is a flowchart illustrating an adaptive brain-computer interface method based on frequency prescriptions of intangible cultural heritage ancient music, according to the present invention. Detailed Implementation

[0018] To more clearly illustrate the purpose, technical solutions, and advantages of the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. The exemplary embodiments can be implemented in many forms and should not be construed as limited to the examples set forth herein. On the contrary, these embodiments are provided so that the present invention will be more comprehensive and complete, and fully convey the concept of the exemplary embodiments to those skilled in the art.

[0019] Furthermore, the described features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. Numerous specific details are provided in the following description to give a full understanding of embodiments of the invention. However, those skilled in the art will recognize that the technical solutions of the invention can be practiced without one or more of the specific details, or other methods, components, apparatuses, steps, etc., can be employed. In other instances, well-known methods, apparatuses, implementations, or operations are not shown or described in detail to avoid obscuring various aspects of the invention.

[0020] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities can be implemented in software, in one or more hardware modules or integrated circuits, or in different network and / or processor devices and / or microcontroller devices.

[0021] The flowcharts shown in the accompanying drawings are merely illustrative and do not necessarily include all content and operations / steps, nor do they necessarily have to be performed in the described order. For example, some operations / steps can be broken down, while others can be combined or partially combined; therefore, the actual execution order may change depending on the specific circumstances.

[0022] The present invention will now be described in detail with reference to specific embodiments.

[0023] Example 1

[0024] like Figure 1 , 2 As shown in the figure, this embodiment provides an adaptive brain-computer interface method based on frequency prescriptions of intangible cultural heritage ancient music. The specific steps of the method are as follows: S1: Collect the user's EEG signal and extract EEG state features to obtain intangible cultural heritage ancient music audio data and ancient music features, wherein the ancient music features include at least one of spectrum features, rhythm features, mode features, timbre features, five-tone tags or emotional tags.

[0025] In this embodiment, the user's current electroencephalographic state information and the audio feature information of the intangible cultural heritage ancient music to be invoked are obtained to provide input data for subsequent prescription generation; it includes two sub-steps: electroencephalogram signal acquisition and processing and ancient music feature acquisition. The two are independent of each other in execution sequence and can be executed in parallel or sequentially.

[0026] S1.1: EEG signal acquisition and EEG state feature extraction.

[0027] A wearable EEG acquisition device is used to collect the user's EEG signals. The wearable EEG acquisition device is preferably a headband structure, including at least one effective EEG electrode, one reference electrode, and one ground electrode, forming a three-electrode single-channel EEG acquisition structure. The effective EEG electrode is positioned at the FP1 or FP2 position on the user's forehead (i.e., the left and right sides of the prefrontal cortex). The reference electrode and ground electrode are positioned in non-hair areas such as the mastoid process behind the ear or above the brow ridge, respectively, to provide a stable reference potential and suppress common-mode noise. The effective EEG electrode is preferably a silver chloride (Ag / AgCl) dry electrode or a flexible electrode, which can form good contact with the skin without the need for conductive gel. Furthermore, the EEG acquisition device has a built-in analog-to-digital conversion unit with a sampling rate set from 125Hz to 1000Hz, preferably 250Hz. The digital EEG signal output from the analog-to-digital conversion unit undergoes preliminary anti-aliasing filtering by a built-in hardware filtering unit, and is then transmitted in real-time via a wireless communication unit to a local terminal device (such as a smartphone, tablet, or the main control chip built into the headband) for further processing. The EEG acquisition device preferably includes an impedance detection unit, which is used to continuously monitor the contact impedance between each electrode and the skin before and during acquisition. When the impedance exceeds a preset threshold, a prompt message is generated to ensure signal quality.

[0028] After acquiring a valid EEG digital signal, preprocessing is performed to remove power frequency interference, baseline drift, EMG noise, and random pulse artifacts introduced during the acquisition process. Specifically, preprocessing includes at least one of the following steps, which can be combined in any order: 1) Centering: The mean of the original EEG signal is subtracted to make the signal mean zero, eliminating the DC bias component. 2) Bandpass filtering: A digital bandpass filter (preferably an infinite impulse response (IIR) filter or a finite impulse response (FIR) filter) is used, with a passband frequency range of 0.5Hz to 45Hz, to retain the main EEG frequency bands (Delta, Theta, Alpha, Beta, Gamma) while filtering out ultra-low frequency drift and high-frequency environmental noise. 3) Notch filtering: An IIR notch filter is used, with a notch center frequency of 50Hz or 60Hz (selected according to the local power grid frequency), and a quality factor Q value set to 20 to 40 (preferably 30) to effectively suppress power frequency interference without significantly affecting adjacent frequency bands. 4) Wavelet thresholding denoising. The signal is decomposed into 4 or 5 layers using the db4 wavelet basis function. The detail coefficients are shrunk using soft or hard thresholding methods, and then the signal is reconstructed to effectively remove broadband noise such as electromyography.

[0029] To further ensure the reliability of feature extraction, artifact detection is performed on the preprocessed EEG signal. A sliding window approach is used to segment the signal, with each window length corresponding to the frame length of subsequent spectrum estimation (e.g., 2 to 4 seconds). For each window, at least one of the following artifact detection indices is calculated: 1) Amplitude threshold criterion: If the peak-to-peak value of the signal within the window exceeds a preset amplitude threshold (preferably ±100μV to ±200μV), the window is determined to be an artifact window. 2) Short-time energy mutation criterion: The short-time energy of the signal within the window is calculated; if the energy ratio between adjacent windows exceeds a preset multiple threshold (e.g., 3 to 5 times), it is determined to be a mutation artifact. 3) Spectral entropy anomaly criterion: The spectral entropy of the signal power spectrum within the window is calculated; if the spectral entropy is lower than a preset lower threshold or higher than a preset upper threshold, it is determined to be abnormal noise or motion artifact. 4) High-frequency electromyography (EMG) energy ratio criterion: Calculate the proportion of energy in the 15Hz to 45Hz high-frequency band to the total energy (0.5Hz to 45Hz). If this proportion exceeds a preset threshold (e.g., 40%), it is considered an EMG contamination window. 5) Electrode contact quality criterion: Based on the impedance value returned by the impedance detection unit, if the impedance continuously exceeds a preset threshold, the signal for that period is considered invalid. Signal segments identified as artifact windows or invalid windows are marked as invalid data windows (ValidWindow=0) and do not participate in subsequent EEG state feature extraction and prescription adjustment decisions.

[0030] For the preprocessed and unmarked valid EEG signal window, spectral analysis is performed to extract frequency domain features. Preferably, the Welch method (modified periodogram averaging) is used for power spectral density estimation. The specific parameters are set as follows: each valid window signal is further segmented, with each segment having 512 sampling points. The Hamming window is used as the window function, with an overlap rate of 50%. After windowing each segment, a Fast Fourier Transform (FFT) is performed with 512 FFT points, or zero-padded to 1024 points to improve spectral resolution. Finally, the power spectra of each segment are averaged to obtain a smooth power spectral density estimation result. Based on the spectral estimation results, EEG state features were extracted, including: EEG frequency band energy (absolute power), with the power spectrum integral values ​​calculated for the Delta band (0.5Hz to 4Hz), Theta band (4Hz to 8Hz), Alpha band (8Hz to 13Hz), Beta band (13Hz to 30Hz), and Gamma band (30Hz to 45Hz or 30Hz to 100Hz) as the absolute energy features of each band; and the dominant EEG frequency, searching for the frequency with the highest power spectral density within the 1Hz to 45Hz range. The frequency value corresponding to the largest value is used as the dominant EEG frequency (f_dom) of the current window; the frequency band ratio is calculated by comparing the energy ratios between different frequency bands, including the Alpha / Theta ratio, Beta / Alpha ratio, Alpha / (Theta+Beta) ratio, and (Alpha+Beta) / Gamma ratio, to reflect the relative dominance of EEG rhythms; the state index is a comprehensive state index generated according to a preset weighted calculation model, which includes at least one of the relaxation index, focus index, and stress index. Specifically, in this embodiment, the relaxation index is: Relax = (Alpha power / (Theta power + Beta power)) × normalization coefficient; the focus index is: Focus = ((Beta power + Gamma power) / (Alpha power + Theta power)) × normalization coefficient; and the stress index is: Stress = (Beta power / Alpha power) × normalization coefficient. After normalization to historical baselines or group statistics, each index is output as a dimensionless value between 0 and 100, or as a percentage change relative to the user's own baseline.

[0031] S1.2: Acquisition of audio data of intangible cultural heritage ancient music and extraction of ancient music features.

[0032] The system has a built-in or network-accessible database of audio features of intangible cultural heritage ancient music. This database stores digitized audio files of various ethnic ancient music pieces, prescription audio fragments derived from these pieces, and corresponding metadata. The audio files originate from, but are not limited to, copyrighted works of ancient music from 79 ethnic groups and over 2,000 ethnic vocal data entries in the Xinbuluo Intangible Cultural Heritage Ancient Music Database. During initialization, the system loads the audio feature information from the database into a local cache or cloud-based feature service. When a prescription is generated, it is retrieved and accessed using the piece's identifier (ID) or prescription tag.

[0033] For each acquired audio segment of intangible cultural heritage ancient music, preprocessing was performed before feature extraction to ensure feature consistency and comparability. Preprocessing included: resampling all audio segments to a preset sampling rate (e.g., 44100Hz or 22050Hz) to ensure consistent frequency resolution in the spectral analysis; normalizing the perceived loudness of the audio to a preset target loudness range (e.g., -23 LUFS) according to ITU-R BS.1770 or EBU R128 standards to avoid volume differences affecting feature extraction; detecting silence or low-energy segments in the audio (e.g., RMS energy below a preset threshold and lasting for more than 500ms) and removing them from the analysis to ensure the representativeness of the effective audio content.

[0034] For the preprocessed audio signal, perform time-frequency analysis and music feature extraction, including at least one of the following methods: 1) Short-Time Fourier Transform (STFT). Audio is framed and windowed using a preset window length (preferably 2048 to 4096 points) and hop length (preferably 512 to 1024 points) to obtain the time-frequency spectrum. Based on this, low-level acoustic features such as spectral centroid, spectral bandwidth, spectral roll-off, spectral flux, and RMS energy are extracted. Specifically, the spectral centroid reflects the brightness of the timbre, the spectral bandwidth reflects the degree of spectral dispersion, the spectral roll-off reflects the high-frequency energy distribution, the spectral flux reflects the rate of spectral change, and the RMS energy reflects the loudness envelope.

[0035] 2) Constant Q Transform (CQT). The constant Q transform is used to extract the spectral characteristics of audio. The frequency resolution of CQT decreases as the frequency increases, which is more in line with the characteristics of human auditory perception and can accurately extract the energy distribution of each tone level.

[0036] 3) Chroma feature extraction. Based on the CQT or STFT results, the spectral energy is mapped onto 12 semitone levels (C, C, D, ..., B) to obtain the chroma vector. This vector is robust to changes in timbre and intensity and can effectively represent the harmonic and tonal information of music.

[0037] 4) Fundamental frequency estimation. The fundamental frequency (f0) of the audio segment is estimated by autocorrelation, cepstral method or harmonic product spectrum method, and the overtone series information is further extracted to identify the tonic or seed frequency of the segment.

[0038] 5) Nonnegative matrix factorization (NMF). The time-frequency spectrum of the audio is decomposed using nonnegative matrix factorization to separate harmonic and percussion components, extract physically meaningful frequency atoms, and screen the peak frequencies with concentrated energy as potential seed tone candidate frequencies.

[0039] 6) Pentatonic scale template matching. The extracted Chroma or CQT feature vectors are compared with the five preset pentatonic scale templates (Gong, Shang, Jiao, Zhi, Yu) to calculate the similarity. The scores of the five templates are processed by Softmax or normalization function to generate a pentatonic probability vector P5=[PGong,PShang,PJiao,PZhi,PYu], where each component represents the probability of the audio segment belonging to the corresponding pentatonic mode.

[0040] Furthermore, the extracted audio features are associated and stored with pre-defined prescription tags. Prescription tags include: a pentatonic scale tag, which uses the pentatonic scale corresponding to the highest probability component in the pentatonic scale probability vector as the main tag for the audio segment; ethnic and instrument categories, recording the ethnic origin and main instrument played by the audio; seed frequency tags, marking the extracted fundamental frequency or harmonic peak frequency as the seed frequency of the segment and associating it with the corresponding brainwave frequency band (e.g., 528Hz associated with the Alpha band guide tag, 396Hz associated with the Theta band guide tag, etc.); and emotion tags, assigning emotion annotations to each seed sound based on a valence-arousal two-dimensional emotion model. Specifically, through expert annotation or a pre-trained emotion classification model, the coordinate values ​​of the audio segment in the valence dimension (range -1.0 to +1.0, negative values ​​indicate negativity, positive values ​​indicate positivity) and the arousal dimension (range 0.0 to 1.0, 0.0 indicates calmness, 1.0 indicates excitement) are determined, and these coordinate values ​​are stored as emotion tags. When generating subsequent prescriptions, the prescription engine prioritizes seed sounds whose emotional tags complement the current user's emotional state.

[0041] After the above processing, each segment of intangible cultural heritage ancient music audio or its derived fragments are converted into a structured ancient music feature vector. The ancient music feature vector includes spectral features, rhythmic features (such as BPM tempo and onset density), modal features (pentatonic probability vector), timbre features (spectral centroid and spectral bandwidth), and prescription tags (pentatonic tags, seed frequency, and emotional tags). This feature vector is associated with the storage path of the original audio file or the track ID, and serves as input data that can be retrieved and calculated by the prescription decision module.

[0042] At the end of the data preparation step, the EEG state feature sequence of the current acquisition window and the invoked ancient music feature vector are stored in the session buffer, with a timestamp or window number appended. If it is the first prescription generation, the initial prescription object will be generated in subsequent prescription generation steps using the currently obtained initial EEG state features (such as baseline detection results) and initial ancient music features (such as the default seed tone set); if it is a loop iteration in the closed-loop feedback process, the current EEG state features are time-aligned with the ancient music features used in the previous prescription object as dynamic input for prescription adjustment decisions.

[0043] S2: Based on the user's target state, the EEG state characteristics, and the ancient music characteristics, generate a prescription object containing prescription music parameters, output prescription music to the user based on the prescription object, and continuously or intermittently collect the user's EEG signals during the output process.

[0044] In this embodiment, based on the user's EEG state characteristics, intangible cultural heritage ancient music characteristics, and the user's preset target state provided in step S1, a quantifiable parameterized prescription object is generated, and multi-sensory interactive signals are output to the user according to the prescription object. During the output process, the user's EEG signals are continuously or intermittently collected to provide real-time basis for subsequent closed-loop feedback adjustment.

[0045] S2.1: Target state acquisition and prescription initialization.

[0046] First, the user's target state is obtained. The target state represents the electroencephalographic or subjective feeling state that the user expects to achieve through this prescription intervention. The target state is obtained through at least one of the following methods: 1) User-selected intervention target type. The intervention target type is received through the human-computer interaction interface (such as a mobile application or physical buttons / touch panel on the headband device). The intervention target type includes, but is not limited to, relaxation and sleep aid, anxiety relief, focus improvement, deep meditation training, motor function assistance, and mood regulation.

[0047] 2) Automatic scene recognition. The system automatically determines the target state based on the current usage scenario. For example, it can identify the period from 10:00 PM to 6:00 AM the next day through clock and circadian rhythm parameters and automatically set it as a sleep aid target. It can also identify a gym or training venue through GPS or indoor positioning information and automatically set it as a focus training target.

[0048] 3) Historical Preference Inference. The system reads the user's historical prescription execution records, analyzes the user's most frequently selected target types over different time periods, and makes intelligent recommendations or automatically sets them based on the current time context.

[0049] 4) Input of self-report scales. Standardized self-report scales, such as the Self-Rating Anxiety Scale (SAS), the Positive Mood State Scale (POMS), or the Visual Analogue Scale (VAS), are presented through an interactive interface. Recommended target frequency bands and state index thresholds are calculated based on the scale scores entered by the user.

[0050] Furthermore, the target state is quantified into specific electroencephalographic indicators, including at least one of the following: the absolute power value of the target frequency band (e.g., target alpha power ≥ 10.0 μV). 2 The target frequency band relative power ratio (e.g., Beta / Alpha ratio ≤ 1.3), target state index value (e.g., relaxation ≥ 70 / 100, focus ≥ 65 / 100), or target EEG frequency range (e.g., frequency between 8Hz and 12Hz).

[0051] Before generating a prescription object, a three-dimensional prescription initialization step is performed to integrate multi-dimensional contextual information, making the initial prescription more closely match the user's current state and environmental conditions. Specifically, for collecting Tianwei parameters, the current time is obtained through the system clock and combined with the user's preset schedule or historical usage patterns to generate Tianwei status tags. Tianwei status tags include morning wake-up tags (5:00 to 9:00), daytime work tags (9:00 to 17:00), evening relaxation tags (17:00 to 22:00), and nighttime sleep aid tags (22:00 to 5:00 the next day). Different Tianwei tags correspond to different default prescription templates. For example, the morning wake-up tag defaults to a Beta band enhanced prescription, and the nighttime sleep aid tag defaults to a Delta and Theta band enhanced prescription. The Tianwei parameters also include light intensity information. If the system integrates an ambient light sensor, it collects the current ambient light intensity (in lux). When the light intensity is higher than the threshold (e.g., >500 lux), it tends to select an active prescription, and when the light intensity is lower than the threshold, it tends to select a relaxing prescription.

[0052] For collecting ground-based parameters, the current usage scenario or environmental tag is obtained through at least one of the following methods: manual user input, GPS positioning, Wi-Fi fingerprinting, or Bluetooth beacon. Environmental tags include home environment, office environment, medical and health care environment, and outdoor sports environment. Different environmental tags correspond to different usage constraints. For example, in a home environment, multi-sensory full-function output is allowed; in an office environment, the concentration and volume of aromatherapy release are limited to avoid disturbing others; and in a medical and health care environment, stricter safety thresholds and more detailed prescription execution records are enabled.

[0053] For human-dimensional parameter acquisition, a resting baseline EEG test is performed for 1 to 5 minutes, with 3 minutes being the preferred duration. During the baseline test, the user remains seated with eyes closed while the EEG signal is acquired and processed to extract the individual EEG fingerprint feature vector. The individual EEG fingerprint feature vector includes at least one of the following: baseline power values ​​for five frequency bands (Delta, Theta, Alpha, Beta, Gamma), Alpha / Theta ratio, SMR (sensory-motor rhythm, 12Hz to 15Hz) power, EEG dominant frequency (f_dom), Alpha stability (i.e., the reciprocal of the coefficient of variation of Alpha band power during the baseline period), and artifact rate (the proportion of the artifact window to the total window). The individual EEG fingerprint serves as the user's physiological identity and status reference benchmark, used for subsequent personalized prescription parameter customization and baseline comparison for efficacy evaluation.

[0054] Optionally, a user's TCM constitution label or user status label is generated based on the individual's EEG fingerprint feature vector. Specifically, the EEG fingerprint feature vector is input into a pre-trained classification model. The classification model employs at least one of the following: rule-based model, support vector machine, decision tree, neural network, Bayesian model, or clustering model. It outputs at least one constitution label and its probability weight from the following categories: balanced constitution, qi deficiency constitution, yang deficiency constitution, yin deficiency constitution, phlegm-dampness constitution, damp-heat constitution, blood stasis constitution, qi stagnation constitution, and special constitution. Different constitution labels correspond to different sets of seed sounds for prescription and incense type priorities. For example, yin deficiency constitution is matched with yin-tongued, moistening seed sounds (such as low-frequency, slow-rhythm Gong and Yu tones in ancient music) and calming incense such as sandalwood and vetiver. Qi stagnation constitution is matched with expansive, bright seed sounds (such as Jiao and Zhi tones in ancient music) and qi-boosting incense such as bergamot and sweet orange.

[0055] The parameters of the heaven, earth, and human dimensions are integrated into the prescription initial vector, which is input into the prescription decision module as the initial state prior, so that the prescription generation step can generate an initial prescription with a personalized basis before any feedback data is available.

[0056] S2.2: Generation of prescription objects.

[0057] Seed sounds and prescription music fragments are selected based on the target state, current EEG characteristics, and a database of ancient Chinese music features. A mapping relationship is established between seed sound frequencies, ancient Chinese music audio features, and target brainwave frequency bands. This mapping relationship includes: fundamental frequency matching: calculating the fundamental frequency f0 of the ancient Chinese music audio; if f0 falls within the harmonic coverage range of the target frequency band (e.g., the target is the Delta band), then seed sounds with rich low-frequency overtones such as 66Hz, 88Hz, and 132Hz are selected, and the ancient Chinese music fragment is marked as a candidate; and frequency band center frequency matching: calculating the centroid frequency of the power spectrum of the ancient Chinese music fragment; if the centroid frequency is close to the center frequency of the target frequency band (e.g., the Alpha band target is 10Hz), then seed sounds with centroid frequencies in the range of 8Hz to 13Hz are selected. Consonants are marked as candidates; historical feedback weighting reads the user's historical sessions and the response effects to different seed sounds (such as the target frequency band power increase), assigning higher priority weights to seed sounds with better effects; emotional complementarity matching calculates the emotional distance between the user's current emotional state (which can be inferred from the alpha asymmetry or beta / alpha ratio in EEG features) and the ancient music emotional label based on the extracted valence-arousal emotional label, prioritizing the selection of ancient music fragments whose emotional labels are complementary to the current emotional state (e.g., selecting positive valence seed sounds when valence is low, and selecting low arousal seed sounds when arousal is high). Through this matching mechanism, N candidate seed sounds (N is a preset value, preferably 3 to 10) are selected from the intangible cultural heritage ancient music feature library and sorted from high to low according to the comprehensive matching score.

[0058] Based on the target state and EEG characteristics, the selected seed sounds and ancient music fragments are classified and adaptively configured into four categories: principal sounds, assistant sounds, adjuvant sounds, and auxiliary sounds. The proportion of each sound track varies within a preset upper and lower limit. The classification is based on the functional weight and characteristic parameters of each fragment, including: principal sounds (main music) consisting of 1 to 2 seed sound fragments that play the main therapeutic role, whose frequency layer directly corresponds to the target enhancement frequency band (e.g., if the target is Delta enhancement, then the principal sound selects the seed sound with the highest Delta weight). The principal sound track accounts for 60% to 70% of the total prescription duration, and the playback volume is set to the higher end of the baseline volume range; assistant sounds (auxiliary music) are auxiliary ancient music fragments used to enhance the therapeutic effect of principal sounds, whose frequency layer forms a harmonic relationship (such as octave or subharmonic relationship) or a rhythmic complementary relationship with principal sounds. The assistant sound track accounts for 60% to 70% of the total prescription duration. The first track comprises 20% to 30% of the total prescription duration, played at a volume slightly lower than the "Jun Yin" track. The second track (adjustment music) is used to adjust music segments that may cause discomfort or side effects from the "Jun Yin." For example, when the "Jun Yin" is a high-frequency stimulus, the "Zuo Yin" track selects a low-frequency soothing segment to balance the overall listening experience. The "Zuo Yin" track accounts for 10% to 15% of the total prescription duration, and its playback volume is set to a lower range. The third track (guide music) is used to guide the user into a state or to prompt transitions with short musical motifs or natural sound effects (such as crescendos to guide breathing, or bell sounds to prompt relaxation). The "Zuo Yin" track accounts for 5% to 10% of the total prescription duration and appears intermittently. The proportions of these four types of tracks can adaptively change within preset upper and lower limits. The specific proportions are normalized, limited, or smoothed based on at least one of the following: the difference between the target state index and the current state index, user historical feedback, and audio feature matching score. When the current state index differs significantly from the target state index, the proportion of the "ruler's voice" should be increased (raised to nearly 70%) to enhance the effectiveness of the main intervention. As the gap gradually narrows, the proportion of the "ruler's voice" should be gradually reduced while the proportions of the "minister's voice" and "assistant voice" should be increased to achieve a smooth transition.

[0059] After determining the audio track selection and proportions, a frequency guiding layer is further synthesized. The frequency guiding layer includes at least one of binaural beats, amplitude-modulated tone, and a background continuous tone (drone layer). For the binaural beat layer, two carrier frequencies with slightly different frequencies are sent to the user's left and right ears respectively (the carrier frequencies are selected within the range of 250Hz to 1000Hz, preferably 300Hz to 500Hz). The frequency difference between the two ears is set to the center frequency of the target brainwave band (for example, if the target is alpha enhancement, the frequency difference is set to 10Hz; if the target is delta enhancement, the frequency difference is set to 2Hz to 3Hz). The frequency difference can be adaptively fine-tuned based on real-time EEG spectrum analysis results, with a preferred fine-tuning step size of 0.5Hz / time. For the amplitude modulation layer, a carrier frequency tone is selected (preferably a pure tone or narrowband noise in the range of 200Hz to 800Hz), and its amplitude is sinusoidally modulated according to the frequency of the target brainwave band (e.g., if the target is Theta enhancement, the modulation frequency is 6Hz). The modulation depth (i.e., the relative amplitude of the amplitude change) is initially set to 0.3 to 0.5 and dynamically adjusted during the closed-loop feedback process. For the background continuous sound layer, one or more low-frequency continuous sounds (drones) are selected, and their fundamental frequency is set to the fundamental frequency or overtone frequency of the seed sound of intangible cultural heritage ancient music (e.g., 132Hz, 264Hz, etc.). They are played continuously and smoothly in the background to provide a stable frequency anchor point for the overall prescription music.

[0060] Encapsulate all decision results into a structured Prescription Object. The Prescription Object includes the following fields: prescription_id is the unique identifier of the prescription, which contains the generation timestamp and the hash value of the user's anonymous ID; target_state is the target state parameter, including the target frequency band, target power threshold, and target state index range; tracks is the audio track list with adjustable mixing ratio, and each audio track records the track ID or audio clip ID, pentatonic label, Monarch / Minister / Assistant / Guide classification, volume range (expressed in dBFS or LUFS), and fade in and fade out time (preferably 2 to 10 seconds); frequency_layers are frequency layer parameters, including the left / right carrier frequency of binaural beats, beat frequency, modulation depth, amplitude modulation frequency, and background sustained tone frequency; playback are playback control parameters, including the total treatment duration, that is, the playback duration (preferably 20 to 60 minutes), the default volume value and volume range, and the sound pressure safety threshold (default 45 to 65 dBA, with a peak not exceeding 80 dBA); multisensory are multisensory parameters, including the type and release rate of aromatherapy, light color and rhythm pattern, vibration frequency and intensity envelope (this field can be empty in the simplified embodiment with only audio output); feedback_rule is the feedback adjustment rule, including the EEG window length (preferably 2 to 4 seconds), adjustment period (preferably 5 to 15 seconds), and stop conditions (target achievement duration, maximum duration, etc.).

[0061] S2.3: Multisensory prescription output.

[0062] Play the prescription music to the user through the audio output device according to the audio parameters in the prescription object. The audio output device is preferably a headband-integrated near-ear speaker, a bone conduction speaker, or an external stereo headphone. During the playback process, the four audio tracks of Monarch, Minister, Assistant, and Guide as well as the frequency guidance layer are output through real-time synthesis or mixing, and the audio tracks are superimposed and output according to the preset volume ratio and fade in and fade out time. Preferably, the prescription music output adopts ancient music modulation layer technology, which takes the seed sound frequency, pentatonic label or audio feature of intangible cultural heritage ancient music as the modulation signal to perform amplitude modulation, frequency modulation, filtering modulation or time-sharing superposition on the carrier frequency, background audio track or mixing ratio. For example, taking the fundamental frequency 176Hz of the Miao ethnic Lusheng as the modulation signal to perform amplitude modulation on the 500Hz carrier frequency of the binaural beats, and the modulation depth is dynamically adjusted by the prescription decision module according to the current EEG state (the initial depth is 0.3, which varies within the range of 0.1 to 0.7), so as to form a frequency guidance output superimposed with ancient music features, so that the auditory perception not only retains the unique timbre of ancient music, but also embeds specific frequency guidance information.

[0063] Optionally, in the headband device embodiment equipped with an aroma release system, the aroma release is controlled according to the olfactory field in the prescription. The aroma release system includes at least one aroma capsule chamber, a micropore array or micropump control unit, and a corresponding air duct or heating unit. Specifically, according to the aroma type specified by the prescription (such as lavender, bergamot, rosemary, sandalwood, etc.), aroma molecules are extracted from the corresponding aroma capsule through a gate valve or micropump; the aroma release rate is controlled by the drive voltage or pulse width modulation (PWM) duty cycle of the micropump, with a release rate range of 0.1 to 2.0 micrograms per minute, preferably an initial release rate of 0.5 micrograms per minute; the release duration and release interval are specified by the playback field of the prescription, for example, continuous release for 10 minutes followed by a 2-minute interval, and then continued release; the air outlet of the aroma release system is preferably located on the forehead module or the behind-the-ear module of the headband, and adopts a hidden micropore design, with the air outlet direction directed towards the user's nasal area, in order to reduce environmental diffusion while ensuring user experience.

[0064] Optionally, in a headband device embodiment equipped with a light output unit, the light output is controlled according to the visual field in the prescription. The light output unit preferably consists of one or more RGB LED beads arranged in the forehead or side areas of the headband, and equipped with a diffuser to avoid glare. Specific control parameters include: light color selected according to the target state and prescription type, for example, warm yellow (color temperature 2700K) or amber for sleep aid mode, and cool white (color temperature 6500K) or light blue for focus mode; brightness set according to ambient light intensity and user sensitivity, with a brightness range of 1 to 100 lumens, defaulting to 10 to 50 lumens, and subject to a safety threshold; flashing frequency or breathing light cycle, in breathing light mode, the brightness changes according to a sinusoidal envelope cycle, with a cycle range of 2 to 10 seconds (e.g., 6 seconds for sleep aid, 2 seconds for focus mode); fade-in / fade-out time, the transition time for each change in light state, preferably 0.5 to 3 seconds, to avoid sudden changes causing user discomfort.

[0065] Optionally, in a headband device embodiment equipped with a vibration output unit, the vibration output is controlled according to the tactile field in the prescription. The vibration output unit is preferably a linear resonant motor or a piezoelectric vibrator, positioned at the point of contact between the headband and the skin (e.g., a forehead pad or a pad behind the ears). Control parameters include: a vibration frequency range of 30 to 200 Hz, for example, a 50 Hz sinusoidal vibration for a breathing guidance mode and a 110 Hz pulsed vibration for a focus beat cue; vibration intensity controlled by duty cycle or drive voltage amplitude, ranging from 0 to 100%, with a default intensity of 30% to 60%, subject to safety threshold constraints; a vibration envelope, outputting according to a sinusoidal, trapezoidal, or exponentially decaying envelope to match breathing rhythms or musical tempos; and operating duration and interval duration, such as an intermittent output mode with 10 seconds of vibration followed by a 5-second interval to avoid tactile adaptation.

[0066] In implementations that simultaneously enable multiple sensory output channels, synchronization of each output is achieved through session timestamps, a device-side monotonic clock, a hardware timer, or a software scheduler. Specifically, using the playback progress in the playback field of the prescription object as a time reference, the track playback position of the auditory channel, the release start time of the olfactory channel, the breathing light phase of the visual channel, and the vibration envelope phase of the tactile channel are aligned within a preset synchronization threshold range. The preset synchronization threshold is between 10 milliseconds and 1 second, preferably 100 milliseconds. The intensity of each interactive signal is adjusted using at least one of rule control, open-loop curve, feedback control, or PID control to ensure that the multi-sensory stimuli are coordinated in time, forming a unified interactive experience.

[0067] S2.4: Synchronous EEG acquisition during the output process.

[0068] While outputting multi-sensory interactive signals according to the prescription, the system continuously or intermittently collects the user's EEG signals to provide real-time input for subsequent closed-loop feedback adjustments. Specifically, EEG signals are continuously collected throughout the entire prescription output period (from the start of prescription playback to the end of the session), and EEG state characteristics are continuously calculated using a window sliding method (window length 2 to 4 seconds, sliding step size 0.5 to 1 second) to form a state characteristic time series. In implementations where system computing resources are limited or where it is necessary to reduce the user's wearing burden, EEG signals can be collected according to a preset intermittent period, for example, pausing playback for 3 seconds after every 5 minutes of music playback to collect a segment of EEG signal without music interference as an evaluation window, and then resuming playback after the collection is completed. In another implementation, the system keeps the music playing continuously, but triggers EEG feature calculation only once every 10 seconds. During the time period between two calculations, only signal buffering and artifact marking are performed, and full spectrum estimation is not performed. Each EEG data window, each prescription music playback progress update, each volume control command, each frequency layer parameter adjustment command, and each user interaction event (such as user pressing pause) are uniformly written to a local timestamp, and the session timeline is formed using a device-side monotonic clock. The EEG window and music prescription execution window are aligned with a synchronization error of no more than 100 milliseconds to ensure that the closed-loop feedback system can accurately attribute the EEG state at a given moment to the corresponding combination of prescription parameters, providing a reliable time anchor for subsequent prescription adjustment decisions and efficacy attribution analysis. During the acquisition process, the validity flag ValidWindow for each EEG window is calculated in real time. A window is marked as invalid (ValidWindow=0) when any of the following occurs: loss of valid EEG channel data, artifact rate exceeding a preset threshold (preferably 20% to 30%), electrode impedance continuously exceeding 10 kΩ, abnormal user wearing status (such as headband displacement detection sensor triggering), abnormal audio playback link, or abnormal auxiliary interaction output link. Windows with ValidWindow=0 do not participate in the reward calculation for prescription adjustment decisions, nor do they trigger enhanced prescription adjustment actions; they only allow the system to enter a safe hold state or prompt the user to wear the device again. This gating mechanism ensures the quality of input data for closed-loop feedback and prevents erroneous adjustments due to signal contamination.

[0069] S3: Based on the difference between the real-time or phased collected EEG state and the user's target state, adaptively adjust the parameters in the prescription object, stop or pause prescription output when the preset end or pause conditions are met, and generate session state information and / or prescription execution record.

[0070] In this embodiment, during the multi-sensory prescription output process in step S2, at least one parameter in the prescription object is adaptively adjusted based on the difference between the user's EEG state collected in real time or in stages and the target state. The prescription output is stopped or paused when the preset end or pause conditions are met. At the same time, session state information and prescription execution records are generated for subsequent analysis and model optimization.

[0071] Before performing any adaptive adjustment, the validity of the EEG data and system state within the current feedback window is first verified to ensure that the input data upon which the adjustment decision is based is authentic and reliable. Specifically, validity is determined in units of fixed time windows (i.e., feedback windows). The duration of the feedback window corresponds to the spectral estimation window in step S1, preferably 2 to 4 seconds, and the sliding step size is preferably 0.5 to 1 second. For each feedback window, a validity flag (ValidWindow) is calculated. ValidWindow is set to 1 (valid) if and only if all of the following conditions are met; otherwise, it is set to 0 (invalid): 1) Signal integrity condition: The three-electrode single-channel EEG acquisition module has no data packet loss during the window period, and the data frames output by analog-to-digital conversion are continuous and have no CRC check errors. 2) Artifact rate condition: The proportion of artifact samples detected within the window to the total number of samples is lower than a preset threshold, which is preferably 25%. 3) Electrode contact quality conditions: The electrode contact impedance returned by the impedance detection unit remains below a preset threshold during the window period, preferably 5 kΩ; 4) Wearing conditions: The wear detection sensor built into the headband (such as a capacitive contact sensor or an infrared reflection sensor) continuously outputs a normal wearing signal during the window period, and no headband displacement or detachment occurs. 5) Device link conditions: The audio playback link and auxiliary interactive output link (such as aromatherapy, lighting, vibration control link) have no abnormal interruption or timeout response during the window period, and the signal strength indicator (RSSI) of the communication link (such as Bluetooth) is higher than the preset communication quality threshold.

[0072] A window with ValidWindow=1 is marked as a valid feedback window. Its EEG state features and corresponding prescription parameters together constitute a valid state-action-reward sample, which can be used for closed-loop adjustment decisions and subsequent model training. A window with ValidWindow=0 is marked as an invalid window. The system prohibits the prescription decision module from performing any enhanced prescription adjustment actions (i.e., increasing stimulus intensity, widening frequency difference, increasing output amplitude, etc.) based on this window. The system is only allowed to perform safety hold operations (maintaining the current parameters unchanged), intensity reduction operations, or prompting the user to put the device back on.

[0073] Furthermore, the proportion of valid windows is continuously counted. If the ValidWindow is 0 for N consecutive feedback windows (N is preferably 3 to 5), or if the proportion of valid windows is lower than a preset threshold (e.g., 50%) for a relatively long period of time (e.g., 30 seconds), it is determined that the current signal quality is seriously insufficient, and the session is automatically paused or put into a safe hold state. The user is then guided to check the electrode contact and device wearing status through the interactive interface or prompt tone.

[0074] For feedback windows marked as valid (ValidWindow=1), a closed-loop adjustment decision is executed, adjusting at least one parameter of the prescribed subject based on the difference between the current EEG state and the target state. First, the deviation between the current state index and the target state index is calculated. In this embodiment, the deviation (Δ) is calculated as follows: Δ = Current EEG state index value - User target state index value; when the target is to enhance a certain frequency band (e.g., enhance Alpha power): if Δ is positive and its absolute value is greater than a preset dead zone threshold (preferably ±5% of the target value), it indicates that the current state has reached or exceeded the target, and the system maintains or gradually reduces the intervention intensity; if Δ is negative and its absolute value is greater than the dead zone threshold, it indicates that the current state has not met the target, and the intervention intensity is increased.

[0075] Optionally, a sliding window trend analysis method is used to calculate the changing trend of the target frequency band power. Taking the current window as the center, the target frequency band power values ​​of 2 to 3 windows before and after are taken for linear regression or moving average, and the slope of change is calculated. If the slope of change of 3 consecutive effective feedback windows is positive and the cumulative positive amplitude exceeds a preset threshold (such as 5% of the target value), it is judged as a positive response; if the slope of change of 3 consecutive windows is negative, it is judged as a negative response; if the slope fluctuates around zero, it is judged as a stable response. The trend determination result is used to determine the adjustment direction (increase, maintain or decrease the intervention intensity) and the adjustment step size (decrease the step size to avoid overshoot in a positive response, and increase the step size or switch strategies in a negative response).

[0076] To avoid user discomfort caused by sudden parameter changes, a tiered adjustment mechanism is adopted. This mechanism divides adjustable actions into three levels based on their impact on user perception, with each level having different adjustment priorities and triggering conditions, including: Level 1 adjustment (fine-tuning) only adjusts volume, fade-in / fade-out time, and the mixing ratio between tracks. Level 1 adjustment has the least impact on the user's subjective perception and is the highest priority and most frequently executed adjustment level. Within a valid feedback window, if the deviation is within a small range, such as ±10% to ±20% of the target value, Level 1 adjustment is executed first. Single volume changes should not exceed 3dB (in sound pressure level), and single changes to the mixing ratio should not exceed 10% of the current ratio.

[0077] Level 2 adjustment (mid-tone) adjusts the binaural beat difference frequency, with a single change not exceeding 1 Hz; modulation depth, with a single change not exceeding 0.05, ranging from 0.1 to 0.7; tempo density, with a tempo change not exceeding ±5 BPM; and gain compensation for each frequency level. Level 2 adjustment is activated when the deviation has not converged to the dead zone after 2 to 3 consecutive Level 1 adjustments. Level 2 adjustment has a moderate impact on user perception and can more effectively guide changes in brainwave state while maintaining the overall auditory experience.

[0078] Level 3 adjustment (coarse adjustment) allows switching track segments, changing seed sounds, altering aromatherapy types, switching light rhythm modes, or changing vibration modes. Level 3 adjustment has a significant impact on user experience and should only be used in the following situations: If the deviation has not improved or has worsened after 3 to 5 consecutive Level 2 adjustments, or if the deviation exceeds ±50% of the target value. Before performing Level 3 adjustment, it is preferable to transition to the new parameters via a fade-out (FADE_OUT) for 5 to 10 seconds to avoid abrupt switching that may cause user alarm or discomfort.

[0079] When multiple consecutive feedback windows fail to reach the target state, adjustments are made step by step in order from level one to level three. When an adjustment at a certain level effectively reduces the deviation, fine-tuning is maintained at that level, and no further upward jumps are made. All adjustments at each level are subject to the safety constraints described later, and any adjustment action that may touch the safety boundary is prohibited from being executed.

[0080] Within the aforementioned grading framework, adjustable parameters include: audio parameters, such as the ID of the prescription music track or segment, playback volume of each track (in dBFS or dBA), the mixing ratio of the four tracks (the ratio varies within preset upper and lower limits, ensuring the sum of the four is 100%), the left and right ear carrier frequencies and their frequency difference in binaural beats, the modulation frequency and modulation depth of the amplitude modulation layer, the gain of the background continuous audio track, the overall playback speed (tempo), and the gain of each frequency band of the equalizer; olfactory parameters (such as those with aromatherapy release). The system includes: aromatherapy type switching, release rate (µg / min), release duration, and duty cycle of interval; visual parameters (e.g., with a light output unit), including light color (RGB components or color temperature), brightness (lumens or PWM duty cycle), flashing frequency or breathing light cycle, and fade-in / fade-out time; and tactile parameters (e.g., with a vibration output unit), including vibration frequency (Hz), vibration intensity (duty cycle or drive voltage amplitude), vibration envelope shape (sine, trapezoidal, pulse, etc.), working time, and interval. The adjustment range of all parameters is limited by a safety constraint layer, and a minimum adjustment interval (preferably 5 to 15 seconds) is set between two adjacent enhanced actions to avoid user discomfort or system oscillation caused by frequent switching.

[0081] Optionally, adaptive adjustment is performed by a reinforcement learning model or a machine learning model. Specifically, the reinforcement learning model uses the current EEG state features (band power, dominant frequency, state index, etc.) as the state input, an adjustable combination of parameters as the action space, and the change in target band power and user subjective feedback as the reward signal. It uses at least one of the following algorithms for decision-making: Deep Q-Network (DQN), Proximal Policy Optimization (PPO), or Soft Actor-Critic (SAC). Model inference is performed in real time on the device to maintain low latency in closed-loop feedback (total latency <500ms). Actions output by the learning model are only executed after being reviewed by a safety constraint layer. When the learning model's decision confidence is below a preset threshold (e.g., 0.6), the model version fails review, the current input features exceed the training data distribution range, or the user belongs to a sensitive group (e.g., minors, pregnant women, or people at risk of epilepsy), the enhanced adjustment actions output by the learning model are not executed, and the model automatically reverts to a preset rule base prescription. The rule base prescription only uses volume, beat, aromatherapy, lighting, and vibration parameters strictly limited by safety thresholds. By default, the learning decision model uses a freeze strategy (i.e., model weights do not change) combined with rule base safety constraints to perform online inference during a single session. After the session ends, effective session samples (sessions with a ValidWindow ratio higher than 60%) are updated offline. The updated strategy enters the candidate model pool, undergoes manual review or small-scale validation (e.g., deployment testing with 5% to 10% of users) before being deployed to online devices, ensuring the safety and reliability of the strategy update.

[0082] All adaptive adjustments are strictly limited by the Safety Constraint Layer. This layer, acting as a monitoring unit independent of the prescription decision module, pre-screens all actions to be performed, prohibiting any adjustments that may jeopardize user safety or comfort. The Safety Constraint Layer includes sound pressure safety thresholds, single adjustment limits, and rules for prohibiting certain actions.

[0083] Specifically, the sound pressure output of the auditory channel is constrained by the following sound pressure safety thresholds: the default playback sound pressure level is 45 to 65 dBA (A-weighted sound pressure level), which is set according to daily listening comfort; the peak sound pressure level of ordinary headphones or near-ear speaker devices does not exceed 80 dBA, and the hard upper limit does not exceed 85 dBA. Exceeding 85 dBA may cause hearing damage; when the user reports discomfort through the interactive interface, the artifact ratio suddenly exceeds the limit (such as the window artifact rate suddenly increasing from 10% to more than 50%), or the ambient background noise changes abruptly, the system will reduce the volume to a safe range or completely fade out the modulation layer within 5 to 45 seconds (preferably 10 seconds) in a smooth fade-out manner.

[0084] The single adjustment range limits for various parameters include: single volume changes are limited to a preset gradual change step size; single changes in binaural beat frequency difference are limited to a preset frequency adjustment step size; and single changes in modulation depth are limited to a preset modulation adjustment step size. In this embodiment, a single volume change does not exceed 3dB; a single change in binaural beat frequency difference does not exceed 1Hz; a single change in modulation depth does not exceed 0.05 (based on the normalized modulation index); a single change in vibration intensity does not exceed 20% of the current intensity; a single change in aromatherapy release rate does not exceed 0.2 micrograms / minute; and the cumulative change of any parameter within 10 seconds does not exceed twice the preset maximum cumulative change.

[0085] The safety constraint layer will prohibit any enhanced adjustment actions when any of the following conditions occur, and will only allow maintenance, reduction, or fade-out operations: increasing volume, increasing differential frequency, increasing modulation depth, increasing vibration intensity, increasing aromatherapy release rate, increasing light brightness, etc. The user provides feedback on discomfort via interactive interface buttons or voice commands; the artifact rate in the current window or three consecutive windows exceeds a preset threshold (e.g., 30%); the target frequency band power has reached the target (i.e., maintaining more than three feedback windows within ±5% of the target value); the current session duration is close to or exceeds 90% of the maximum duration threshold; the electrode impedance exceeds 10 kΩ and lasts for more than 5 seconds.

[0086] When the above safety constraints are triggered, the device enters a safety hold state (SAFE_HOLD). In the safety hold state, the following actions are performed: maintain or gradually reduce the current sound pressure level (decreasing at a rate not exceeding 0.5 dB / s), pause all frequency enhancement actions (stop increasing difference frequency and modulation depth), and pause aromatherapy and vibration intensity increase actions. Only the following operations are permitted in the safety hold state: volume fade-out, gradual reduction of stimulation intensity, prompting the user to re-wear the device or check electrode contact via the interactive interface or prompt tone, and ending the session and saving the record. The safety hold state continues until the safety conditions are lifted (e.g., the user confirms that discomfort has subsided, the artifact rate falls below the threshold, or the electrode impedance returns to normal) or the session end condition is triggered.

[0087] Continuously monitor the termination or pause conditions throughout the prescription output process. Stop, reduce, pause, or update prescription output when any of the following conditions are met: 1. Normal Termination Conditions TARGET_REACHED: The target frequency band power or state index is continuously maintained within the target threshold range. Specifically, if the EEG state index is within ±10% of the target value for M consecutive effective feedback windows (M is preferably 3 to 5, corresponding to a duration of 15 seconds to 1 minute), and trend analysis shows that the state is stable with no risk of decline, the target is determined to be achieved, and normal termination is triggered. Maximum Duration Reached (MAX_DURATION): The current session duration has reached the preset maximum treatment duration. The preset maximum duration is set according to the intervention type. For example, the preset maximum duration is 45 to 60 minutes for relaxation and sleep aid, 20 to 30 minutes for focus training, and 15 to 25 minutes for children or sensitive individuals. After reaching the maximum duration, the system will automatically terminate the session.

[0088] 2. Conditions for User-Initiated Termination User-initiated termination (USER_STOP): The user requests to terminate the session by clicking the "Stop" button on the interactive interface or by using a voice command. User feedback discomfort (DISCOMFORT): When a user clicks the "Discomfort Feedback" button on the interactive interface, the process is immediately terminated. The reason for termination is recorded as DISCOMFORT, and the corresponding session sample is used as a negative sample or safety constraint sample, and is not used for positive model training.

[0089] 3. Abnormal conditions of signals and equipment Insufficient signal quality (LOW_SIGNAL_QUALITY): If the percentage of valid windows (the percentage of windows with ValidWindow=1 out of the total number of windows) has been continuously lower than a preset threshold (e.g., 50%) for the past 60 seconds, the system determines that it cannot obtain a reliable feedback signal and triggers termination. Electrode impedance too high (IMPEDANCE_HIGH): The impedance detection unit reports that the electrode impedance has exceeded the preset threshold (e.g., 10 kΩ) for more than 10 seconds, and the problem does not improve after the user wears the device again. Low battery (LOW_BATTERY): The battery level is below the preset threshold (e.g., 15%), which is insufficient to complete a full treatment course; Communication link interruption (LINK_LOST): The Bluetooth communication link between the headband and the local terminal device (such as a mobile app) is interrupted for more than a preset time (such as 10 seconds) and reconnection fails; Audio or interactive link anomaly: The audio playback link (such as DAC or power amplifier) ​​or the auxiliary interactive output link (aroma / light / vibration control bus) reports an anomaly or times out without response.

[0090] 4. Triggering conditions for therapeutic efficacy and safety No Improvement (NO_IMPROVEMENT): The target state indicator shows no improvement trend in multiple consecutive feedback cycles (such as the last 3 to 5 minutes) (i.e., the absolute value of the change slope is less than the preset minimum improvement threshold). In order to avoid ineffective intervention and wasting user time, the system automatically ends the session; the samples corresponding to this termination reason are not used for training of augmented models, or are given lower sample weights.

[0091] SAFETY_LIMIT: If any hard limit in the above safety constraint layer is triggered (such as sound pressure exceeding 85 dBA, aromatherapy release rate exceeding 2.0 micrograms / minute, etc.), the system will immediately enter a safe hold and end the session.

[0092] Maximum intervention duration for minors or sensitive groups: For users identified through user profiling as minors (age <18 years), elderly (age >70 years), those with hearing sensitivity, those at risk of epilepsy, or pregnant users, a conservative prescription template will be enabled by default, with stricter maximum single intervention duration (e.g., no more than 25 minutes) and lower sound pressure level limits (e.g., no more than 70 dBA). Termination conditions will be triggered when these limits are reached.

[0093] When any termination condition is triggered, a unified termination procedure is executed, including: the system enters a fade-out state, and within a preset fade-out time (preferably 5 to 15 seconds), the intensity of all sensory outputs (audio, aromatherapy, light, vibration) is linearly or exponentially decayed to zero or a preset standby value; audio fade-out uses a smooth decay compensated by an equal loudness curve to avoid auditory discomfort caused by a sudden drop in volume. After the fade-out is complete, the last segment of the EEG signal (duration 10 to 30 seconds) is collected as the end status record of this session. The audio playback channel is turned off or put into standby mode, the aromatherapy release valve is turned off, and the light and vibration outputs are turned off, restoring all hardware modules to a low-power standby state. A gentle prompt tone or flashing light indicates to the user that the headband device can be removed.

[0094] After the session ends, session state information and a prescription execution log are generated for subsequent efficacy evaluation, model optimization, prescription reproduction, and safety auditing.

[0095] The session status information includes at least the following: a session identifier (session_id) containing a unique hash identifier of the user's anonymous ID, session date and time, and device number; the total session duration (in seconds) and the ratio of the total number of valid feedback windows to the total number of windows; the initial EEG state (baseline feature vector) and the final EEG state (final time feature vector); the target state parameters and whether they were met (TRUE / FALSE); the end reason code (EndReason), selected from the following set: TARGET_REACHED, MAX_DURATION, USER_STOP, DISCOMFORT, LOW_SIGNAL_QUALITY, IMPEDANCE_HIGH, LOW_BATTERY, LINK_LOST, NO_IMPROVEMENT, SAFETY_LIMIT, and OPERATOR_STOP; and the user's subjective feedback (such as a user-submitted comfort rating, self-evaluation of effectiveness, etc.).

[0096] The prescription execution record is a structured log file, including: prescription version information, including prescription version number, intangible cultural heritage ancient music audio feature library version number, rule base version number, learning model version number, and device firmware version number; prescription object snapshots, including complete parameters of the initial and final prescription objects of the session, as well as timestamp records of all intermediate adjustment actions (time of each adjustment, adjustment parameter name, value before adjustment, value after adjustment, and reason for adjustment); EEG state time series, including timestamps of each effective feedback window, power values ​​of each frequency band, dominant frequency, state index, and validity markers; multi-sensory output records, including start and end times, intensity parameter sequences, and reasons for adjustment for each type of interactive output (hearing, smell, vision, touch); user interaction events, including timestamps and operation types of user-initiated pause, continue, stop, and discomfort feedback; and device status records, including device power change curves, electrode impedance change curves, and communication link status records throughout the session.

[0097] Session state information and prescription execution records are stored in accordance with the following privacy protection standards: User identity information (such as name and contact information) is stored separately from EEG raw data and prescription execution records, using an anonymous session identifier (session_id) as the associated primary key, and no personally identifiable information is directly stored; the transmission process uses TLS 1.2 or higher encryption protocol, and the storage process uses AES-256 symmetric encryption or an equivalent level of encryption algorithm; EEG raw data is not stored permanently by default, and is only deleted from the device after feature extraction and the end of the session, retaining only the characteristic state index and frequency band energy statistics; if the raw data is to be used for model training, the user's separate and explicit consent is required; all data access operations are logged and audited, recording the access personnel, access time, access content, and operation type to ensure data usage is traceable.

[0098] Prescription execution records are further used to: accurately reproduce the prescription conditions of any session in the experimental environment or subsequent clinical validation by using the saved prescription version number, rule base version number, and complete prescription parameter snapshot, ensuring the reproducibility and verifiability of the technical solution of this invention; session samples with termination reasons encoded as TARGET_REACHED are marked as high-weight positive samples, session samples with termination reasons as DISCOMFORT or SAFETY_LIMIT are marked as negative samples or safety constraint samples, and session samples with termination reasons as LOW_SIGNAL_QUALITY are marked as invalid samples (not participating in model training). Samples with different weights are used for subsequent offline model updates and federated learning aggregation to continuously optimize the prescription decision-making strategy; long-term recording of the user's baseline EEG fingerprint, preferred prescription type, and efficacy response of each session gradually builds a personalized user response model, making the initialization and adjustment of subsequent prescriptions more accurate.

[0099] After the record is saved, the user's historical response weights are updated based on the performance of this session. If the session ends due to DISCOMFORT, SAFETY_LIMIT, or multiple consecutive NO_IMPROVEMENT events, the user is marked as "requiring a conservative prescription." In subsequent sessions, the enhanced adjustment actions output by the learning model are not executed by default; instead, the system reverts to a preset rule base prescription. The rule base prescription only uses volume limited by safety thresholds (not exceeding 60 dBA), fixed tempo (variation range not exceeding ±2 BPM), low-concentration aromatherapy (release rate not exceeding 0.3 micrograms / minute), low-brightness lighting (not exceeding 20 lumens), and low-intensity vibration (not exceeding 30% duty cycle). The conservative prescription state continues until the user reports comfort in at least 3 consecutive sessions and the effective window ratio remains above 70%, at which point the system gradually restores the enhanced closed-loop adjustment capability.

[0100] Example 2

[0101] This embodiment exemplarily presents an adaptive brain-computer interface system based on frequency prescriptions for intangible cultural heritage ancient music, including an EEG signal acquisition module, an EEG state recognition module, an intangible cultural heritage ancient music feature library module, a prescription generation module, an interactive output module, a closed-loop feedback module, and a conversation management module.

[0102] The EEG signal acquisition module is used to acquire the user's EEG signals. The module adopts a three-electrode single-channel EEG acquisition structure, including one effective EEG electrode, one reference electrode, and one ground electrode. The effective electrode is preferably a silver chloride dry electrode, which is placed at the user's forehead FP1 or FP2 position, with a sampling rate of 250Hz. The module also includes an analog-to-digital conversion unit and an impedance detection unit, which are used to digitize the analog EEG signals and monitor the electrode contact quality in real time.

[0103] The EEG state recognition module is used to extract EEG state features from the acquired EEG signals. This module performs preprocessing on the signals, including bandpass filtering, notch filtering, and wavelet thresholding, performs artifact detection and marks artifact windows as invalid, and uses the Welch method to estimate the spectrum of valid windows, extracting Delta, Theta, Alpha, Beta, Gamma band energies, EEG dominant frequency, frequency band ratio, and state indices such as relaxation level, concentration level, and stress index.

[0104] The Intangible Cultural Heritage Ancient Music Feature Library module is used to store the audio data of intangible cultural heritage ancient music and its ancient music features. This module performs resampling and loudness normalization on each ancient music audio segment, extracts spectral features, rhythmic features and timbre features through short-time Fourier transform, constant Q transform, chroma feature extraction or non-negative matrix factorization, generates five-tone tags of Gong, Shang, Jiao, Zhi and Yu through pentatonic scale template matching, and stores the above features with audio segments for retrieval.

[0105] The prescription generation module generates prescription objects based on the user's target state, EEG state characteristics, and ancient music features. This module determines the target enhancement frequency band based on the target state, selects matching seed sounds from the ancient music feature library, classifies and configures the tracks according to four categories: monarch sounds, minister sounds, assistant sounds, and envoy sounds, synthesizes frequency guidance layers such as binaural beats or amplitude modulation layers, and encapsulates parameters such as track selection, volume range, playback duration, mixing ratio, binaural beat difference frequency, modulation depth, and feedback adjustment rules into a structured prescription object.

[0106] The interactive output module is used to output multi-sensory interactive signals to the user based on the prescription recipient. This module includes an auditory output unit for playing prescription music; optionally, it also includes an olfactory output unit, a visual output unit, and a tactile output unit. The olfactory output unit includes an aromatherapy capsule chamber and a micro-pump control unit to control the type of aromatherapy, release rate, and release interval. The visual output unit includes an RGB LED light group to control the light color, brightness, and breathing light cycle. The tactile output unit includes a linear resonant motor or piezoelectric vibrator to control the vibration frequency, intensity, and envelope. Each output channel outputs collaboratively within a preset synchronization threshold using a session timestamp.

[0107] The closed-loop feedback module is used to adaptively adjust the prescription based on the difference between the real-time acquired EEG state and the target state. This module calculates the deviation and the trend of change, and adopts a hierarchical adjustment mechanism to adjust step by step according to level 1 (volume / mixing), level 2 (difference frequency / modulation depth), and level 3 (track / mode switching). This module also includes a safety constraint layer to limit the sound pressure and the amplitude of a single adjustment. When the user is uncomfortable or the signal is abnormal, the enhanced action is prohibited and a safety hold state is entered.

[0108] The session management module determines preset termination or pause conditions and stops or pauses prescription output when the conditions are met, as well as generating session status information and prescription execution records. Termination conditions include goal achievement, maximum duration reached, user-initiated cessation, user discomfort, insufficient signal quality, device malfunction, no improvement, and safety threshold triggering. After the session ends, this module saves a complete log containing the termination reason, prescription parameter adjustment records, and EEG state sequences for use in efficacy evaluation and model optimization.

[0109] The above modules are preferably integrated into the wearable headband device and its supporting local terminal device. Alternatively, some computationally intensive modules can be deployed on a cloud server and interact with the headband device through a wireless communication network as needed.

[0110] Other embodiments of the invention will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the invention that follow the general principles of the invention and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of the invention are indicated by the claims. It should be understood that the invention is not limited to the precise structures described above and shown in the drawings, and various modifications and changes can be made without departing from its scope. The scope of the invention is limited only by the appended claims.

Claims

1. An adaptive brain-computer interface method based on frequency prescriptions of intangible cultural heritage ancient music, characterized in that, The method includes: Collect users' brainwave signals and extract brainwave state features to obtain intangible cultural heritage ancient music audio data and ancient music features, wherein the ancient music features include at least one of spectrum features, rhythm features, mode features, timbre features, five-tone tags or prescription tags; Based on the user's target state, the EEG state characteristics, and the ancient music characteristics, a prescription object containing prescription music parameters is generated. Prescription music is output to the user based on the prescription object, and the user's EEG signals are continuously or intermittently collected during the output process. Based on the difference between the real-time or phased collected EEG state and the user's target state, the parameters in the prescription object are adaptively adjusted. When the preset end or pause conditions are met, the prescription output is stopped or paused, and session state information and prescription execution records are generated.

2. The adaptive brain-computer interface method based on frequency prescriptions of intangible cultural heritage ancient music according to claim 1, characterized in that, The process of collecting the user's electroencephalogram (EEG) signals and extracting EEG state features includes: EEG signals are acquired using a three-electrode single-channel EEG acquisition structure, wherein the three electrodes include an effective EEG electrode, a reference electrode, and a ground electrode. The EEG signal is preprocessed, and the preprocessing includes at least one of bandpass filtering, notch filtering and wavelet thresholding denoising. Artifact detection is performed on the preprocessed EEG signals, and signal windows that meet the artifact criteria are marked as invalid windows and are not included in the EEG state feature extraction. The effective signal window is subjected to spectrum estimation using the Welch method, and at least one of the following is extracted as the EEG state feature: Delta, Theta, Alpha, Beta, Gamma band energy, EEG dominant frequency, band ratio, and state index.

3. The adaptive brain-computer interface method based on frequency prescriptions of intangible cultural heritage ancient music according to claim 1, characterized in that, The acquisition of intangible cultural heritage ancient music audio data and ancient music characteristics includes: Resampling and loudness normalization were performed on the audio of intangible cultural heritage ancient music; Extract spectral features, rhythmic features, modal features, or timbre features of audio by at least one of short-time Fourier transform, constant Q transform, chroma feature extraction, fundamental frequency estimation, or nonnegative matrix factorization. Based on pentatonic scale template matching, the probability vector of audio segments belonging to Gong, Shang, Jiao, Zhi, and Yu is calculated to generate the five-tone tags.

4. The adaptive brain-computer interface method based on frequency prescriptions of intangible cultural heritage ancient music according to claim 1, characterized in that, The prescription also includes playback duration, volume range, mixing ratio, binaural beat difference, modulation depth, and feedback adjustment rules; The prescription music includes four types of tracks: monarch, minister, assistant, and envoy. The proportion of the four types of tracks is adaptively adjusted according to the difference between the user's target state and the current EEG state, and the proportion of each track varies within a preset upper and lower limit range.

5. The adaptive brain-computer interface method based on frequency prescriptions of intangible cultural heritage ancient music according to claim 1, characterized in that, While outputting prescription music to the user according to the prescription object, it also outputs at least one of the auxiliary sensory outputs, namely olfactory interaction signal, visual interaction signal or tactile interaction signal; The olfactory interaction signals include the type of aromatherapy, release rate, release duration, and release interval; The visual interaction signals include light color, brightness, flashing frequency, and breathing light cycle; The tactile interaction signal includes vibration frequency, vibration intensity, vibration envelope, and working duration; The prescription music and the auxiliary sensory output are output in tandem within a preset synchronization threshold via session timestamps.

6. The adaptive brain-computer interface method based on frequency prescriptions of intangible cultural heritage ancient music according to claim 1, characterized in that, The adaptive adjustment of parameters in the prescription object includes: Calculate the deviation and trend between the current EEG state and the user's target state; A tiered adjustment mechanism is adopted, with parameter adjustments executed sequentially according to the priority of Level 1, Level 2, and Level 3 adjustments. The first-level adjustments include adjusting volume, fade-in / fade-out time, and mixing ratio. The secondary adjustment includes adjusting the binaural beat difference frequency, modulation depth, and rhythm density; The three-level adjustment includes switching track segments, changing seed sounds, changing aromatherapy types, switching light rhythm modes, or changing vibration modes. When multiple consecutive feedback windows fail to reach the target state, adjust them step by step in order from level one to level three.

7. The adaptive brain-computer interface method based on frequency prescriptions of intangible cultural heritage ancient music according to claim 1, characterized in that, The adaptive adjustment is restricted by the security constraint layer; The safety constraint layer includes a sound pressure safety threshold, a single adjustment limit, and rules for prohibiting actions. The sound pressure safety threshold includes a preset comfortable playback sound pressure range and a preset peak sound pressure upper limit; The single adjustment limit includes: limiting the single change in volume to a preset gradual step size, limiting the single change in binaural beat frequency difference to a preset frequency adjustment step size, and limiting the single change in modulation depth to a preset modulation adjustment step size. Enhanced adjustment actions are prohibited when users report discomfort, the faker rate exceeds the preset threshold, or the target state has been met. When a security constraint is triggered, the system enters a security hold state, allowing only fade-out, de-intensity, or session termination operations.

8. An adaptive brain-computer interface system based on frequency prescriptions of intangible cultural heritage ancient music, used to implement the method described in any one of claims 1-7, characterized in that, include: The EEG signal acquisition module is used to acquire the user's EEG signals and output preprocessed EEG data; The EEG state recognition module is used to extract EEG state features from the EEG data; The Intangible Cultural Heritage Ancient Music Feature Library Module is used to store audio data of intangible cultural heritage ancient music and its ancient music features, wherein the ancient music features include at least one of spectrum features, rhythm features, mode features, timbre features, pentatonic tags or prescription tags; The prescription generation module is used to generate a prescription object containing prescription music parameters based on the user's target state, the EEG state characteristics, and the ancient music characteristics. An interactive output module is used to output prescription music to the user based on the prescription object; A closed-loop feedback module is used to adaptively adjust the parameters in the prescription object based on the difference between the real-time or phased collected EEG state and the user's target state. The session management module is used to determine preset end or pause conditions, and stop or pause prescription output when the conditions are met, as well as generate session status information or prescription execution records.

9. An adaptive brain-computer interface system based on frequency prescriptions of intangible cultural heritage ancient music according to claim 8, characterized in that, The EEG signal acquisition module is a three-electrode single-channel EEG acquisition module, including an effective EEG electrode, a reference electrode, a ground electrode, an analog-to-digital conversion unit, and an impedance detection unit; The effective EEG electrodes are positioned at FP1 or FP2 on the forehead, while the reference electrode and ground electrode are positioned in the non-hair area. The effective EEG electrode is a silver chloride dry electrode or a flexible electrode. The impedance detection unit is used to continuously monitor the electrode contact impedance during the acquisition process, and generates a prompt signal when the impedance exceeds a preset threshold.

10. An adaptive brain-computer interface system based on frequency prescriptions of intangible cultural heritage ancient music according to claim 8, characterized in that, The interactive output module further includes at least one of the following auxiliary output units: The olfactory output unit, including an aroma capsule chamber, a micropump or micropore array control unit, is used to control the type of aroma, release rate and release interval according to the prescription target; The visual output unit includes an RGB LED light group for controlling the color, brightness, and breathing cycle of the light according to the prescription object; The tactile output unit, including a linear resonant motor or a piezoelectric vibrator, is used to control the vibration frequency, vibration intensity, and vibration envelope according to the prescription object; The prescription music and the output signal of the auxiliary output unit are output in tandem within a preset synchronization threshold through a session timestamp.