{"id":13730255,"url":"https://github.com/sudara/melatonin_audio_sparklines","last_synced_at":"2025-04-07T07:09:13.336Z","repository":{"id":48328478,"uuid":"374182134","full_name":"sudara/melatonin_audio_sparklines","owner":"sudara","description":"Sparklines For JUCE AudioBlocks","archived":false,"fork":false,"pushed_at":"2025-03-04T13:16:27.000Z","size":95,"stargazers_count":95,"open_issues_count":5,"forks_count":4,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-03-31T05:08:18.323Z","etag":null,"topics":["dsp","juce","juce-modules","sparklines"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sudara.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"sudara"}},"created_at":"2021-06-05T18:07:59.000Z","updated_at":"2025-03-04T13:16:30.000Z","dependencies_parsed_at":"2024-01-06T13:08:19.992Z","dependency_job_id":"16120648-a01b-4a97-a2a4-f087f4e84ec5","html_url":"https://github.com/sudara/melatonin_audio_sparklines","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sudara%2Fmelatonin_audio_sparklines","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sudara%2Fmelatonin_audio_sparklines/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sudara%2Fmelatonin_audio_sparklines/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sudara%2Fmelatonin_audio_sparklines/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sudara","download_url":"https://codeload.github.com/sudara/melatonin_audio_sparklines/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247608151,"owners_count":20965952,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dsp","juce","juce-modules","sparklines"],"created_at":"2024-08-03T02:01:12.298Z","updated_at":"2025-04-07T07:09:13.298Z","avatar_url":"https://github.com/sudara.png","language":"C++","funding_links":["https://github.com/sponsors/sudara"],"categories":["Tooling \u0026 Debugging"],"sub_categories":[],"readme":"Read [my blog article on audio sparklines!](https://melatonin.dev/blog/audio-sparklines/)\n\n# Melatonin Audio Sparklines\n\nThis is a C++ JUCE module that summarizes and visualizes what's in an [AudioBlock](https://docs.juce.com/master/classdsp_1_1AudioBlock.html).\n\nIt's nice to get a quick idea of what's happening to your JUCE audio buffers during development or tests.\n\n## Installation \n\nSet up a git submodule in your project tracking the `main` branch. I usually stick mine in a `modules` directory.\n\n```git\ngit submodule add -b main https://github.com/sudara/melatonin_audio_sparklines modules/melatonin_audio_sparklines\ngit commit -m \"Added melatonin_audio_sparklines submodule.\"\n```\n\nTo update melatonin_audio_sparklines, you can:\n```git\ngit submodule update --remote --merge modules/melatonin_audio_sparklines\n```\n\nIf you use CMake (my condolences (jk jk)), inform JUCE about the module in your `CMakeLists.txt`:\n```\njuce_add_module(\"modules/melatonin_audio_sparklines\")\n```\n\nInclude the header where needed:\n\n```\n#include \"melatonin_audio_sparklines/melatonin_audio_sparklines.h\"\n\n```\n\n## JUCE Usage: printSparkline\n\nCall `melatonin::printSparkline(myAudioBlock);` and under the hood, DBG will be called. \n\nIf you are lucky, you'll see a healthy looking wave (like this cutie little square wave) spat out into your console:\n\n```\nBlock is 1 channel, 441 samples, min -0.999994, max 0.999994, 100% filled\n[0⎺‾⎺x⎽_⎽]\n```\n\nOr a sine: \n\n```\nBlock is 1 channel, 441 samples, min -0.999994, max 0.999994, 100% filled\n[0—⎻⎺‾⎺⎻—x—⎼⎽_⎽⎼—]\n```\n\nYou can output the sparkline in full sample-by-sample uncompressed glory with `melatonin::printSparkline(myAudioBlock, false)` or display it without normalization with `melatonin::printSparkline(myAudioBlock, true, false)`.\n\n\n## lldb installation\n\nThanks to Jim Credland's [existing lldb formatters](https://github.com/jcredland/juce-toys/blob/master/juce_lldb_xcode.py) I felt bold enough to jump in and figure out how to get sparklines in your lldb-driven IDE.\n\nPut this line in a file named ~/.lldbinit (create it if necessary), pointing to `sparklines.py`:\n\n```\ncommand script import ~/path/to/melatonin_audio_sparklines/sparklines.py\n```\n\nOn hover you'll get a summary:\n\n![Screenshot 2021-06-22 SineMachine – CycleNote cpp - CLion](https://user-images.githubusercontent.com/472/122944838-6e992a80-d378-11eb-8f87-e7e858da6703.jpg)\n\nOn click you'll get sparklines and the ability to browse samples:\n\n![Screenshot 2021-06-22 SineMachine – CycleNote cpp - CLion](https://user-images.githubusercontent.com/472/122945885-2fb7a480-d379-11eb-90c4-2ebe10af1775.jpg)\n\nIf you'd like to read more about this, read my post on [creating lldb type summaries and children](https://melatonin.dev/blog/how-to-create-lldb-type-summaries-and-synthetic-children-for-your-custom-types/).\n\n## Feature key\n\nHere are what the symbols mean that will show up in the sparkline\n\n```\n0 = true 0\nx = zero crossing\nE = out of bounds (below -1.0 or above 1.0)\nI = Inf (Infinity, meaning you've divided by zero)\nN = NaN (undefined calculation that's not INF)\nS = Subnormal detected\n```\n\n## Caveats\n\n`printSparklines` was tested on VS2019 on Windows, Xcode on MacOS and CLion on Windows and MacOS.\n\nThe lldb python script was tested on MacOS CLion and Xcode only.\n\n### Xcode gotcha\n\nIf you are using Xcode exclusively, you might want to plop this somewhere\n\n```cpp\n#define MELATONIN_SPARKLINE_XCODE=1\n```\n\nMacOS native font rendering seems to flip the height of two of the characters (⎺ vs. ‾) but it's fine in MacOS CLion, etc. \n\n### Don't like how they look?\n\nI'm not a fan of VS2019 with the default Consolas font. Everywhere else it seems to look good! Open an issue if you can make it nicer!\n\n### Reminder: Don't leave a printSparkline call in your audio path\n\nNot only does `DBG` itself allocate, but the whole name of the game is string manipulation here, so if you are sticking a `printSparkline` in your audio callback, expect those sweet sweet dropouts.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsudara%2Fmelatonin_audio_sparklines","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsudara%2Fmelatonin_audio_sparklines","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsudara%2Fmelatonin_audio_sparklines/lists"}