diff --git a/CLAUDE.md b/CLAUDE.md index a1d7116..3d7c1b2 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -60,7 +60,10 @@ Source/PluginEditor.* window, header (logo, status, layer chips, ?, gear), f Source/SettingsPanel.* settings overlay and color pickers Source/Themes.h color themes Source/UISettings.h saved display preferences (colors, opacity, visibility, toggles) -Tests/RenderTest.cpp offline sync checks with a fake host + PNG renders of the UI +Tests/RenderTest.cpp offline sync checks with a fake host + PNG renders of the UI; + `--site ` renders the README/website screenshots +Tests/make_site_images.py turns those renders into README PNGs and website WebP/JPEG/MP4 +Tests/audio/ the owner's kick and bass for the screenshots (AGPLv3, see README there) ``` The audio thread writes into preallocated buffers (`maxDisplaySamples = 1 << 21` per @@ -78,8 +81,7 @@ cd /tmp && ./path/to/build/RenderTest_artefacts/Release/RenderTest # writes re ``` Look at the renders yourself before reporting UI changes, and send the user the relevant -PNGs. RenderTest also writes the README screenshots (`render_docs_*`), which belong in -`docs/images/`. +PNGs. Windows is only built by GitHub Actions (`.github/workflows/build-windows.yml`). MSVC is stricter than GCC. A known trap: capturing `this` inside a nested lambda's init-capture. @@ -92,79 +94,52 @@ bump `project(Smartscope VERSION x.y.z)` in `CMakeLists.txt`, add a `## [x.y.z]` to `CHANGELOG.md`, and push to `main`. The workflow creates the `vX.Y.Z` tag and a GitHub Release with `Smartscope-vX.Y.Z-Windows-VST3.zip`, using that changelog section as the notes. Cloud sessions can't push tags, which is why the workflow creates them. After a -release, update the version on the product page in `claeslanng/claeslanng.github.io`. +release, update the version on the product page in `claeslanng/claeslanng.github.io`, +and if the UI changed, rerender the screenshots (see Screenshots). ## Open ideas (not started) - **v2: inter-instance overlay.** Show another instance's signal (e.g. the kick track) behind this one without sidechain routing, like Scyllascope's overlays. -- **Real screenshots.** The product page now uses real FL Studio captures only (since - 2026-11-19, done in the website conversation): `main.webp`, `zoom.webp`, four - `theme-*.webp`, `settings.webp`, plus `main-share.jpg` for social previews and a short - demo video (`drag-loop.mp4`). They're lossless WebP at full size, in - `assets/img/smartscope/` in the site repo, framed by a 1 px outline instead of soft - shadows (the owner found those low quality). In this repo, the README's - `docs/images/fl-studio.png` (top image) and `docs/images/fullscreen.png` ("Make it big") - are real captures added by hand. `zoom.png`, `themes.png` and `settings.png` are still - RenderTest renders fed with made-up audio. The next item replaces both kinds. - -- **RenderTest renders the website screenshots (after 1.2.0).** The owner doesn't want - to capture everything by hand for every release. **Don't start this until the 1.2.0 - features are finished** (the owner's call). Full plan: - `smartscope-website-handoff.md` from the website conversation, and the site repo's - CLAUDE.md. - - **Test audio:** on the **`screenshot-audio`** branch, in `Tests/audio/` (not merged; - merge it first when this starts). Both files are 4 bars at 128 BPM (7.5 s), 44.1 kHz - stereo, and start on the downbeat at the same sample. A README there says they're - under the repo's AGPLv3, and the owner knows the repo is public. - - `Smartscope Audio-Visual Test - Kick 1.wav`: one kick per beat, about 175 ms long, - 16-bit. It goes into **sidechain 1**. - - `Smartscope Audio-Visual Test - Bass 1.wav`: the bass with sidechain ducking - already applied, coming back about 4 ms after each kick ends. 24-bit. It goes into - the **main input**. (This is the second, tighter take.) - - **How:** load both WAVs in RenderTest and run them through the processor with the - fake playhead playing at 128 BPM, so the window buffers fill as in FL. Render at - **2× scale** (`createComponentSnapshot (bounds, true, 2.0f)`) at a window size that - gives about **2280 × 784 px**, the shape of the current site images. Play cursor - off; there's no mouse, so there's no hover readout. Layer opacity at 100%. - - **Keep it in the RenderTest target.** The shipping VST3 gets no hidden mode, and its - audio path isn't touched. - - **Output:** lossless PNGs in a folder of their own (e.g. `docs/images/site/`) or as - an Actions artifact. The website side converts them to WebP and swaps them in. - - | File | Settings | - |---|---| - | `site_main.png` | Graphite, length 1/2, playing, SC 1 kick orange, main bass light gray | - | `site_zoom.png` | The first ~14 ms of a kick, about Zoom x68 | - | `site_theme_graphite.png` | Orange kick, light gray bass (the defaults) | - | `site_theme_midnight.png` | Cyan kick (about `#40D0FF`), white bass | - | `site_theme_phosphor.png` | Amber kick (about `#FFC23D`), phosphor-green bass (about `#6CFF8A`) | - | `site_theme_daylight.png` | Near-black bass, deep blue (`#2563EB`) or red (`#E5484D`) kick; pale colors get lost on the light background | - | `site_settings.png` | Settings open, Graphite, **no audio behind it**, 2× so the text is sharp | - | `site_drag_####.png` | Frames for the demo video (below) | - - The four theme shots use the same audio, view and position, so only the look - changes. The site names the colors in the captions, so people know the colors are - chosen separately from the theme. - - **Demo video frames:** about Zoom x27 on a two-bar window, playback stopped, a - scripted smooth pan of exactly **one beat** (468.75 ms at 128 BPM). Every beat has the - same kick, so the last frame matches the first and the video loops without a seam - (the current one needed a blend). 30 or 60 fps at 2×. The website side encodes a - muted H.264 MP4. - - **Page text is tied to the images.** If renders show something different, the site - text has to change too: the main caption (kick on SC 1 orange over the bass gray, - half a bar), the zoom text ("first 14 ms… zoomed in 68 times", "the bass (white) - hasn't started yet"), the video text (x27, two bars, stopped, kick to kick), and the - features list. - - **Later, optional:** a GitHub Actions job runs RenderTest on each release and pushes - the images (and the version number) into `claeslanng/claeslanng.github.io`. It needs a - token or deploy key with write access there, added by the owner as a repo secret. - - **Until then, hand captures:** enlarge the window to about 2000 px wide (or Windows - scaling 200%), press Hold, turn off the play cursor, keep the mouse out, and capture - just the plugin without FL's frame. Send PNGs attached in the chat, not Gyazo links. - For video, use the Snipping Tool's video mode at full size, starting and ending on the - same view. - - **Same approach later for PitchScope**, whose site images are small 840 px JPEGs. +- **Automatic screenshots on release (optional, not set up).** A GitHub Actions job + could run `RenderTest --site` and `make_site_images.py` on each release and push the + images (and the version number) into `claeslanng/claeslanng.github.io`. It needs a token + or deploy key with write access there, added by the owner as a secret in this repo. +- **PitchScope** could get the same rendered screenshots (its site images are small + 840 px JPEGs). + +## Screenshots (README and product page) + +All of them are rendered, not captured (since 1.2.0), so they never need a hand capture +for a release. After a UI change, rerender and publish both: + +```bash +build/RenderTest_artefacts/Release/RenderTest --site /tmp/renders +python3 Tests/make_site_images.py /tmp/renders --readme docs/images \ + --site ../claeslanng.github.io/assets/img/smartscope +``` + +- **Input:** the owner's real audio in `Tests/audio/`, 4 bars at 128 BPM, 44.1 kHz: the + kick goes into **sidechain 1**, the ducked bass into the **main input**. The fake playhead + plays the whole loop, so the buffers fill as in FL. Play cursor off, no mouse (no hover + readout), layer opacity 100%, 2x scale (`createComponentSnapshot (…, true, 2.0f)`). + The screenshot mode lives only in RenderTest: the plugin has no hidden mode. +- **Output (`--site`):** `site_main` (Graphite, 1/2 bar, 1140 × 392 → 2280 × 784 px), + `site_zoom` (first ~14 ms of a kick, Zoom x68), `site_theme_*` (same audio and view; + Graphite defaults, Midnight white bass + `#40D0FF` kick, Phosphor `#6CFF8A` bass + + `#FFC23D` kick, Daylight default near-black bass + `#2563EB` kick), `site_settings` + (just the card, no audio behind it, default display options), and `drag_frames/` + (192 frames at 30 fps: Zoom x27 on a two-bar window, sliding one beat to the next kick + and back, eased, with holds). +- **Why the loop goes back and forth:** the ruler labels are positions in the window, so a + one-way pan of one beat would jump at the seam, even though every kick is identical. +- **README** gets `main.png`, `zoom.png`, `themes.png` (2 × 2 grid) and `settings.png`. + `fl-studio.png` (two windows in FL) and `fullscreen.png` (a second monitor) are the + owner's hand captures from 1.1 and stay as they are. +- **Website** gets `main.webp`, `zoom.webp`, `theme-*.webp` (1140 px), `settings.webp` + (shown at half its pixel size), `main-share.jpg` (1200 px) and `drag-loop.mp4` + poster + (1280 × 440). The site's captions name what's in the images (layer colors per theme, + Zoom x68 / 14 ms, x27 / two bars): change them if the renders change. ## Selling points the owner wants promoted diff --git a/CMakeLists.txt b/CMakeLists.txt index 7d06d0d..90a7052 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -67,7 +67,8 @@ if(SMARTSCOPE_BUILD_TESTS) target_include_directories(RenderTest PRIVATE Source) target_compile_definitions(RenderTest PRIVATE JUCE_WEB_BROWSER=0 JUCE_USE_CURL=0 SMARTSCOPE_TEST_BUILD=1 - "SMARTSCOPE_VERSION=\"${PROJECT_VERSION}\"") + "SMARTSCOPE_VERSION=\"${PROJECT_VERSION}\"" + "SMARTSCOPE_SOURCE_DIR=\"${CMAKE_CURRENT_SOURCE_DIR}\"") target_link_libraries(RenderTest PRIVATE juce::juce_audio_utils juce::juce_dsp juce::juce_gui_extra juce::juce_recommended_config_flags) diff --git a/README.md b/README.md index 4cefb5f..a22119b 100644 --- a/README.md +++ b/README.md @@ -14,8 +14,8 @@

