Theremin Sensor Controller IP - fpga-theremin/theremin GitHub Wiki
Requirements
- Low latency (<= 1 sample interval - 1/48000 of second)
- High precision and sensitivity
- AXI4Lite interface with PS (CPU)
Oscillator output
Oscillator output is 3'3V logic level signal with duty cycle near to 50%.
The goal of theremin sensor is to convert oscillator frequency to:
- note number and note frequency for pitch antenna signal
- volume multiplier for volume antenna
Pitch antenna signal processing stages
- Measure signal period
- Moving average filter with adjustable window length (1..1024)
- Scale to 000000..FFFFFF range for working range of hand distance, clamp to 000000 or FFFFFF if distance exceeds range
- Convert scaled period value to distance from hand to antenna using lookup table and linear interpolation
- Convert distance to note number using lookup table and interpolation
- Convert note number to pitch phase increment (fractional part of 0x1000000 of phase increment for single sample) - lookup table and interpolation
Volume antenna signal processing stages
- Measure signal period
- Moving average filter with adjustable window length (1..1024)
- Scale to 000000..FFFFFF range for working range of hand distance, clamp to 000000 or FFFFFF if distance exceeds range
- Convert scaled period value to distance from hand to antenna using lookup table and linear interpolation
- Convert distance to volume multiplier