diff options
| author | Akshay Nair <phenax5@gmail.com> | 2026-06-12 14:44:38 +0530 |
|---|---|---|
| committer | Akshay Nair <phenax5@gmail.com> | 2026-06-17 22:55:59 +0530 |
| commit | 54746411fef4a35461898429f33c230d4eab3f65 (patch) | |
| tree | 86b7bff0172968bd7487edcaade5c28514425009 /src/spectrogramming.audio.sql | |
| parent | c0275bd8747f36daccee968cb82caf34bc7ed7d6 (diff) | |
| download | sqlite-creative-coding-54746411fef4a35461898429f33c230d4eab3f65.tar.gz sqlite-creative-coding-54746411fef4a35461898429f33c230d4eab3f65.zip | |
Some cool alien shit with spectrogram
Diffstat (limited to '')
| -rw-r--r-- | src/spectrogramming.audio.sql | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/spectrogramming.audio.sql b/src/spectrogramming.audio.sql new file mode 100644 index 0000000..3add75f --- /dev/null +++ b/src/spectrogramming.audio.sql @@ -0,0 +1,15 @@ +INSERT OR REPLACE INTO audio_tracks (id, sample_rate, format) VALUES ('spectrogramming', 8000, 'u8') RETURNING id; + +WITH RECURSIVE + audio AS + (SELECT *, 160 AS gain FROM audio_tracks WHERE id = 'spectrogramming'), + note_positions(position) AS + (SELECT 0 UNION ALL + SELECT position + 1 FROM note_positions, audio + WHERE position < 100000), + samples(value, position) AS + (SELECT + (100.0*SIN(position * 2.0 / sample_rate) + 1.0) / 2.0 * gain + , position + FROM note_positions, audio) +INSERT INTO audio_track_samples (audio_track_id, value, position) SELECT 'spectrogramming', value, position FROM samples ORDER BY position; |
