MoonSpectrum 是一个面向 MoonBit 生态的科学信号处理基础库,提供复数运算、DFT/FFT、频谱分析、窗函数、卷积、基础 FIR 滤波和命令行分析工具。 项目聚焦“可复用、可验证、可扩展”的工程基础能力,适用于传感器数据、实验数据、振动信号、周期信号、教学示例和边缘计算前处理。 与已有音频 DSP/音频引擎类项目不同,MoonSpectrum 不绑定具体播放、采集或音频后端,而是
版权所有:中国计算机学会技术支持:开源发展技术委员会
京ICP备13000930号-9
京公网安备 11010802047560号
MoonSpectrum
MoonSpectrum 是一个面向 MoonBit 生态的科学信号处理基础库。它提供复数运算、DFT/FFT、频谱分析、窗函数、卷积、基础 FIR 滤波和命令行分析工具,目标是补齐 MoonBit 在传感器数据、实验数据、振动信号、周期信号和教学验证中的基础算法能力。
本项目不做音频播放、采集或设备后端,也不依赖 native FFI。当前版本已覆盖 STFT、periodogram/Welch PSD、IIR 滤波、重采样、跨通道相关分析和频谱特征;后续再扩展流式输入、时间戳管线和 WebAssembly 可视化。
Why
MoonBit 已经有一些音频、图形、矩阵和工程工具包,但通用科学信号处理方向还缺少一个小而稳的基础库。MoonSpectrum 的定位是:
Installation
MoonSpectrum is a MoonBit module. The repository is the source distribution; the published module metadata and dependency version are recorded in
moon.mod.From the repository
Install the current MoonBit toolchain from the official installer, then clone the repository and refresh its pinned dependency:
The competition notice recommended MoonBit 0.10.3. The CLI package keeps the backward-compatible
options("is-main": true)declaration, so it works with the committee toolchain and newer official releases. Because newer formatters try to migrate that legacy declaration, CI usesscripts/check_format.py: it runs the official formatter against every.mbtsource and structurally checks the intentional legacy package file. CI printsmoon version --allso the exact compiler is visible. If starting a new copy instead of using the committedmoon.mod, the equivalent dependency command ismoon add moonbitlang/x@0.4.45.Features
Complex复数类型:加减乘、缩放、幅值、近似比较。demo、fft、analyze、window、convolve、stft、psd、resample、biquad、stats、correlate、welch、peaks。Quick Start
Typical output:
API Sketch
The root package exports the public API. CLI code lives in
cmd/mainand uses the same library functions as users would.Project Layout
complex.mbt- complex arithmetic and approximate comparisons.fft.mbt- DFT, FFT, inverse FFT, real signal conversion.analysis.mbt- spectra, frequency bins, peak detection.signals.mbt- test/demo signal generation.windows.mbt- window functions and window application.convolution.mbt- linear and circular convolution.filters.mbt- moving average, FIR filtering, low/high-pass taps.stft.mbt,psd.mbt,resampling.mbt,iir_filters.mbt- extended scientific signal-processing primitives.cmd/main- CLI entry point.examples- small CSV fixtures for smoke tests.docs/fixtures.md- fixture provenance, construction rules, and expected numeric invariants.docs/competition- OSC2026 proposal and acceptance material.Verification
The extended analysis commands are also covered by deterministic smoke tests:
Release Links
MoonSpectrum is published as the Mooncakes module
chgttyyr/MoonSpectrum@0.2.2. Themoon.modfile is the source of truth for the package metadata shown on Mooncakes.Current Boundaries
Roadmap
License
Apache-2.0.