From 8e199322ea4cb51d81c29d84120e4b142f7241b5 Mon Sep 17 00:00:00 2001 From: skal Date: Sat, 31 Jan 2026 00:43:16 +0100 Subject: add notes --- src/audio/gen.h | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 src/audio/gen.h (limited to 'src/audio/gen.h') diff --git a/src/audio/gen.h b/src/audio/gen.h new file mode 100644 index 0000000..f490115 --- /dev/null +++ b/src/audio/gen.h @@ -0,0 +1,38 @@ +// This file is part of the 64k demo project. +// It defines the procedural audio generation interface. +// Shared between the offline spectool and the runtime demo. + +#pragma once +#include + +struct NoteParams { + float base_freq; + float duration_sec; + float amplitude; + float attack_sec; + float decay_sec; // Unused for now + float vibrato_rate; + float vibrato_depth; + int num_harmonics; + float harmonic_decay; + float pitch_randomness; + float amp_randomness; +}; + +// Generates a single note into a new spectrogram buffer +std::vector generate_note_spectrogram(const NoteParams ¶ms, + int *out_num_frames); + +// Pastes a source spectrogram into a destination spectrogram at a given frame +// offset Expands destination if necessary +void paste_spectrogram(std::vector &dest_data, int *dest_num_frames, + const std::vector &src_data, int src_num_frames, + int frame_offset); + +// Post-processing effects +void apply_spectral_noise(std::vector &data, int num_frames, + float amount); +void apply_spectral_lowpass(std::vector &data, int num_frames, + float cutoff_ratio); +void apply_spectral_comb(std::vector &data, int num_frames, + float period_bins, float depth); -- cgit v1.2.3