foortex.codegen utility
PythonNeurotech 890 12.1k

Python Real-Time EEG & BCI Signal WebSocket Streaming Service

Low-latency Python WebSocket server designed for Brain-Computer Interface (BCI) applications and neural signal processing. Receives high-frequency EEG channel packets, applies digital SciPy Butterworth FIR bandpass filters (8-30Hz Alpha/Beta waves), and streams real-time feature vectors.

Zero-copy NumPy ring-buffer for continuous 250Hz multichannel arrays
SciPy signal.butter and sosfilt for zero-phase digital filtering
Interactive Prompt & Options
Fully Editable
EEG Sampling Frequency (Hz)

Appended directly to the LLM system prompt for tailored code output.

✨ OpenRouter LLM Engine (Llama-3.3-70B) Active

Generated Code

⚡ Instant Boilerplate
python-websocket-eeg-parser.py
1import asyncio
2import json
3import numpy as np
4from scipy.signal import butter, sosfilt
5import websockets
6
7SAMPLING_RATE = 250
8CHANNELS = 8
9sos_filter = butter(4, [8.0/125.0, 30.0/125.0], btype='band', output='sos')
10
11async def handler(websocket):
12 async for message in websocket:
13 data = json.loads(message)
14 raw = np.array(data.get("channels", [0.0]*8))
15 filtered = sosfilt(sos_filter, raw)
16 await websocket.send(json.dumps({"filtered": filtered.tolist()}))
17
18async def main():
19 async with websockets.serve(handler, "0.0.0.0", 8765):
20 await asyncio.Future()
21
22if __name__ == "__main__":
23 asyncio.run(main())
24
24 lines • 650 bytespython
Automated Sandbox

Deploy this boilerplate automatically in 1 click.

Deploy