Method, device, processor and computer readable storage medium thereof for realizing earphone sound stimulus brain electric spike interference cancellation
Patent Information
- Application Number
- CN202610768520.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-05-30
- Publication Date
- 2026-08-21
AI Technical Summary
其不足在于:该方法主要从实验装置和参考方式处理耳机线缆/换能器伪迹,不适合已经采集完成的TWS/入耳脑电数据;反相平均还可能改变声刺激相位条件,不能直接用于需要保留单次事件脑电波形的消费级耳机连续记录场景
[0020]采用了本发明的实现耳机声刺激脑电尖峰干扰消除的方法、装置、处理器及其计算机可读存储介质,解决入耳式脑电采集中,耳机播放规律蜂鸣声、提示音或短声刺激时,脑电数据中出现与声刺激时间点同步的大幅尖峰干扰,导致后续脑电分析、睡眠分析、专注度分析、听觉诱发响应分析或算法训练结果失真的问题。本发明重点解决干扰已经出现在脑电数据中后,如何依据声刺激时间戳将其消除的问题,而非重新设计完整硬件系统。
Smart Images

Figure CN122604397A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of wearable EEG signal processing and in-ear EEG acquisition, and particularly to the fields of headphone acoustic stimulation experiments and bioelectric artifact elimination. Specifically, it relates to a method, device, processor, and computer-readable storage medium for eliminating EEG spike interference from headphone acoustic stimulation. Background Technology
[0002] During the acquisition process using in-ear EEG headphones, the headphones may play buzzing sounds, prompts, test sounds, or short stimuli while simultaneously acquiring EEG signals via ear canal electrodes, concha electrodes, or periauricular electrodes. In actual testing, as shown in the attached... Figure 1 As shown, when the buzzing sound occurs at fixed intervals, positive and negative spikes appear in the EEG waveform that are highly consistent with the timing of the buzzing sound, and their amplitude is significantly higher than the background EEG fluctuations. These spikes may originate from transient currents in the speaker, power / ground coupling, transients in the audio amplifier switch, contact potential changes caused by vibrations in the headphone structure, or may be superimposed on the transient electromyography or blinking response of the subject after hearing the sudden buzzing sound.
[0003] The existing technical literature and its shortcomings are as follows: • Campbell et al., in their 2012 paper "Methods to Eliminate Stimulus Transduction Artifact From Insert Earphones During Electroencephalography" published in Ear and Hearing, proposed reducing stimulus conduction artifacts introduced by insert-in earphones through shielding, out-of-phase averaging, or re-reference. Its limitations are: this method primarily addresses earphone cable / transducer artifacts from the perspective of experimental setup and reference methods, making it unsuitable for already acquired TWS / in-ear EEG data; out-of-phase averaging may also alter the acoustic stimulus phase conditions, and therefore cannot be directly applied to continuous recording scenarios using consumer-grade earphones that require preserving single-event EEG waveforms.
[0004] • A 2013 study by Kidmose et al. on ear-EEG evoked potentials demonstrated that ear canal / periauricular electrodes can record acoustic stimulus-related evoked potentials. However, this study focused on the recordability of ear-EEG evoked responses and did not provide an algorithm for eliminating short-term interference while protecting subsequent auditory evoked responses when the headphones themselves play acoustic stimuli that simultaneously cause significant spike interference.
[0005] Conventional bandpass filtering, 50 / 60Hz notch filtering, or simple threshold removal also have shortcomings: the spikes in the figure are short-duration, wideband, event-locked interferences, which cannot be eliminated by simple filtering; simple removal will cause data gaps, affecting subsequent event response analysis. Therefore, a simpler and more targeted method is needed: to accurately locate the interference position using acoustic stimulus timestamps, establish a local interference template and perform proportional subtraction, and then perform short-window interpolation to repair the remaining extremely narrow spikes. Summary of the Invention
[0006] The purpose of this invention is to overcome the shortcomings of the prior art and provide a method, apparatus, processor and computer-readable storage medium for eliminating EEG spike interference from headphone sound stimulation that is highly accurate, has low distortion and a wide range of applications.
[0007] To achieve the above objectives, the present invention provides a method, apparatus, processor, and computer-readable storage medium for eliminating EEG spike interference from headphone acoustic stimulation, as follows: The main feature of this method for eliminating brainwave spike interference from headphone sound stimulation is that the method includes the following steps: (1) Acquire continuous EEG data and simultaneously acquire the timestamp of the sound stimulation played through the headphones; (2) Based on the EEG sampling rate of the continuous EEG data, convert the timestamp into EEG sampling points; (3) A local interference window is extracted around the EEG sampling point, the local interference window including a baseline window, an interference cancellation window and a physiological response protection window; (4) Identify spike interference synchronized with acoustic stimuli based on the local interference window; (5) Align the multiple local interference windows that have been identified as spike interference and remove the local baselines to generate an interference template; (6) For each acoustic stimulus, calculate the template scaling factor of the interference template in the corresponding interference cancellation window. The interference template is proportionally subtracted from the interference elimination window according to the template scaling factor; (7) For saturation points, clipped peaks or narrow spikes that still exceed the adaptive residual threshold after deduction, short-window interpolation is performed using the effective sampling points on both sides of the interference cancellation window. (8) Output the obtained EEG data after eliminating the synchronous spike interference of acoustic stimulation.
[0008] Preferably, the timestamp is the time when the audio playback command is issued, the time when the audio digital-to-analog conversion starts, the time when the speaker driver starts, the time when the Bluetooth audio chip plays, or the actual sound output time after calibration. The step (2) of converting the timestamp into EEG sampling points specifically involves: Convert timestamps to EEG sampling points using the following formula: in, Let be the timestamp of the i-th acoustic stimulus. For EEG sampling rate, For the first The EEG sampling points corresponding to infrasound stimulation.
[0009] Preferably, step (4) specifically includes the following steps: (4.1) Calculate the noise level σ based on the data within the baseline window; (4.2) Calculate the peak-to-peak value and the maximum first-order difference within the interference cancellation window; (4.3) If the peak-to-peak value within the interference cancellation window is greater than the product of the first preset multiple and the noise level, or if the maximum first-order difference within the interference cancellation window is greater than the product of the second preset multiple and the noise level of the first-order difference of the baseline window, then it is determined that there is acoustic stimulus synchronization spike interference within the interference cancellation window.
[0010] Preferably, step (5) specifically includes the following steps: (5.1) Perform local baseline subtraction on multiple local interference windows; (5.2) Alignment is performed based on the acoustic stimulus timestamp, the maximum peak point, or the maximum slope point; (5.3) Based on the correlation between multiple local interference windows after alignment and the status of abnormal events, adaptively select the average, median or weighted average method to generate the interference template.
[0011] Preferably, step (5.3) specifically includes the following steps: If the number of effective local interference windows is less than a first quantity threshold, or the correlation between windows is lower than a first correlation threshold, then the interference template is generated using the median method. If the correlation between windows is higher than the second correlation threshold and there are no abnormal waveform windows, the interference template is generated using the average value method. If the quality of each local interference window differs but the acoustic stimulus synchronization consistency is met, then the weights are determined based on the correlation coefficient between each local interference window and the initial template, as well as the baseline noise level, and the interference template is generated using a weighted average method.
[0012] Preferably, in step (6), the template scaling factor of the interference template in the corresponding interference cancellation window is calculated. Specifically: Calculate the template scaling factor using the following formula. : =Σ( × ) / Σ( ^2), k∈ in, This represents the baseline-removed interference cancellation window data corresponding to the i-th acoustic stimulus. The data represents the interference template, and k is the index of the sampling point within the interference cancellation window.
[0013] Preferably, in step (6), the interfering template is proportionally subtracted from the interference cancellation window according to the template scaling factor, specifically as follows: The interference template is proportionally subtracted from the interference removal window according to the template scaling factor using the following formula: ; in, To interfere with template data, To eliminate interference in the window data before subtraction, The data after deduction, and It is limited to a preset numerical range.
[0014] Preferably, step (7) specifically includes the following steps: (7.1) in the Before the infrasound stimulus occurs, a baseline window free of spike interference is selected. Calculate the standard deviation of local baseline noise. ; (7.2) Calculate the residual threshold; (7.3) Calculate the number of sampling points that continuously exceed the residual threshold. If the number of sampling points does not exceed the narrow peak time threshold, it is determined to be a narrow peak residual; otherwise, mark the infrasound stimulation window as an abnormal window or a low confidence window. (7.4) For points that are identified as residual spikes, short-window interpolation is used to repair them by linear interpolation, cubic spline interpolation or PCHIP interpolation.
[0015] Preferably, step (8) specifically includes the following steps: When outputting EEG data after eliminating synchronous spike interference from acoustic stimulation, a quality index for interference processing is output synchronously for each acoustic stimulation. The quality index includes at least the peak-to-peak value before interference elimination, the peak-to-peak value after interference elimination, the template scaling factor, the residual interference amplitude, whether interpolation repair was performed, and the interference suppression ratio.
[0016] Preferably, the method further includes the following steps: For different sound stimulus volumes, different buzzing frequencies, different left and right ear playback paths, or different electrode contact impedance states, corresponding interference templates are generated and saved to establish an interference template library. When performing interference template subtraction, a matching interference template is called from the interference template library for subtraction based on the current acoustic stimulus conditions and the status of the acquisition device.
[0017] The main feature of this device for eliminating brainwave spike interference from headphone sound stimulation is that the device comprises: A processor is configured to execute computer-executable instructions; The memory stores one or more computer-executable instructions, which, when executed by the processor, implement the steps of the method for eliminating EEG spike interference from headphone sound stimulation.
[0018] The processor for eliminating EEG spike interference from headphone sound stimulation is characterized in that the processor is configured to execute computer-executable instructions, which, when executed by the processor, implement the various steps of the method for eliminating EEG spike interference from headphone sound stimulation.
[0019] The computer-readable storage medium is characterized in that it stores a computer program thereon, which can be executed by a processor to implement the various steps of the method for eliminating EEG spike interference from headphone sound stimulation as described above.
[0020] This invention employs a method, apparatus, processor, and computer-readable storage medium for eliminating spike interference in EEG data caused by headphone-based acoustic stimulation. It addresses the problem in in-ear EEG data acquisition where, when headphones play regular buzzing sounds, prompts, or short stimuli, significant spike interference synchronized with the timing of the acoustic stimulation appears in the EEG data, leading to distortion in subsequent EEG analysis, sleep analysis, attention analysis, auditory evoked response analysis, or algorithm training results. This invention focuses on eliminating interference based on the acoustic stimulation timestamp after it has already appeared in the EEG data, rather than redesigning the entire hardware system. Attached Figure Description
[0021] Figure 1 This is an original schematic diagram of EEG spike interference under regular buzzing stimulation.
[0022] Figure 2 This is a schematic diagram of the electroencephalogram (EEG) after algorithm processing for the method of eliminating EEG spike interference from headphone sound stimulation according to the present invention.
[0023] Figure 3 This is a schematic diagram of the acoustic stimulation timestamp and processing window division in the method for eliminating EEG spike interference by earphone acoustic stimulation according to the present invention.
[0024] Figure 4 The flowchart shows the algorithm for eliminating spike interference during headphone-based auditory stimulation, as described in this invention. Detailed Implementation
[0025] To more clearly describe the technical content of the present invention, the following description is provided in conjunction with specific embodiments.
[0026] The method for eliminating EEG spike interference from headphone sound stimulation according to the present invention includes the following steps: (1) Acquire continuous EEG data and simultaneously acquire the timestamp of the sound stimulation played through the headphones; (2) Based on the EEG sampling rate of the continuous EEG data, convert the timestamp into EEG sampling points; (3) A local interference window is extracted around the EEG sampling point, the local interference window including a baseline window, an interference cancellation window and a physiological response protection window; (4) Identify spike interference synchronized with acoustic stimuli based on the local interference window; (5) Align the multiple local interference windows that have been identified as spike interference and remove the local baselines to generate an interference template; (6) For each acoustic stimulus, calculate the template scaling factor of the interference template in the corresponding interference cancellation window. The interference template is proportionally subtracted from the interference elimination window according to the template scaling factor; (7) For saturation points, clipped peaks or narrow spikes that still exceed the adaptive residual threshold after deduction, short-window interpolation is performed using the effective sampling points on both sides of the interference cancellation window. (8) Output the obtained EEG data after eliminating the synchronous spike interference of acoustic stimulation.
[0027] In a preferred embodiment of the present invention, the timestamp is the time when the audio playback command is issued, the time when the audio digital-to-analog conversion starts, the time when the speaker drive starts, the time when the Bluetooth audio chip plays, or the actual sound output time after calibration.
[0028] The step (2) of converting the timestamp into EEG sampling points specifically involves: Convert timestamps to EEG sampling points using the following formula: in, Let be the timestamp of the i-th acoustic stimulus. For EEG sampling rate, For the first The EEG sampling points corresponding to infrasound stimulation.
[0029] In a preferred embodiment of the present invention, step (4) specifically includes the following steps: (4.1) Calculate the noise level σ based on the data within the baseline window; (4.2) Calculate the peak-to-peak value and the maximum first-order difference within the interference cancellation window; (4.3) If the peak-to-peak value within the interference cancellation window is greater than the product of the first preset multiple and the noise level, or if the maximum first-order difference within the interference cancellation window is greater than the product of the second preset multiple and the noise level of the first-order difference of the baseline window, then it is determined that there is acoustic stimulus synchronization spike interference within the interference cancellation window.
[0030] In a preferred embodiment of the present invention, step (5) specifically includes the following steps: (5.1) Perform local baseline subtraction on multiple local interference windows; (5.2) Alignment is performed based on the acoustic stimulus timestamp, the maximum peak point, or the maximum slope point; (5.3) Based on the correlation between multiple local interference windows after alignment and the status of abnormal events, adaptively select the average, median or weighted average method to generate the interference template.
[0031] In a preferred embodiment of the present invention, step (5.3) specifically includes the following steps: If the number of effective local interference windows is less than a first quantity threshold, or the correlation between windows is lower than a first correlation threshold, then the interference template is generated using the median method. If the correlation between windows is higher than the second correlation threshold and there are no abnormal waveform windows, the interference template is generated using the average value method. If the quality of each local interference window differs but the acoustic stimulus synchronization consistency is met, then the weights are determined based on the correlation coefficient between each local interference window and the initial template, as well as the baseline noise level, and the interference template is generated using a weighted average method.
[0032] In a preferred embodiment of the present invention, step (6) involves calculating the template scaling factor of the interference template within the corresponding interference cancellation window. Specifically: Calculate the template scaling factor using the following formula. : =Σ( × ) / Σ( ^2), k∈ in, This represents the baseline-removed interference cancellation window data corresponding to the i-th acoustic stimulus. The data represents the interference template, and k is the index of the sampling point within the interference cancellation window.
[0033] In a preferred embodiment of the present invention, step (6) involves proportionally subtracting the interference template from the interference elimination window according to the template scaling factor, specifically as follows: The interference template is proportionally subtracted from the interference removal window according to the template scaling factor using the following formula: in, To interfere with template data, To eliminate interference in the window data before subtraction, The data after deduction, and It is limited to a preset numerical range.
[0034] In a preferred embodiment of the present invention, step (7) specifically includes the following steps: (7.1) in the Before the infrasound stimulus occurs, a baseline window free of spike interference is selected. Calculate the standard deviation of local baseline noise. ; (7.2) Calculate the residual threshold; (7.3) Calculate the number of sampling points that continuously exceed the residual threshold. If the number of sampling points does not exceed the narrow peak time threshold, it is determined to be a narrow peak residual; otherwise, mark the infrasound stimulation window as an abnormal window or a low confidence window. (7.4) For points that are identified as residual spikes, short-window interpolation is used to repair them by linear interpolation, cubic spline interpolation or PCHIP interpolation.
[0035] In a preferred embodiment of the present invention, step (8) specifically includes the following steps: When outputting EEG data after eliminating synchronous spike interference from acoustic stimulation, a quality index for interference processing is output synchronously for each acoustic stimulation. The quality index includes at least the peak-to-peak value before interference elimination, the peak-to-peak value after interference elimination, the template scaling factor, the residual interference amplitude, whether interpolation repair was performed, and the interference suppression ratio.
[0036] In a preferred embodiment of the present invention, the method further includes the following steps: For different sound stimulus volumes, different buzzing frequencies, different left and right ear playback paths, or different electrode contact impedance states, corresponding interference templates are generated and saved to establish an interference template library. When performing interference template subtraction, a matching interference template is called from the interference template library for subtraction based on the current acoustic stimulus conditions and the status of the acquisition device.
[0037] The device for eliminating EEG spike interference from headphone acoustic stimulation according to the present invention, wherein the device comprises: A processor is configured to execute computer-executable instructions; The memory stores one or more computer-executable instructions, which, when executed by the processor, implement the steps of the method for eliminating EEG spike interference from headphone sound stimulation.
[0038] The processor of the present invention for eliminating EEG spike interference from headphone sound stimulation is configured to execute computer-executable instructions, which, when executed by the processor, implement the various steps of the method for eliminating EEG spike interference from headphone sound stimulation.
[0039] The computer-readable storage medium of the present invention stores a computer program thereon, which can be executed by a processor to implement the various steps of the method for eliminating EEG spike interference from headphone sound stimulation as described above.
[0040] The interference in this invention is a periodic spike that occurs synchronously with the acoustic stimulus event when the headphones play a buzzing sound. The timing of this spike is locked by the headphone acoustic stimulus event, rather than a random strong pulse; its location can be predicted by the acoustic stimulus timestamp; its waveform has cross-event repeatability and can be used to form a statistical template through multiple acoustic stimulus local windows; its amplitude may only be about a few hundred microvolts, which may not meet the recognition conditions of "high-level overlimit" or "sub-resolution quantization" like electrosurgical interference; there may be real auditory evoked responses or event-related EEG components in its vicinity, and if the interpolation correction approach of electrosurgical interference is used directly, it may destroy the real auditory evoked EEG responses as well.
[0041] The method for eliminating headphone-based auditory stimulation EEG spikes of the present invention includes: (1) Acquire continuous EEG data and timestamps of sound stimulation played through headphones; (2) Convert the timestamp into EEG sampling points according to the EEG sampling rate; (3) Extract a local interference window around the sampling point; (4) Identify spike interference synchronized with acoustic stimuli based on the local interference window; (5) Generate an interference template using the local interference window corresponding to multiple acoustic stimuli; (6) The interference template is subtracted from the corresponding local interference window proportionally to obtain the EEG data after eliminating the synchronous spike interference of the acoustic stimulus.
[0042] The timestamp is the moment when the audio playback command is issued, the moment when the audio digital-to-analog conversion starts, the moment when the speaker driver starts, the moment when the Bluetooth audio chip plays, or the actual sound output moment after calibration.
[0043] When converting timestamps to EEG sampling points, a calibration offset Δ is introduced, which refers to the sampling points. ,in Let be the timestamp of the i-th acoustic stimulus. denoted as EEG sampling rate, Δ as calibration offset, and ni as the EEG sampling point corresponding to the i-th acoustic stimulus.
[0044] The local interference window includes a baseline window, an interference cancellation window, and a physiological response protection window. The interference cancellation window is used for template subtraction or interpolation repair, and the physiological response protection window is used to avoid real EEG event responses after the deletion of acoustic stimuli.
[0045] When encountering spike interference, the amplitude noise level σx is calculated based on the baseline window, and the slope noise level σd is calculated based on the first-order difference data of the baseline window. If the peak-to-peak value PPi within the interference cancellation window is greater than the product of a first preset multiple Kpp and the noise level σx, or if the maximum first-order difference Di within the interference cancellation window is greater than the product of a second preset multiple Kd and the first-order difference noise level σd of the baseline window, then it is determined that there is acoustic stimulus synchronization spike interference within the interference cancellation window. The corresponding calculation formula is as follows: PPi > Kpp × σx or Di > Kd × σd; where PPi is the peak-to-peak value within the interference cancellation window corresponding to the i-th acoustic stimulus, Di is the maximum first-order difference within the interference cancellation window corresponding to the i-th acoustic stimulus, σx is the local noise level of the EEG amplitude within the baseline window, and σd is the noise level of the first-order difference signal within the baseline window; Kpp and Kd are preset multiples, both of which are dimensionless coefficients and can be set according to the actual noise level of the acquisition system, for example, Kpp can be 5 to 8 and Kd can be 5 to 10.
[0046] The formulas for calculating the peak-to-peak value Ppi within the interference cancellation window corresponding to the i-th acoustic stimulus and the maximum first-order difference Di within the interference cancellation window corresponding to the i-th acoustic stimulus are as follows: PPi=max(Wi)-min(Wi); Di=max(|x[n]-x[n-1]|), n∈Wi; Where Wi is the interference cancellation window corresponding to the i-th acoustic stimulus, used for template subtraction and necessary interpolation.
[0047] For the i-th sound stimulus, a baseline window Bi that does not contain spike interference is selected before the sound stimulus occurs, such as data from 300ms to 100ms or from 200ms to 50ms before the sound stimulus.
[0048] The amplitude noise level σx can be calculated using the MAD robust estimation method: mi = median(Bi); σx,i=1.4826×median(|Bi-mi|); Where mi is the median of the data within the baseline window for the i-th acoustic stimulus; σx,i is the amplitude noise level corresponding to the i-th acoustic stimulus. MAD is used instead of ordinary standard deviation to reduce the impact of outliers such as occasional motion artifacts and slight contact jumps on threshold judgment.
[0049] The first-order differential noise level σd can be calculated as follows: dB,i[n]=x[n]-x[n-1], n∈Bi; σd,i=1.4826×median(|dB,i-median(dB,i)|); Where dB,i[n] represents the first-order difference data within the baseline window; σd,i represents the first-order difference noise level within the baseline window.
[0050] Therefore, the peak-to-peak value threshold and the slope threshold correspond to different units: PPi is in μV, and the corresponding threshold Kpp×σx,i is also in μV; Di is in μV / sample, and the corresponding threshold Kd×σd,i is also in μV / sample.
[0051] When generating the interference template, local baselines are subtracted from multiple local interference windows, and they are aligned according to the maximum peak point, maximum slope point, or acoustic stimulus timestamp. Then, the interference template is formed by using the average, median, or weighted average method.
[0052] The scaling factor is calculated for each acoustic stimulus during template subtraction. , and according to Deductions will be made, among which This is a interference template.
[0053] After template subtraction, short-window interpolation is performed to repair saturation points, clipped vertices, or narrow peaks that still exceed the residual threshold. The short-window interpolation includes linear interpolation, cubic spline interpolation, PCHIP interpolation, or fitting repair based on adjacent valid sampling points.
[0054] For different sound stimulus volumes, different buzzing frequencies, different left and right ear playback paths, or different device operating states, corresponding interference templates are established, and the interference template that matches the current sound stimulus conditions is called during processing.
[0055] When outputting EEG data, interference processing quality indicators are output simultaneously. These quality indicators include peak value before elimination, peak value after elimination, template scaling factor, residual interference amplitude, whether interpolation repair is used, and interference suppression ratio.
[0056] Appendix Figure 1 This is a schematic diagram of the original EEG spike interference under regular buzzing sound stimulation. Regular positive and negative spikes can be seen near the sound stimulus in the diagram.
[0057] Appendix Figure 2 This is a schematic diagram of the EEG after algorithm processing; the acoustic stimulation synchronization spikes have been eliminated. This diagram simulates the effect of template subtraction and short-window interpolation based on the timeline and background fluctuation amplitude of the current screenshot, and is used for illustration in the instruction manual; the final output diagram should be replaced with the output diagram after running the algorithm on the actual raw data.
[0058] Appendix Figure 3 This diagram illustrates the division of acoustic stimulus timestamps and processing windows. (Based on acoustic stimulus timestamps...) Divide the baseline window centered on the baseline. Interference cancellation window and response protection window .
[0059] Appendix Figure 4 Flowchart of the algorithm for eliminating synchronous spike interference of acoustic stimuli.
[0060] I. General Approach 1. Acquire continuous EEG data x [n], and simultaneously acquire the playback timestamp of each beep, cue tone, or short stimulus. , where i represents the i-th sound stimulus.
[0061] 2. Based on EEG sampling rate The harmonic stimulation is applied to the calibration offset Δ of the EEG sampling clock, converting the timestamp into EEG sampling points. .
[0062] 3. Around Baseline window division Interference cancellation window and physiological response protection window The baseline window is used to estimate local noise, the interference cancellation window is used for template subtraction and necessary interpolation, and the physiological response protection window is generally left unprocessed to protect the true auditory evoked response.
[0063] 4. Determine based on baseline noise, peak-to-peak value, and maximum slope. Does the internal acoustic stimulus synchronization spike interference exist?
[0064] 5. Match multiple sound stimuli with... Align and remove local baselines to generate an interference template. .
[0065] 6. For each Calculate template scaling factor A proportional deduction is performed; short-window interpolation is used to repair the extremely narrow residual peaks that still exist after the deduction.
[0066] 7. Output the EEG signal after interference elimination [n], and outputs quality indicators such as interference amplitude, residual amplitude, suppression ratio, and whether interpolation is used for each event.
[0067] II. Key Calculation Formulas 1) Converting raw ADC code values to input equivalent voltage (applicable to 24-bit AFE / PGA): [n] = Code[n] × / ((2^23-1)×G) Where Code[n] is the ADC code value after signed binary two's complement conversion. Here, G is the reference voltage, and G is the PGA gain. For example... When the voltage is 2.5V and the voltage is 24, the voltage of 1 LSB is approximately 2.5 / (8388607 × 24) = 12.4nV.
[0068] 2) Conversion of acoustic stimulus timestamps to EEG sampling points: in Let be the timestamp of the i-th acoustic stimulus, and Δ be the calibration offset. denoted as the EEG sampling rate, and ni represents the EEG sampling point corresponding to the i-th acoustic stimulus.
[0069] 3) Local window definition: ={x[ +k]|k∈[-0.300 -0.100 ]} ={x[ +k]|k∈[-0.010 +0.080 ]} ={x[ +k]|k∈[+0.080 +0.300 ]} in For the baseline window, To eliminate interference, A physiological response protection window is provided; the window length can be adjusted according to the duration of the beep and the device coupling time.
[0070] 4) Baseline mean and robust noise estimation: mi = median(Bi); σx,i=1.4826×median(|Bi-mi|); MAD estimation It can reduce the impact of occasional anomalies on noise assessment.
[0071] 5) Peak value and maximum slope of interference: PPi=max(Wi)-min(Wi); Di=max(|x[n]-x[n-1]|), n∈Wi; Judgment criteria: PPi > Kpp × σx or Di > Kd × σd; Where Kpp is 5-8 and Kd is 5-10; This is the standard deviation or MAD estimate of the first difference of the baseline window.
[0072] 6) Event window after baseline removal: Where k is the index of the sampling point within the local window.
[0073] 7) Multi-event interference template: Average template: T[k] = (1 / M)Σwi[k] Median template: T[k]=median{w1[k], w2[k],..., wM[k]} Weighted average template: T[k]=Σ(ωi×wi[k]) / Σωi Where M is the number of valid windows participating in template generation, and ωi is the weight of the i-th window.
[0074] The median template is preferred to reduce contamination of the template by incidental events such as blinking, electromyography, and electrode contact transients.
[0075] 8) Template scaling factor (least squares): αi=Σ(wi[k]×T[k]) / (Σ(T[k]^2)+ε), k∈Wi Where ε is a small constant to prevent the denominator from being zero.
[0076] 9) Template deduction: in, [ni+k] represents the EEG data after subtraction. It can be limited to a preset range, such as 0.2 to 2.0 or 0.5 to 1.5, to prevent excessive deduction caused by abnormal windows.
[0077] 10) Residual threshold: θi=max(Kr×σx,i,θmin) Where Kr is the residual peak determination factor and θmin is the minimum absolute threshold.
[0078] 11) Interference suppression ratio: in, The peak-to-peak value before interference removal. This represents the peak-to-peak value after interference removal.
[0079] 12) The proportion of data that is directly processed: ρ= / ×100% For example, the interval of the buzzer sound =30s, interference cancellation window =90ms, then ρ = 0.09 / 30 × 100% = 0.3%. This indicates that this method only processes a very small proportion of samples near the event, which is more conducive to preserving the original EEG than filtering or deleting the entire segment.
[0080] The parameters involved in this invention are as follows: x[n] represents the original continuous EEG data, and n is the index of the EEG sampling point; y[n] or xclean[n] represents the EEG data after eliminating the synchronous spike interference of the acoustic stimulus, and xclean[n] is uniformly used in this invention; Code[n] represents the signed binary two's complement code value output by AFE / ADC; Vref represents the ADC reference voltage; G represents the PGA gain; Fs represents the EEG sampling rate; ti represents the timestamp of the i-th acoustic stimulus; Δ represents the calibration offset between the acoustic stimulus playback link and the EEG sampling clock; ni represents the EEG sampling point after the timestamp of the i-th acoustic stimulus is converted; Bi represents the baseline window corresponding to the i-th acoustic stimulus, used to estimate local noise; Wi represents the interference cancellation window corresponding to the i-th acoustic stimulus, used for template subtraction and necessary interpolation; Ri represents the physiological response protection window corresponding to the i-th acoustic stimulus, used to protect the real auditory evoked response, and is generally not directly modified; σx,i represents the amplitude noise level within the baseline window of the i-th acoustic stimulus; σd,i represents the amplitude noise level within the baseline window of the i-th acoustic stimulus. The first-order difference noise level; PPi is the peak-to-peak value within the interference cancellation window of the i-th acoustic stimulus; Di is the maximum first-order difference within the interference cancellation window of the i-th acoustic stimulus; Kpp is the preset multiple for peak-to-peak value determination; Kd is the preset multiple for maximum slope determination; wi[k] is the interference cancellation window data corresponding to the i-th acoustic stimulus after removing the local baseline, and k is the sampling point index within the local window; T[k] is the acoustic stimulus synchronous spike interference template generated by multiple local interference windows; αi is the template scaling factor corresponding to the i-th acoustic stimulus; ri[k] is the residual signal after template subtraction; θi is the adaptive residual threshold corresponding to the i-th acoustic stimulus; θmin is the minimum absolute residual threshold allowed by the system; L is the number of sampling points that continuously exceed the residual threshold; Lmax is the maximum number of sampling points corresponding to the narrow spike time threshold; ASR is the interference suppression ratio; PPbefore is the peak-to-peak value before interference cancellation; PPafter is the peak-to-peak value after interference cancellation; ρ is the proportion of data directly processed. Third, when generating the interference template, this invention can align it according to the acoustic stimulus timestamp, the maximum peak point, or the maximum slope point. This is not an arbitrary list, but rather a variety of implementation methods designed to address the potential issues such as time delay jitter, clipping, and waveform asymmetry that may occur in different acquisition states caused by headphone acoustic stimuli.
[0081] (1) Align the sound stimulus timestamps When the headphone playback device can provide a relatively stable sound stimulation timestamp, and the relative delay of the appearance of spike interference in the EEG acquisition channel is relatively stable, sound stimulation timestamp alignment should be given priority.
[0082] For example, the duration of the sound stimulus playback event is EEG sampling rate The corresponding EEG sampling points are: In practical processing, it is possible to Add a fixed delay compensation nearby ,Right now: in, It can be obtained by statistically analyzing the peak positions of the first few acoustic stimulus events.
[0083] This method is suitable for the following scenarios: The acoustic stimuli are played internally by the headphone system at a preset cycle, such as a beep every 30 seconds; the relative time delay between the audio playback link and the EEG acquisition link is stable; the peak interference amplitude is relatively large and the shape is relatively consistent, eliminating the need to re-search for peaks each time. This method has the lowest computational load and is suitable for real-time processing.
[0084] (2) Align with the point of maximum peak When a distinct positive or negative spike appears after each beep, and the spike does not show obvious clipping or saturation, the maximum peak point alignment can be used.
[0085] For the For infrasound stimuli, a search window is selected near the corresponding timestamp position: Find the point of maximum absolute amplitude within this window: Then with This serves as the alignment center for the local interference window.
[0086] This method is suitable for the following scenarios: The spike interference exhibits very distinct positive and negative spikes; the interference amplitude is significantly higher than that of ordinary EEG background noise; and there is slight jitter at the position of the spikes after each acoustic stimulus, occurring at one to several sampling points. This method can avoid the minor time delay bias caused by relying solely on timestamps, thereby improving the template stacking quality.
[0087] (3) Align with the point of maximum slope When spike interference is clipped, saturated, or the positive and negative peaks are asymmetrical, or the position of the maximum peak is unstable, aligning with the point of maximum slope is more reliable.
[0088] The first-order difference within a local window can be calculated: Find the point with the maximum slope within the search window: Then with As an alignment reference.
[0089] This method is suitable for the following scenarios: Clipping occurs in the EEG front end or digital display, causing the peak point to remain near the same amplitude; the leading edge of the peak is very steep, but the peak value is unstable due to saturation or filtering; artifacts caused by acoustic stimulation mainly manifest as rapid edges rather than stable single peaks. In this case, the point of maximum slope is more indicative of the true starting location of the interference than the point of maximum peak value.
[0090] (4) Align by correlation coefficient Based on an existing initial template After that, you can also view the local window each time. Perform cross-correlation alignment within a small range: This method is suitable for situations where several template creations have already been completed and subsequent online template updates are performed. This further demonstrates that the invention does not simply extract data based on time points, but rather utilizes the repeatability of acoustic stimuli to lock artifacts for adaptive alignment.
[0091] Fourth, this invention forms an interference template based on the data quality of the local interference window, the presence of abnormal events, and the stability of acoustic stimulus artifacts.
[0092] This invention adaptively selects the template generation method based on window quality. Specifically, when the number of effective windows is less than a first quantity threshold, or the correlation between windows is low, the median template is used; when the correlation between windows is higher than the correlation threshold and there are no abnormal windows, the average template is used; when there are differences in window quality but the acoustic stimulus synchronization consistency is still met, the weighted average template is used.
[0093] (1) Average template When the local interference window shapes corresponding to multiple acoustic stimuli are highly consistent and there are no obvious abnormal windows, the average value template can be used: This method is suitable for situations with stable laboratory conditions, stable wearing status, fixed beep volume, and minimal changes in electrode contact status. Its advantages include simple calculations and the ability to quickly generate interference templates.
[0094] (2) Median template When some acoustic stimulation windows contain abnormal waveforms such as blinking, masseter muscle, electrode transients, and motion artifacts, the median template should be used preferentially. The median template is insensitive to outlier windows, making it suitable for scenarios like headphone-based EEG where wearing status is prone to slight changes and ear canal contact impedance is easily fluctuating. This method can prevent individual outlier windows from "pulling" the template off-center.
[0095] (3) Weighted average template When the quality of each acoustic stimulus window is different, but most windows still have similar interference patterns, a weighted average template can be used: Weight It can be determined based on factors such as the correlation coefficient between the window and the initial template, the local signal-to-noise ratio, the baseline noise level, and the wearing impedance. For example: in, For the first The correlation coefficient between each window and the template The noise standard deviation is estimated from the baseline window before acoustic stimulation. To prevent small constants with a denominator of zero.
[0096] This method is suitable for long-term continuous data acquisition, slow changes in headphone wearing status, and slight variations in the amplitude of the same buzzer artifact depending on the electrode contact state. It can assign greater weight to high-quality windows and less weight to low-quality windows, thereby improving template stability.
[0097] 5. Even after template subtraction, a small number of residual spikes, clipped peaks, or narrow pulses may still remain. Therefore, a residual threshold needs to be defined to determine which points require short-window interpolation repair and which points should be retained as normal EEG signals. The residual threshold is adaptively determined based on local baseline noise, rather than using a fixed threshold.
[0098] (1) Local baseline noise estimation For the Infrasound stimulation is performed by selecting a baseline window that does not contain spike interference before the sound stimulus occurs. For example, data from 200ms to 50ms before the sound stimulus. First, calculate the baseline median: Then, MAD is used to estimate the standard deviation of local baseline noise: The reason for using MAD instead of standard deviation here is that occasional small spikes or motion artifacts may exist in the headphone EEG, and MAD is more robust to outliers.
[0099] (2) Definition of residual threshold The residual signal after template subtraction is denoted as: in, For the first A local interference window, As an interference template, This is the proportional coefficient for this interference.
[0100] The residual threshold can be defined as: in, 5 to 8 are acceptable. The standard deviation of local baseline noise. The minimum absolute threshold allowed by the system, such as 30μV or 50μV, can be set according to the actual device noise level and EEG sampling gain.
[0101] A point is considered a residual spike when the following conditions are met:
[0102] Alternatively, the peak-to-peak value condition can be met within a short window:
[0103] in A value of 8 to 12 is acceptable.
[0104] (3) Short window interpolation triggering conditions Interpolation is not performed on all points exceeding the threshold; instead, short-window repair is applied only to "narrow spike residues." The following limitations are recommended: When the number of sampling points continuously exceeds the residual threshold satisfy: For example If the duration is between 2 and 20 ms, it is considered a narrow peak residue, which can be repaired using short window interpolation. If the duration exceeds the threshold for too long, forced interpolation is not performed. Instead, the infrasound stimulation window is marked as an abnormal window or a low-confidence window to avoid accidentally deleting real EEG activity.
[0105] (4) Interpolation method For points identified as residual spikes, linear interpolation, cubic spline interpolation, or PCHIP interpolation is performed using the normal points on their left and right boundaries. For example, linear interpolation is: in, , These are the normal sampling points on the left and right sides of the residual peak segment, respectively.
[0106] Based on the above definition, the residual threshold is not subjectively set, but is adaptively calculated from the local EEG noise before each sound stimulus, which can enhance feasibility and creativity.
[0107] VI. The object of processing in this invention is not general random noise, nor ordinary electromyography / blinking artifacts, but rather acoustic stimulus synchronization spike artifacts. This type of artifact presents a unique contradiction: the acoustic stimulus time point itself serves as the event benchmark required for experimental analysis, but the acoustic stimulus also introduces synchronization interference into the EEG pathway. Therefore, it is not possible to simply delete data near the event, nor can bandpass filtering or amplitude interpolation be performed in isolation; otherwise, the true acoustically evoked EEG components will be destroyed.
[0108] The technical solution of this invention achieves the processing of acoustic stimulus synchronization spike artifacts through the following combination: in, To collect brainwaves, This is a real brainwave. As a template for acoustic stimulus synchronization artifacts, This represents the proportion of the intensity of the secondary acoustic stimulus artifact. It is random noise.
[0109] Then, the artifact window is locked using the acoustic stimulus timestamp, and the results are obtained through multi-event statistics. The proportional coefficient for each event is estimated using least squares: Execute again: Finally, interpolation repair is performed only on narrow spike segments that still exceed the residual threshold.
[0110] This entire processing logic is not a simple threshold, simple interpolation, or ordinary template averaging, but a combined processing flow designed to address the generation mechanism, repeatability, event locking characteristics, and EEG protection requirements of "headphone sound stimulus synchronization artifacts".
[0111] VII. This invention addresses the issue of spike interference appearing in the EEG data synchronized with the sound stimulus after it is played through headphones. This spike interference needs to be eliminated without disrupting normal EEG data. This invention deals with acoustic stimulus-synchronized spike artifacts in the EEG channel. When eliminating spike artifacts, it is necessary to preserve any potential auditory evoked EEG responses.
[0112] (1) The present invention has the function of determining the synchronization consistency of acoustic stimulation.
[0113] Not all spikes are processed; only spikes that are synchronized with the timestamp of the acoustic stimulus are processed using the template.
[0114] When the deviation between the location of the spike in the local window and the sampling point corresponding to the timestamp of the acoustic stimulus is less than the preset time deviation threshold, and the amplitude or slope of the spike exceeds the local baseline threshold, it is determined to be acoustic stimulus synchronization spike interference.
[0115] This allows us to distinguish this invention from ordinary amplitude threshold denoising.
[0116] (2) This invention features multi-event consistency screening. Only waveforms that repeatedly appear in multiple acoustic stimulus events are included in the template, avoiding the use of random artifacts as templates. when If the window is valid, it will be considered a valid template window; otherwise, it will be removed or its weight will be reduced.
[0117] (3) Different buzzer volume, frequency, left and right ear playback, and electrode impedance state may lead to different interference patterns, so a template library can be established: in, The frequency of the buzzer sound. To adjust the playback volume, For left / right ear or both ear playback mode, This refers to the electrode contact impedance or signal quality level.
[0118] (4) Since real auditory evoked EEG may occur within a long latency period after sound stimulation, the limited template mainly deals with the peaks in a very short time after sound stimulation, such as narrow peaks within 0-50ms or 0-100ms.
[0119] The template subtraction window is the first time window after the acoustic stimulus timestamp, and the event response analysis window is the second time window. The first time window is shorter than the second time window, and template subtraction is not performed on the non-repetitive peak components in the second time window.
[0120] (5) This invention only processes a small number of events in the locked window, rather than performing strong filtering or global interpolation on the entire EEG, thus preserving the original EEG data to the maximum extent.
[0121] For example, if the buzzer sounds once every 30 seconds, and the single interference processing window is 200ms, then the percentage of data processed is:
[0122] (6) The peak-to-peak value before and after processing can be defined as: Interference suppression ratio is: For example, if the single peak before processing is approximately 230 μV positive and -220 μV negative, then the peak-to-peak value is approximately: If the local peak value decreases to 50 μV after processing, then:
[0123] The alternative solutions to this invention are as follows: template You can set the sound stimulation volume, left and right ear playback channels, buzzer frequency, and headphone working mode separately.
[0124] Peak determination can be accomplished by combining one or more of the following: peak-to-peak value, maximum slope, short-time energy, local kurtosis, and template correlation coefficient.
[0125] Residual repair can be achieved using linear interpolation, cubic splines, PCHIP, AR model prediction, or replacement with adjacent, undisturbed event windows.
[0126] If there are multi-channel EEGs, templates can be created for each channel, or the consistency between channels can be judged after locating the common timestamp.
[0127] In specific embodiments of the present invention, the following examples are provided: Example 1: Offline processing of collected data The headphones play a beeping sound every 30 seconds, and the EEG front end... = Continuous acquisition of EEG data at 250Hz or 500Hz. The timestamp of each beep is recorded by the headset firmware or host computer. The EEG data and timestamp logs are stored in the same file or the same session record.
[0128] First, a fixed offset Δ is obtained through microphone feedback, audio-driven GPIO test points, or a single experimental calibration. Then, press... =round(( +Δ) ) Calculate the EEG sampling points corresponding to each beep.
[0129] For each The baseline window is defined as [-300ms, -100ms], the interference cancellation window is defined as [-10ms, +80ms], and the response protection window is defined as [+80ms, +300ms]. Baseline noise is calculated. and adopt > × or > Determine if there are spike interferences.
[0130] Multiple windows identified as interference are finely aligned based on their maximum slope or peak value, and a median template is generated after subtracting local means. For each beep, calculate... and execute If there are still extremely narrow residual peaks, then short-window interpolation is performed between the effective points on both sides of the residual peaks to obtain... [n].
[0131] After processing, the software outputs the interference-free EEG data, along with the data for each event. , ASR Indicators such as whether interpolation repair is used.
[0132] Example 2: Online processing of real-time EEG data During real-time acquisition, when the audio module emits a beeping playback event, the processor synchronously writes a timestamp. and reserve in the EEG buffer At least 300ms of data is required afterward. Once the complete partial window arrives, perform template subtraction and short window repair as described above, and then... [n] Output to the host computer or subsequent algorithms.
[0133] In online mode, the interference template can be automatically created from the first few beeps, and then slowly updated using a sliding update method: [k] = (1-β) [k] + β [k], where β can be taken as 0.01 to 0.1 to adapt to changes in wearing conditions or contact impedance.
[0134] Example 3: Differentiating between direct interference and real physiological response For auditory evoked response analysis, a response protection window can be set after +80ms. Template subtraction only applies to the -10 to +80ms window or other experimentally confirmed direct interference windows, without directly modifying data from +80 to +300ms. If the research subjects truly need to analyze shorter latency responses such as early ABR, the interference window can be further shortened to -5 to +20ms, and the duration of direct electroacoustic interference can be determined through external speaker control, headphone dummy load control, and human ear wearing control.
[0135] The technical effects of this invention are as follows: In actual testing, the buzzer of this invention operates once every 30 seconds; the peak-to-peak value of a single positive and negative spike is approximately 430–480 μV, while background fluctuations are mostly within the range of ±20–30 μV. Based on an estimated peak value of 450 μVpp and a background value of 60 μVpp, the peak-to-peak value of the spike is approximately 7.5 times the background fluctuation; if estimated based on an effective background noise of 10–15 μVrms, the spike is approximately 30–45 times the effective background noise, making it suitable for identification using a combination of timestamp positioning and local thresholding.
[0136] Regarding the number of sampling points, if =250Hz, a 90ms interference window corresponds to approximately 0.09 × 250 ≈ 23 sampling points; if =500Hz, a 90ms window corresponds to approximately 45 sampling points. When the beep interval is 30s, the interval between adjacent beeps at 250Hz is 7500 sampling points. This method only processes about 23 of these sampling points, accounting for about 0.3%.
[0137] Regarding the interference suppression effect, this invention, if the interference is eliminated... =450μVpp, residual value after algorithm processing If the residual peak is 45 μVpp, then ASR = 20log10(450 / 45) = 20 dB; if the residual peak is reduced to 20 μVpp, then ASR = 20log10(450 / 20) ≈ 27 dB. Compared with direct full-segment low-pass or strong filtering, this method can eliminate large spikes at specific points while reducing the impact on more than 99% of the remaining EEG samples.
[0138] Because this method processes the direct interference cancellation window of -10 to +80 ms and the physiological response protection window of +80 to +300 ms separately, it can reduce the risk of mistakenly deleting real auditory evoked potentials as artifacts.
[0139] For the specific implementation scheme of this embodiment, please refer to the relevant descriptions in the above embodiments, which will not be repeated here.
[0140] It is understood that the same or similar parts in the above embodiments can be referred to each other, and the contents not described in detail in some embodiments can be referred to the same or similar contents in other embodiments.
[0141] It should be noted that in the description of this invention, the terms "first," "second," etc., are used for descriptive purposes only and should not be construed as indicating or implying relative importance. Furthermore, in the description of this invention, unless otherwise stated, "a plurality of" means at least two.
[0142] Any process or method description in the flowchart or otherwise herein can be understood as representing a module, segment, or portion of code comprising one or more executable instructions for implementing a particular logical function or process, and the scope of the preferred embodiments of the invention includes additional implementations in which functions may be performed not in the order shown or discussed, including substantially simultaneously or in reverse order depending on the functions involved, as will be understood by those skilled in the art to which embodiments of the invention pertain.
[0143] It should be understood that various parts of the present invention can be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods can be implemented in software or firmware stored in memory and executed by a suitable instruction execution device. For example, if implemented in hardware, as in another embodiment, it can be implemented using any one or a combination of the following techniques known in the art: discrete logic circuits having logic gates for implementing logical functions on data signals, application-specific integrated circuits (ASICs) having suitable combinational logic gates, programmable gate arrays (PGAs), field-programmable gate arrays (FPGAs), etc.
[0144] Those skilled in the art will understand that all or part of the steps of the methods in the above embodiments can be implemented by a program instructing related hardware. The corresponding program can be stored in a computer-readable storage medium. When the program is executed, it includes one or a combination of the steps of the method embodiments.
[0145] Furthermore, the functional units in the various embodiments of the present invention can be integrated into a processing module, or each unit can exist physically separately, or two or more units can be integrated into a module. The integrated module can be implemented in hardware or as a software functional module. If the integrated module is implemented as a software functional module and sold or used as an independent product, it can also be stored in a computer-readable storage medium.
[0146] The storage media mentioned above can be read-only memory, disk, or optical disk, etc.
[0147] In the description of this specification, references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of the invention. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.
[0148] This invention employs a method, apparatus, processor, and computer-readable storage medium for eliminating spike interference in EEG data caused by headphone-based acoustic stimulation. It addresses the problem in in-ear EEG data acquisition where, when headphones play regular buzzing sounds, prompts, or short stimuli, significant spike interference synchronized with the timing of the acoustic stimulation appears in the EEG data, leading to distortion in subsequent EEG analysis, sleep analysis, attention analysis, auditory evoked response analysis, or algorithm training results. This invention focuses on eliminating interference based on the acoustic stimulation timestamp after it has already appeared in the EEG data, rather than redesigning the entire hardware system.
[0149] In this specification, the invention has been described with reference to specific embodiments thereof. However, it will be apparent that various modifications and variations can be made without departing from the spirit and scope of the invention. Therefore, the specification and drawings should be considered illustrative rather than restrictive.
Claims
1. A method for eliminating brainwave spike interference caused by headphone sound stimulation, characterized in that, The method includes the following steps: (1) Acquire continuous EEG data and simultaneously acquire the timestamp of the sound stimulation played through the headphones; (2) Based on the EEG sampling rate of the continuous EEG data, convert the timestamp into EEG sampling points; (3) A local interference window is extracted around the EEG sampling point, the local interference window including a baseline window, an interference cancellation window and a physiological response protection window; (4) Identify spike interference synchronized with acoustic stimuli based on the local interference window; (5) Align the multiple local interference windows that have been identified as spike interference and remove the local baselines to generate an interference template; (6) For each acoustic stimulus, calculate the template scaling factor of the interference template in the corresponding interference cancellation window. The interference template is proportionally subtracted from the interference elimination window according to the template scaling factor; (7) For saturation points, clipped peaks or narrow spikes that still exceed the adaptive residual threshold after deduction, short-window interpolation is performed using the effective sampling points on both sides of the interference cancellation window. (8) Output the obtained EEG data after eliminating the synchronous spike interference of acoustic stimulation.
2. The method for eliminating EEG spike interference from headphone sound stimulation according to claim 1, characterized in that, The timestamp is the time when the audio playback command is issued, the time when the audio digital-to-analog conversion starts, the time when the speaker driver starts, the time when the Bluetooth audio chip plays, or the actual sound output time after calibration. The step (2) of converting the timestamp into EEG sampling points specifically involves: Convert timestamps to EEG sampling points using the following formula: in, Let be the timestamp of the i-th acoustic stimulus. For EEG sampling rate, For the first The EEG sampling points corresponding to infrasound stimulation.
3. The method for eliminating EEG spike interference from headphone sound stimulation according to claim 1, characterized in that, Step (4) specifically includes the following steps: (4.1) Calculate the noise level σ based on the data within the baseline window; (4.2) Calculate the peak-to-peak value and the maximum first-order difference within the interference cancellation window; (4.3) If the peak-to-peak value within the interference cancellation window is greater than the product of the first preset multiple and the noise level, or if the maximum first-order difference within the interference cancellation window is greater than the product of the second preset multiple and the noise level of the first-order difference of the baseline window, then it is determined that there is acoustic stimulus synchronization spike interference within the interference cancellation window.
4. The method for eliminating EEG spike interference from headphone sound stimulation according to claim 1, characterized in that, Step (5) specifically includes the following steps: (5.1) Perform local baseline subtraction on multiple local interference windows; (5.2) Alignment is performed based on the acoustic stimulus timestamp, the maximum peak point, or the maximum slope point; (5.3) Based on the correlation between multiple local interference windows after alignment and the status of abnormal events, adaptively select the average, median or weighted average method to generate the interference template.
5. The method for eliminating EEG spike interference from headphone sound stimulation according to claim 4, characterized in that, Step (5.3) specifically includes the following steps: If the number of effective local interference windows is less than a first quantity threshold, or the correlation between windows is lower than a first correlation threshold, then the interference template is generated using the median method. If the correlation between windows is higher than the second correlation threshold and there are no abnormal waveform windows, the interference template is generated using the average value method. If the quality of each local interference window differs but the acoustic stimulus synchronization consistency is met, then the weights are determined based on the correlation coefficient between each local interference window and the initial template, as well as the baseline noise level, and the interference template is generated using a weighted average method.
6. The method for eliminating EEG spike interference from headphone sound stimulation according to claim 1, characterized in that, In step (6), the template scaling factor of the interference template in the corresponding interference cancellation window is calculated. Specifically: Calculate the template scaling factor using the following formula. : =S( × ) / Σ( ^2), k∈ in, This represents the baseline-removed interference cancellation window data corresponding to the i-th acoustic stimulus. The data represents the interference template, and k is the index of the sampling point within the interference cancellation window.
7. The method for eliminating EEG spike interference from headphone sound stimulation according to claim 6, characterized in that, In step (6), the interference template is proportionally subtracted from the interference cancellation window according to the template scaling factor. Specifically: The interference template is proportionally subtracted from the interference removal window according to the template scaling factor using the following formula: ; in, To interfere with template data, To eliminate interference in the window data before subtraction, The data after deduction, and It is limited to a preset numerical range.
8. The method for eliminating EEG spike interference from headphone sound stimulation according to claim 1, characterized in that, Step (7) specifically includes the following steps: (7.1) in the Before the infrasound stimulus occurs, a baseline window free of spike interference is selected. Calculate the standard deviation of local baseline noise. ; (7.2) Calculate the residual threshold; (7.3) Calculate the number of sampling points that continuously exceed the residual threshold. If the number of sampling points does not exceed the narrow peak time threshold, it is determined to be a narrow peak residual; otherwise, mark the infrasound stimulation window as an abnormal window or a low confidence window. (7.4) For points that are identified as residual spikes, short-window interpolation is used to repair them by linear interpolation, cubic spline interpolation or PCHIP interpolation.
9. The method for eliminating EEG spike interference from headphone sound stimulation according to claim 1, characterized in that, Step (8) specifically includes the following steps: When outputting EEG data after eliminating synchronous spike interference from acoustic stimulation, a quality index for interference processing is output synchronously for each acoustic stimulation. The quality index includes at least the peak-to-peak value before interference elimination, the peak-to-peak value after interference elimination, the template scaling factor, the residual interference amplitude, whether interpolation repair was performed, and the interference suppression ratio.
10. The method for eliminating EEG spike interference from headphone sound stimulation according to claim 1, characterized in that, The method further includes the following steps: For different sound stimulus volumes, different buzzing frequencies, different left and right ear playback paths, or different electrode contact impedance states, corresponding interference templates are generated and saved to establish an interference template library. When performing interference template subtraction, a matching interference template is called from the interference template library for subtraction based on the current acoustic stimulus conditions and the status of the acquisition device.
11. A device for eliminating brainwave spike interference from headphone sound stimulation, characterized in that, The device includes: A processor is configured to execute computer-executable instructions; The memory stores one or more computer-executable instructions, which, when executed by the processor, implement the steps of the method for eliminating EEG spike interference from headphone sound stimulation as described in any one of claims 1 to 10.
12. A processor for eliminating brainwave spike interference from headphone sound stimulation, characterized in that, The processor is configured to execute computer-executable instructions, which, when executed by the processor, implement the steps of the method for eliminating EEG spike interference from headphone sound stimulation as described in any one of claims 1 to 10.
13. A computer-readable storage medium, characterized in that, It stores a computer program that can be executed by a processor to implement the steps of the method for eliminating EEG spike interference from headphone sound stimulation as described in any one of claims 1 to 10.