- Two Smartscope windows in FL Studio: a drums track with kick, clap and perc on three sidechain layers, and a bass track with the kick on sidechain 2 -
In FL Studio. Top: drums, with the kick (orange), clap (blue) and a perc hit (purple) on sidechains 1 to 3. Bottom: the bass (gray) with the kick on sidechain 2 (blue). + Smartscope showing half a bar: a kick on sidechain 1 in orange, and the bass on the same track in light gray coming in as the kick dies away +
A kick on sidechain 1 (orange) over the bass on the same track (gray), half a bar long.

--- @@ -48,8 +48,8 @@ The plugin passes audio through unchanged, so it's safe on any track or on the m | **Scope only** | One click hides the header and controls so only the display is left. |

- Zoomed in: the bass starts about 18 ms after the kick -
Zoomed in: the bass (gray) starts about 18 ms after the kick (orange). + Smartscope zoomed in 68 times on the first 14 milliseconds of a kick +
The first 14 ms of the kick (orange), zoomed in 68 times. The bass (gray) hasn't started yet.

## Make it big @@ -74,6 +74,11 @@ It also goes small, down to 240 × 110. As the window shrinks, the status text, Click a chip in the header to show or hide that layer. Colors and opacity are in **Settings**. +

+ Two Smartscope windows in FL Studio: a drums track with kick, clap and perc on three sidechain layers, and a bass track with the kick on sidechain 2 +
In FL Studio. Top: drums, with the kick (orange), clap (blue) and a perc hit (purple) on sidechains 1 to 3. Bottom: the bass (gray) with the kick on sidechain 2 (blue). +

