blob: 94f4ee36df3110e1811bb0d7484f8dc3f0ee0995 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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);
|