 We're still on the EEG2 music conversion generator, it works but it sounds horrible as expected, so we try to improve it by doing a frequency shifting or some fancier interpolation So we had a linear interpolation in the code, but that I don't see it anymore somehow disappeared Yeah, this conversion Yes, this does look a rhythmic So why the current conversion it generates too many zero Hertz Should be odd just make the output volume lower because it's It's really horrendous This is channel zero actually all of them was zero a zero Hertz I don't know why then chill ten I think give some frequencies Yeah, the mapping mapping isn't Correct. So one thing because it's suggesting adding a new function We need a new function Probably not Frequencies Already doing scaling Scale AG to midi so instead of a new function Can we update the current one that we already have? Because most of the time the frequencies are just zero and our time the frequencies are very low So they end up being that Lower lowest frequency note underscore underscore midi function to incorporate frequency shifting and scaling The idea is to modify the function to handle zero frequencies as rests and apply a shift non-zero frequencies before scaling them to midi range Why am I having too many zero? Frequencies to begin with this is updating scale also shifting the values Before implementing that Why do I get so many zero Hertz? Frequencies to begin with Getting many zero HZ frequencies from your EEG data when performing FFT fast Fourier transform We're triggered to several factors related to the nature of EEG signals the way FFT is implemented and the specifics of your data Here are some key points to consider Low variation EEG signals often have periods of low variation especially in a relaxed or steady state which result in a dominant frequency of zero Artifacts EEG data can contain artifacts or noise. They're not related to brain activity such as electrical interference or movement artifacts Yes, I do not expect zero frequencies can take a F1 instead of F naught Windows eyes the size of the data segment window use free Jeff FD calculation significantly affects the result If the window is too small, it may not capture enough data to accurately represent the frequency content Conversely, if it's too large, they might have read out the variations over time. Yes, currently it's 300 200 will be It's a Window size of half and half a second Signal processing if the signal is not properly processed before FFT EEG the trending applying a window function It can influence the outcome potentially leading to a dominant frequency of zero. So we're applying So we comment that out the window function Probably should bring it back. Maybe with a different Window type sampling rate the sampling rate of your EEG data determines the frequency resolution A low sampling rate might not capture higher frequency details Quantization error if the EEG data is digitized with low resolution It might not capture subtle changes leading to periods where the signal appears flat So I'm actually not quantized down something or anything at this stage If the EEG signal has a low SNR the actual brain wave signals might be masked by noise resulting in unclear frequency representation We don't have noise in this. This should be a clear a clear EEG One thing though and notice you might need a Yeah, why did to apply a window to the trend this? Yeah, because it said has to remove the DC component from it Can window function be used for the trending? Assume it will say Okay, how do we apply the trending? We're using NumPy With defining a function We need to do it manually since they have existing function for this Okay, you need to fix the data section not called data hitting a polynomial and Subtracting the trend and should be able to display this as well. Well, right. So this trending Each segment independently, so that's not what I want to display On the graph. Yeah, let's do this. This looks legit Hey, we don't need this because we already have it up top Trend function. I don't know dominant frequencies in the function itself for each segment break Have a detrend and then the FFT result Typically a number a or a list of voltage values Segmentation apply the trending to each segment of the EEG data if you're processing the data in chunks. Otherwise apply it to the whole data set Window function if you're also applying a window function that after the trending and write before the FFT Generate the whole Get dominant frequencies function Yes, this is replacing All this beat called that because we already have it trend dot Then we doing everything else on the detrended segment instead of segment Still running the thing. Yes, just clear that terminal and I expected to go Yes, a lot of 21s in there. I couldn't hear the beginning of it. There it is This was a seizure sounds like it was a matter of the problem was that the signal wasn't detrended Detrending definitely helped Still of 21s in it. Just wondering if there and Different no where it is Segment these seconds. Yeah, the segments are too small So problem those fixed it could be random So the something right this 100 so if we have Essentially if 100 will have a full notes Second The second of EEG makes it also slower. Yeah, that would be much more improvements needed So this is just a large number that loads the whole the whole seizure Getting the data that's still thinking Bounding 21s. Yeah, this will keep the bounding 21s 20 was better There will be some sort of ideal 40 quickly same channel zero This is a very large number to load the whole seizure the whole data might continue Next time hopefully it will be more palatable the EEG music Seesha seesha seesha song. I'll see you next time