From 1ad5037df6df6096e1f2c1d9cb7402b40d7045b5 Mon Sep 17 00:00:00 2001 From: Daniel Jones Date: Sun, 3 Dec 2023 16:57:56 +0000 Subject: [PATCH] Update and document signalflow_examples --- README.md | 11 +++++++++-- .../libs/signalflow_examples/signalflow_examples.py | 12 ++++++++++++ 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6f596154..41eee097 100644 --- a/README.md +++ b/README.md @@ -50,11 +50,18 @@ For complete per-platform instructions and setup guides, see [Installing SignalF ## Examples -See [examples](examples) for a number of example scripts. +Several example scripts are provided in [examples](examples). + +To download the `examples` folder: + +```python +import signalflow_examples +signalflow_examples.download_examples() +``` ## Documentation -More detailed documentation can be found at [signalflow.dev](https://signalflow.dev/). +In-depth documentation, including a reference guide to each of the Node classes, can be found at [signalflow.dev](https://signalflow.dev/). ## Node classes diff --git a/auxiliary/libs/signalflow_examples/signalflow_examples.py b/auxiliary/libs/signalflow_examples/signalflow_examples.py index 54810256..8f0e25f2 100755 --- a/auxiliary/libs/signalflow_examples/signalflow_examples.py +++ b/auxiliary/libs/signalflow_examples/signalflow_examples.py @@ -31,15 +31,27 @@ def download_examples() -> None: "sequencing-example.py", "wavetable-2d-example.py", ] + audio_files = [ + "stereo-count.wav" + ] local_dir = "examples" + local_audio_dir = os.path.join(local_dir, "audio") os.makedirs(local_dir, exist_ok=True) + os.makedirs(local_audio_dir, exist_ok=True) print("Downloading examples to: %s" % local_dir) + for filename in examples: url = "%s/%s" % (url_prefix, urllib.parse.quote(filename)) output_path = os.path.join(local_dir, filename) urllib.request.urlretrieve(url, output_path) + os.chmod(output_path, 755) print(" - Downloaded: %s" % filename) + for filename in audio_files: + url = "%s/audio/%s" % (url_prefix, urllib.parse.quote(filename)) + output_path = os.path.join(local_audio_dir, filename) + urllib.request.urlretrieve(url, output_path) + def download_notebooks() -> None: """ Download all example scripts from GitHub to the current directory.