+ ## Mouse | Over the display | Does | @@ -91,7 +96,7 @@ When the transport is stopped, the scope free-runs at the project tempo while th

Graphite, Midnight, Phosphor and Daylight themes -
Graphite · Midnight · Phosphor · Daylight +
Graphite (orange kick, light gray bass) · Midnight (cyan, white) · Phosphor (amber, green) · Daylight (deep blue, near-black). Layer colors are chosen separately from the theme.

The gear button opens **Settings**: @@ -101,7 +106,7 @@ The gear button opens **Settings**: - Display options: hover readout, play cursor, 0 dB markers, main layer on top.

- Settings panel + Settings: a color, hex code, opacity and show toggle for each layer, random and reset colors, the theme, display options and About

## Building from source @@ -115,13 +120,20 @@ cmake --build build --config Release --target Smartscope_VST3 The plugin ends up in `build/Smartscope_artefacts/Release/VST3/`. -There's also an offline test that feeds synthetic audio through the plugin with a fake host. It checks the tempo sync and renders screenshots of the UI: +There's also an offline test that feeds synthetic audio through the plugin with a fake host. It checks the tempo sync, the layout and the settings, and renders the UI to PNG files: ```sh cmake -B build -DSMARTSCOPE_BUILD_TESTS=ON cmake --build build --config Release --target RenderTest ``` +The screenshots in this README and on the [product page](https://claeslanng.shop/smartscope/) come from the same program. It plays a real kick and bass (in `Tests/audio/`) through the plugin and renders at 2x: + +```sh +RenderTest --site renders +python3 Tests/make_site_images.py renders --readme docs/images --site path/to/claeslanng.github.io/assets/img/smartscope +``` + ### Releases Every push builds the plugin on GitHub Actions. To publish a new version: @@ -142,7 +154,9 @@ Source/ SettingsPanel.* themes, layer colors, display options, about Themes.h color themes UISettings.h saved display preferences -Tests/RenderTest.cpp offline sync checks and UI renders +Tests/RenderTest.cpp offline checks, UI renders, and the screenshot mode (--site) +Tests/make_site_images.py turns the renders into README and website images +Tests/audio/ the kick and bass the screenshots are rendered with docs/images/ screenshots used in this README ``` diff --git a/Source/SettingsPanel.h b/Source/SettingsPanel.h index ca6060b..02baf98 100644 --- a/Source/SettingsPanel.h +++ b/Source/SettingsPanel.h @@ -48,6 +48,9 @@ class SettingsPanel : public juce::Component, /** Give sidechains 1-3 new random colours (the dice button). */ void randomiseSidechainColours(); + /** The settings card, in this component's coordinates (for screenshots). */ + juce::Rectangle getCardBounds() const noexcept { return panelBounds; } + void paint (juce::Graphics&) override; void resized() override; void mouseDown (const juce::MouseEvent&) override {} // swallow clicks so the scope underneath doesn't react diff --git a/Tests/RenderTest.cpp b/Tests/RenderTest.cpp index 1a6c6d6..388ac5c 100644 --- a/Tests/RenderTest.cpp +++ b/Tests/RenderTest.cpp @@ -3,12 +3,14 @@ #include #include +#include #include "PluginProcessor.h" #include "PluginEditor.h" #include "UISettings.h" #include #include +#include struct FakePlayHead : juce::AudioPlayHead { @@ -197,10 +199,213 @@ static void snapshot (juce::Component& c, const juce::String& name) std::cout << " wrote " << out.getFullPathName() << std::endl; } -int main() +//============================================================================== +// Screenshot mode: RenderTest --site +// +// Renders the images for the README and the product page from the real test audio in +// Tests/audio (kick into sidechain 1, ducked bass into the main input, 4 bars at 128 BPM), +// at 2x scale. Tests/make_site_images.py turns the PNGs into the files the README and the +// website use. Lives only in this test program: the plugin has no hidden mode. + +namespace site +{ + constexpr double bpm = 128.0; + constexpr float scale = 2.0f; // 2x for sharp images on high-density screens + constexpr int width = 1140, height = 392; // 2280 x 784 px at 2x + constexpr int lengthHalfBar = 3, lengthTwoBars = 5; + + struct Audio + { + juce::AudioBuffer kick, bass; + double sampleRate = 44100.0; + }; + + static bool loadWav (const juce::File& file, juce::AudioBuffer& out, double& sampleRate) + { + juce::AudioFormatManager formats; + formats.registerBasicFormats(); + std::unique_ptr reader (formats.createReaderFor (file)); + if (reader == nullptr) + return false; + out.setSize (2, (int) reader->lengthInSamples); + reader->read (&out, 0, (int) reader->lengthInSamples, 0, true, true); + sampleRate = reader->sampleRate; + return true; + } + + /** A processor with sidechain 1 on, fed the whole 4-bar loop while "playing" at 128 BPM. + Stopping exactly at the end of bar 4 leaves the last full window in the buffer. */ + static std::unique_ptr makeProcessor (const Audio& a, FakePlayHead& ph, int lengthIndex, + bool withAudio = true) + { + auto p = std::make_unique(); + auto layout = p->getBusesLayout(); + layout.inputBuses.getReference (1) = juce::AudioChannelSet::stereo(); + p->setBusesLayout (layout); + p->setPlayHead (&ph); + constexpr int block = 512; + p->setRateAndBufferSizeDetails (a.sampleRate, block); + p->prepareToPlay (a.sampleRate, block); + if (auto* lp = p->apvts.getParameter (ParamIDs::length)) + lp->setValueNotifyingHost (lp->convertTo0to1 ((float) lengthIndex)); + p->getUISettings().setProperty (UISettings::showCursorKey, false, nullptr); // play cursor off + + ph.bpm = bpm; + ph.playing = true; + const double spb = a.sampleRate * 60.0 / bpm; + const int total = withAudio ? a.bass.getNumSamples() : block; + juce::AudioBuffer buf (4, block); + juce::MidiBuffer midi; + for (int s0 = 0; s0 < total; s0 += block) + { + const int n = juce::jmin (block, total - s0); + buf.setSize (4, n, false, false, true); + buf.clear(); + if (withAudio) + for (int ch = 0; ch < 2; ++ch) + { + buf.copyFrom (ch, 0, a.bass, ch, s0, n); // main input + buf.copyFrom (ch + 2, 0, a.kick, ch, s0, n); // sidechain 1 + } + ph.ppq = (double) s0 / spb; + p->processBlock (buf, midi); + } + return p; + } + + static std::unique_ptr makeEditor (SmartscopeAudioProcessor& p, int w, int h) + { + std::unique_ptr e (dynamic_cast (p.createEditor())); + e->setSize (w, h); + e->getScopeView().refreshForTest(); + return e; + } + + static void save (juce::Component& c, juce::Rectangle area, const juce::File& file) + { + auto img = c.createComponentSnapshot (area, true, scale); + file.deleteFile(); + juce::FileOutputStream os (file); + juce::PNGImageFormat().writeImageToStream (img, os); + } + + static void setColours (SmartscopeAudioProcessor& p, std::optional main, std::optional kick) + { + auto ui = p.getUISettings(); + if (main) ui.setProperty (UISettings::colourKey (0), main->toString(), nullptr); else ui.removeProperty (UISettings::colourKey (0), nullptr); + if (kick) ui.setProperty (UISettings::colourKey (1), kick->toString(), nullptr); else ui.removeProperty (UISettings::colourKey (1), nullptr); + } + + static int render (const juce::File& outDir) + { + const auto audioDir = juce::File (SMARTSCOPE_SOURCE_DIR).getChildFile ("Tests/audio"); + Audio a; + double kickRate = 0.0; + if (! loadWav (audioDir.getChildFile ("Smartscope Audio-Visual Test - Kick 1.wav"), a.kick, kickRate) + || ! loadWav (audioDir.getChildFile ("Smartscope Audio-Visual Test - Bass 1.wav"), a.bass, a.sampleRate) + || kickRate != a.sampleRate || a.kick.getNumSamples() != a.bass.getNumSamples()) + { + std::cout << "Couldn't load matching test audio from " << audioDir.getFullPathName() << std::endl; + return 1; + } + outDir.createDirectory(); + auto file = [&] (const juce::String& name) { return outDir.getChildFile (name + ".png"); }; + std::cout << "Rendering site images to " << outDir.getFullPathName() << std::endl; + + FakePlayHead ph; + + // Main shot and the four themes: half a bar, the same audio and view each time + { + auto p = makeProcessor (a, ph, lengthHalfBar); + auto e = makeEditor (*p, width, height); + save (*e, e->getLocalBounds(), file ("site_main")); + + struct ThemeShot { int theme; const char* name; std::optional main, kick; }; + const ThemeShot shots[] = { + { 0, "graphite", std::nullopt, std::nullopt }, // the defaults + { 1, "midnight", juce::Colour (0xffffffff), juce::Colour (0xff40d0ff) }, // white bass, cyan kick + { 2, "phosphor", juce::Colour (0xff6cff8a), juce::Colour (0xffffc23d) }, // green bass, amber kick + { 3, "daylight", std::nullopt, juce::Colour (0xff2563eb) }, // near-black bass, deep blue kick + }; + for (auto& s : shots) + { + e->applyTheme (s.theme); + setColours (*p, s.main, s.kick); + e->getScopeView().refreshForTest(); + save (*e, e->getLocalBounds(), file (juce::String ("site_theme_") + s.name)); + } + e->applyTheme (0); + setColours (*p, std::nullopt, std::nullopt); + + // Zoomed in on the first ~14 ms of a kick (the kick lands at the start of the window) + e->getScopeView().setViewForTest (0.0, 1.0 / 68.0); + e->getScopeView().refreshForTest(); + save (*e, e->getLocalBounds(), file ("site_zoom")); + e.reset(); + p->setPlayHead (nullptr); + } + + // Settings, with no audio behind it: just the card, at 2x so the text is sharp + { + auto p = makeProcessor (a, ph, lengthHalfBar, false); + p->getUISettings().removeProperty (UISettings::showCursorKey, nullptr); // show the default + auto e = makeEditor (*p, 900, 420); + e->toggleSettings(); + if (auto* panel = e->getSettingsPanel()) + { + const auto card = panel->getCardBounds().translated (panel->getX(), panel->getY()); + save (*e, card.expanded (1), file ("site_settings")); + } + e.reset(); + p->setPlayHead (nullptr); + } + + // Frames for the demo loop: zoomed in 27 times on a two-bar window, the view slides + // exactly one beat from one kick to the next, waits, and slides back. Going back and + // forth makes the loop seamless: the ruler labels are positions in the window, so a + // one-way pan would jump at the seam even though every kick looks the same. + { + auto p = makeProcessor (a, ph, lengthTwoBars); + auto e = makeEditor (*p, width, height); + auto& sv = e->getScopeView(); + const double span = 1.0 / 27.0; + const double beat = 1.0 / 8.0; // one beat of a two-bar window + const double lead = 0.003 / (8.0 * 60.0 / bpm); // 3 ms of silence before the kick + const double from = 2.0 * beat - lead; + constexpr int fps = 30, holdFrames = 18, moveFrames = 78; + auto framesDir = outDir.getChildFile ("drag_frames"); + framesDir.deleteRecursively(); + framesDir.createDirectory(); + int index = 0; + constexpr int half = holdFrames + moveFrames; + for (int i = 0; i < 2 * half; ++i) + { + const int k = i % half; + double t = k < holdFrames ? 0.0 : (double) (k - holdFrames) / (double) moveFrames; + t = t * t * (3.0 - 2.0 * t); // ease in and out, like a hand on the mouse + if (i >= half) + t = 1.0 - t; // and back again + sv.setViewForTest (from + t * beat, span); + sv.refreshForTest(); + save (*e, e->getLocalBounds(), framesDir.getChildFile ("site_drag_" + juce::String (index++).paddedLeft ('0', 4) + ".png")); + } + std::cout << " " << index << " video frames at " << fps << " fps" << std::endl; + e.reset(); + p->setPlayHead (nullptr); + } + + std::cout << "Done" << std::endl; + return 0; + } +} + +int main (int argc, char* argv[]) { juce::ScopedJuceInitialiser_GUI init; + if (argc >= 3 && juce::String (argv[1]) == "--site") + return site::render (juce::File::getCurrentWorkingDirectory().getChildFile (argv[2])); + const double sr = 48000.0; SmartscopeAudioProcessor proc; FakePlayHead ph; @@ -376,26 +581,6 @@ int main() snapshot (*e2, "14_layers_4k"); e2.reset(); - - // Images for the README - if (auto* lp = p2.apvts.getParameter (ParamIDs::length)) - lp->setValueNotifyingHost (lp->convertTo0to1 (4.0f)); - p2.getUISettings().removeProperty (UISettings::colourKey (1), nullptr); - p2.getUISettings().removeProperty (UISettings::opacityKey (0), nullptr); - renderLayers (p2, ph2, sr, 2.5, 18.0); - std::unique_ptr e3 ( - dynamic_cast (p2.createEditor())); - e3->setSize (1000, 460); - e3->getScopeView().refreshForTest(); - snapshot (*e3, "docs_hero"); - e3->getScopeView().setViewForTest (0.0, 0.07); - e3->getScopeView().refreshForTest(); - snapshot (*e3, "docs_zoom"); - e3->getScopeView().resetZoom(); - e3->setSize (900, 420); - e3->toggleSettings(); - snapshot (*e3, "docs_settings"); - e3.reset(); p2.setPlayHead (nullptr); } diff --git a/Tests/audio/README.md b/Tests/audio/README.md new file mode 100644 index 0000000..c1387c2 --- /dev/null +++ b/Tests/audio/README.md @@ -0,0 +1,14 @@ +# Test audio + +Audio for rendering Smartscope's screenshots and demo video with real material, made by +Claes Lanng for this purpose. + +- `Smartscope Audio-Visual Test - Kick 1.wav`: the kick, one hit on every beat. Goes into + sidechain 1. +- `Smartscope Audio-Visual Test - Bass 1.wav`: the bass, with sidechain ducking already + applied, so it gets out of the way of each kick. Goes into the main input. + +Both are 4 bars at 128 BPM (7.5 s), 44.1 kHz stereo, and start on the downbeat at the +same sample. The kick is 16-bit, the bass 24-bit. + +These files are part of this repository under its licence (AGPLv3). diff --git a/Tests/audio/Smartscope Audio-Visual Test - Bass 1.wav b/Tests/audio/Smartscope Audio-Visual Test - Bass 1.wav new file mode 100644 index 0000000..aae966f Binary files /dev/null and b/Tests/audio/Smartscope Audio-Visual Test - Bass 1.wav differ diff --git a/Tests/audio/Smartscope Audio-Visual Test - Kick 1.wav b/Tests/audio/Smartscope Audio-Visual Test - Kick 1.wav new file mode 100644 index 0000000..b6d53af Binary files /dev/null and b/Tests/audio/Smartscope Audio-Visual Test - Kick 1.wav differ diff --git a/Tests/make_site_images.py b/Tests/make_site_images.py new file mode 100644 index 0000000..d6ae720 --- /dev/null +++ b/Tests/make_site_images.py @@ -0,0 +1,110 @@ +#!/usr/bin/env python3 +"""Turn RenderTest's screenshot renders into the README and website images. + + RenderTest --site renders # writes renders/site_*.png and renders/drag_frames/ + python3 Tests/make_site_images.py renders --readme docs/images \ + --site ../claeslanng.github.io/assets/img/smartscope + +Needs Pillow (pip install pillow) and, for the demo video, ffmpeg. + +README (--readme), lossless PNG: + main.png the top image (2280 x 784, Graphite, half a bar) + zoom.png the first ~14 ms of a kick at Zoom x68 + themes.png the four themes in a 2 x 2 grid + settings.png the settings card (2x) + +Website (--site), as the product page expects: + main.webp, zoom.webp lossless, 2280 x 784 + main-share.jpg 1200 px wide, for social previews (some sites don't read WebP) + theme-.webp lossless, 1140 px wide for the two-column grid + settings.webp lossless, 2x (show it at half its pixel size) + drag-loop.mp4 muted H.264 loop, 1280 x 440 + drag-loop-poster.webp its first frame +""" + +import argparse +import shutil +import subprocess +import sys +from pathlib import Path + +from PIL import Image + +THEMES = ["graphite", "midnight", "phosphor", "daylight"] +GRID_GAP = 10 +GRID_BACKGROUND = (13, 17, 23) +VIDEO_SIZE = (1280, 440) +VIDEO_FPS = 30 + + +def load(renders: Path, name: str) -> Image.Image: + path = renders / f"{name}.png" + if not path.exists(): + sys.exit(f"Missing {path}. Run: RenderTest --site {renders}") + return Image.open(path).convert("RGB") + + +def theme_tile(renders: Path, name: str) -> Image.Image: + img = load(renders, f"site_theme_{name}") + return img.resize((img.width // 2, img.height // 2), Image.LANCZOS) + + +def write_readme(renders: Path, out: Path) -> None: + out.mkdir(parents=True, exist_ok=True) + load(renders, "site_main").save(out / "main.png", optimize=True) + load(renders, "site_zoom").save(out / "zoom.png", optimize=True) + load(renders, "site_settings").save(out / "settings.png", optimize=True) + + tiles = [theme_tile(renders, t) for t in THEMES] + w, h = tiles[0].size + grid = Image.new("RGB", (2 * w + GRID_GAP, 2 * h + GRID_GAP), GRID_BACKGROUND) + for i, tile in enumerate(tiles): + grid.paste(tile, ((i % 2) * (w + GRID_GAP), (i // 2) * (h + GRID_GAP))) + grid.save(out / "themes.png", optimize=True) + print(f"README images written to {out}") + + +def write_site(renders: Path, out: Path) -> None: + out.mkdir(parents=True, exist_ok=True) + main = load(renders, "site_main") + main.save(out / "main.webp", lossless=True, method=6) + share = main.resize((1200, round(main.height * 1200 / main.width)), Image.LANCZOS) + share.save(out / "main-share.jpg", quality=90, optimize=True, progressive=True) + load(renders, "site_zoom").save(out / "zoom.webp", lossless=True, method=6) + load(renders, "site_settings").save(out / "settings.webp", lossless=True, method=6) + for t in THEMES: + theme_tile(renders, t).save(out / f"theme-{t}.webp", lossless=True, method=6) + + frames = sorted((renders / "drag_frames").glob("site_drag_*.png")) + if frames: + Image.open(frames[0]).convert("RGB").resize(VIDEO_SIZE, Image.LANCZOS).save( + out / "drag-loop-poster.webp", lossless=True, method=6) + if shutil.which("ffmpeg"): + subprocess.run([ + "ffmpeg", "-y", "-loglevel", "error", + "-framerate", str(VIDEO_FPS), "-i", str(renders / "drag_frames" / "site_drag_%04d.png"), + "-vf", f"scale={VIDEO_SIZE[0]}:{VIDEO_SIZE[1]}:flags=lanczos,format=yuv420p", + "-c:v", "libx264", "-preset", "veryfast", "-crf", "20", + "-movflags", "+faststart", "-an", str(out / "drag-loop.mp4"), + ], check=True) + else: + print("ffmpeg not found: skipped drag-loop.mp4") + print(f"Website images written to {out}") + + +def main() -> None: + parser = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter) + parser.add_argument("renders", type=Path, help="the folder RenderTest --site wrote to") + parser.add_argument("--readme", type=Path, help="write the README images here (docs/images)") + parser.add_argument("--site", type=Path, help="write the website images here (assets/img/smartscope)") + args = parser.parse_args() + if not args.readme and not args.site: + parser.error("give --readme and/or --site") + if args.readme: + write_readme(args.renders, args.readme) + if args.site: + write_site(args.renders, args.site) + + +if __name__ == "__main__": + main() diff --git a/docs/images/hero.png b/docs/images/hero.png deleted file mode 100644 index 5da9738..0000000 Binary files a/docs/images/hero.png and /dev/null differ diff --git a/docs/images/main.png b/docs/images/main.png new file mode 100644 index 0000000..79358f5 Binary files /dev/null and b/docs/images/main.png differ diff --git a/docs/images/settings.png b/docs/images/settings.png index 943df15..a06c39c 100644 Binary files a/docs/images/settings.png and b/docs/images/settings.png differ diff --git a/docs/images/themes.png b/docs/images/themes.png index ad85ed2..b5c2dfc 100644 Binary files a/docs/images/themes.png and b/docs/images/themes.png differ diff --git a/docs/images/zoom.png b/docs/images/zoom.png index 7f0e908..3d2e8c7 100644 Binary files a/docs/images/zoom.png and b/docs/images/zoom.png differ