diff options
| author | skal <pascal.massimino@gmail.com> | 2026-01-31 00:43:16 +0100 |
|---|---|---|
| committer | skal <pascal.massimino@gmail.com> | 2026-01-31 00:43:43 +0100 |
| commit | 8e199322ea4cb51d81c29d84120e4b142f7241b5 (patch) | |
| tree | 905e387f1c346ebcf2a8fb03f07e7789314d9ed9 /src/audio/gen.h | |
| parent | 0f757ca901dbf00a953a39bd2d452ff423a45969 (diff) | |
add notes
Diffstat (limited to 'src/audio/gen.h')
| -rw-r--r-- | src/audio/gen.h | 38 |
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 ¶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<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); |
