summaryrefslogtreecommitdiff
path: root/src/audio/gen.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/audio/gen.h')
-rw-r--r--src/audio/gen.h38
1 files changed, 38 insertions, 0 deletions
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 <vector>
+
+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<float> generate_note_spectrogram(const NoteParams &params,
+ 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<float> &dest_data, int *dest_num_frames,
+ const std::vector<float> &src_data, int src_num_frames,
+ int frame_offset);
+
+// Post-processing effects
+void apply_spectral_noise(std::vector<float> &data, int num_frames,
+ float amount);
+void apply_spectral_lowpass(std::vector<float> &data, int num_frames,
+ float cutoff_ratio);
+void apply_spectral_comb(std::vector<float> &data, int num_frames,
+ float period_bins, float depth);