Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation: Creating Examples #111

Merged
merged 18 commits into from
Jan 30, 2024
Merged

Documentation: Creating Examples #111

merged 18 commits into from
Jan 30, 2024

Conversation

gregwht
Copy link
Collaborator

@gregwht gregwht commented Jan 26, 2024

Created examples for:
MouseDown()
MouseX()
MouseY()
ASREnvelope()
Line()
Impulse()
ClockDivider()
Sequence()

And fixing a typo in BufferPlayer().

Updating sawlfo.md to fit with latest documentation specs.
Removing old SawLFO example.
Updating index.md and adding example-0.py
Updated documentation and examples for sawlfo, sinelfo, squarelfo, and trianglelfo.
Running documentation generator on the changes to SawLFO, SineLFO, SquareLFO, and TriangleLFO.
Adding example files and updating the documentation for oscillators.
Adding an example for the Impulse oscillator, and making formatting consistent across documentation.
Updating the descriptions in square.h and square-lfo.h to be more concise and clear.
Automatically generating new documentation files reflecting earlier changes.
Also removing unnecessary spaces in square.h and square-lfo.h.
Adding graph.wait() to oscillator examples which did not have it.
Created examples for:
MouseDown()
MouseX()
MouseY()
ASREnvelope()
Line()
Impulse()
ClockDivider()
Sequence()

And fixing a typo in BufferPlayer().
Copy link
Owner

@ideoforms ideoforms left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really nice examples, and thanks for the improvements to the docs! I've added a few comments inline.

# Using a line to control the gain of an oscillator, emulating a sidechain ducking effect.
#-------------------------------------------------------------------------------
clock = Impulse(frequency=1.0)
line = Line(0.0, 0.5, 1.0, 0, clock)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better to use False than 0 for the loop parameter, to make it clear that it is a boolean.
Plus, slightly pedantic but this current formulation reproduces the exact behaviour of SawLFO. Maybe you could reduce the time variable to (say) 0.5s, so that it's doing something that can't be reproduced with other nodes?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea re: False -- should I update that in the documentation to match? Currently the example says loop=0

voice_a = oscillator_a * envelope_a
voice_b = oscillator_b * envelope_b

left = StereoPanner(voice_a, -1.0)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I love this example!
To be slightly pedantic again - this formulation of "voice_a through left channel and voice_b through right channel" could (slightly more efficiently) be implemented using ChannelArray(voice_a, voice_b). But I like the use of StereoPanner here, so maybe you could do StereoPanner(voice_a, -0.5) and StereoPanner(voice_b, 0.5) to do something that couldn't be achieved with a ChannelArray.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also missing a graph.wait()?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great catch re: graph.wait()!
Good idea re: StereoPanner -- I'll change the pan values to -0.75 and 0.75 to give a bit more stereo separation, which should allow for easy distinction between the two voices whilst still doing something ChannelArray can't. Feel like with -0.5/0.5 the distinction is less clear and doesn't quite demonstrate the ClockDivider as effectively, if you get me?

# Creating a sequence using the MIDI note values of a C Major scale, starting on middle C.
#-------------------------------------------------------------------------------
clock = Impulse(2.0)
sequence = Sequence([ 60, 62, 64, 65, 67, 69, 71, 72 ], clock)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another nice example!

@@ -6,7 +6,7 @@ description: RandomChoice: Pick a random value from the given array. If a clock
# RandomChoice

```python
RandomChoice(values=std::vector<float> ( ), clock=None, reset=None)
RandomChoice(values=std : : vector <float >(), clock=None, reset=None)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some auto-formatting is causing these colons to be broken up, which shouldn't happen. I remember seeing this before but can't remember the cause. Can you merge your branch with latest master and see if it's still happening?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having trouble with merging my branch to latest master -- might be worth going through this together on Friday.

Copy link
Owner

@ideoforms ideoforms left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯

@ideoforms ideoforms merged commit a90a2b1 into master Jan 30, 2024
1 check passed
@ideoforms ideoforms deleted the docs/examples branch January 30, 2024 18:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants