forked from genewildish/Mainline
feat: Add LFO mode options to oscilloscope demo
- Add --lfo flag for slow modulation (0.5Hz) - Add --fast-lfo flag for rhythmic modulation (5Hz) - Display frequency type (LFO/Audio) in output - More intuitive LFO usage for modulation applications Usage: uv run python scripts/demo_oscilloscope.py --lfo --waveform sine uv run python scripts/demo_oscilloscope.py --fast-lfo --waveform triangle
This commit is contained in:
@@ -116,7 +116,12 @@ def demo_oscilloscope(
|
||||
frames: int = 0,
|
||||
):
|
||||
"""Run oscilloscope demo."""
|
||||
print(f"Oscilloscope demo: {waveform} wave at {frequency}Hz")
|
||||
# Determine if this is LFO range
|
||||
is_lfo = frequency <= 20.0 and frequency >= 0.1
|
||||
freq_type = "LFO" if is_lfo else "Audio"
|
||||
|
||||
print(f"Oscilloscope demo: {waveform} wave")
|
||||
print(f"Frequency: {frequency}Hz ({freq_type} range)")
|
||||
if frames > 0:
|
||||
print(f"Running for {frames} frames")
|
||||
else:
|
||||
@@ -164,7 +169,17 @@ if __name__ == "__main__":
|
||||
"--frequency",
|
||||
type=float,
|
||||
default=1.0,
|
||||
help="Oscillator frequency in Hz",
|
||||
help="Oscillator frequency in Hz (LFO: 0.1-20Hz, Audio: >20Hz)",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--lfo",
|
||||
action="store_true",
|
||||
help="Use LFO frequency (0.5Hz - slow modulation)",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--fast-lfo",
|
||||
action="store_true",
|
||||
help="Use fast LFO frequency (5Hz - rhythmic modulation)",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--frames",
|
||||
@@ -174,8 +189,16 @@ if __name__ == "__main__":
|
||||
)
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
# Determine frequency based on mode
|
||||
frequency = args.frequency
|
||||
if args.lfo:
|
||||
frequency = 0.5 # Slow LFO for modulation
|
||||
elif args.fast_lfo:
|
||||
frequency = 5.0 # Fast LFO for rhythmic modulation
|
||||
|
||||
demo_oscilloscope(
|
||||
waveform=args.waveform,
|
||||
frequency=args.frequency,
|
||||
frequency=frequency,
|
||||
frames=args.frames,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user