summaryrefslogtreecommitdiff
path: root/src/main.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.cc')
-rw-r--r--src/main.cc15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/main.cc b/src/main.cc
index 0bc28d6..9d7c41b 100644
--- a/src/main.cc
+++ b/src/main.cc
@@ -62,11 +62,13 @@ int generate_melody() {
srand(12345); // Fixed seed for reproducibility
for (int i = 0; i < 128; ++i) {
- if (i % 4 == 0) continue; // Rest on beat 1 of every bar
+ if (i % 4 == 0)
+ continue; // Rest on beat 1 of every bar
NoteParams params = {};
params.base_freq = notes[rand() % num_notes];
- if (rand() % 4 == 0) params.base_freq *= 2.0f; // Occasional octave up
+ if (rand() % 4 == 0)
+ params.base_freq *= 2.0f; // Occasional octave up
params.duration_sec = (rand() % 2 == 0) ? 0.2f : 0.4f;
params.amplitude = 0.4f;
@@ -80,12 +82,14 @@ int generate_melody() {
params.amp_randomness = 0.05f;
int note_frames = 0;
- std::vector<float> note_data = generate_note_spectrogram(params, &note_frames);
+ std::vector<float> note_data =
+ generate_note_spectrogram(params, &note_frames);
// Apply some post-processing for texture
apply_spectral_noise(note_data, note_frames, 0.2f); // Add grit
if (i % 2 == 0) {
- apply_spectral_comb(note_data, note_frames, 10.0f, 0.8f); // Phaser-like effect
+ apply_spectral_comb(note_data, note_frames, 10.0f,
+ 0.8f); // Phaser-like effect
}
// Calculate offset in frames
@@ -94,7 +98,8 @@ int generate_melody() {
float beat_time = i * SECONDS_PER_BEAT;
int frame_offset = (int)(beat_time * 32000.0f / DCT_SIZE);
- paste_spectrogram(g_melody_data, &melody_frames, note_data, note_frames, frame_offset);
+ paste_spectrogram(g_melody_data, &melody_frames, note_data, note_frames,
+ frame_offset);
}
Spectrogram spec;