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

sample knows cutoff: but doesn't document it. Should it? #3428

Open
floholl opened this issue Nov 26, 2024 · 2 comments
Open

sample knows cutoff: but doesn't document it. Should it? #3428

floholl opened this issue Nov 26, 2024 · 2 comments

Comments

@floholl
Copy link

floholl commented Nov 26, 2024

The following MWE audibly demonstrates that:

  1. sample seems to know a cutoff: parameter, which is not documented anywhere in sample's language reference entry (Sonic Pi > Lang > sample > Options); at least not in Sonic Pi v4.5.0.
  2. sample interprets this cutoff:, as one would intuitively expect, the same way as synth: a low-pass filter is applied to cut out the high frequencies, with the cutoff: value corresponding to the respective MIDI note value.
  3. It seems that for sample, the cutoff: option is merely an alias of the lpf: option - at least a quick, ad-hoc test suggests they sound much the same.
# Original, unfiltered sample:
sample :loop_amen

sleep sample_duration(:loop_amen)

# Sounds noticeably low-pass-filtered:
sample :loop_amen, cutoff: 80

sleep sample_duration(:loop_amen)

# Sounds much the same as the previous example:
sample :loop_amen, lpf: 80

This raises two questions:

  1. Should sample's cutoff: option be documented in its language reference entry?
  2. If so, what should the text description of the cutoff: option say? Would it be sufficient (and technically correct) to refer to cutoff: as an alias of lpf:?

If both questions can be answered 'Yes', I would be happy to submit a pull request for an according amendment of the language reference entry of sample (which, for the record, lives at app/server/ruby/lib/sonicpi/lang/sound.rb).

@floholl floholl changed the title sample knows a cutoff: parameter, but does not document it. Should it? sample knows a cutoff: option, but does not document it. Should it? Nov 26, 2024
@floholl floholl changed the title sample knows a cutoff: option, but does not document it. Should it? sample knows cutoff:, but does not document it. Should it? Nov 26, 2024
@floholl floholl changed the title sample knows cutoff:, but does not document it. Should it? sample knows cutoff:, but doesn't document it. Should it? Nov 26, 2024
@floholl floholl changed the title sample knows cutoff:, but doesn't document it. Should it? sample knows cutoff: but doesn't document it. Should it? Nov 26, 2024
@rbnpi
Copy link
Contributor

rbnpi commented Nov 27, 2024

use of cutoff: with sample is documented in use_sample_defaults in example #1

sample :loop_amen                                         # plays amen break with default arguments
use_sample_defaults amp: 0.5, cutoff: 70
sample :loop_amen                                       # plays amen break with an amp of 0.5, cutoff of 70 and defaults for rest of args 
use_sample_defaults cutoff: 90 
sample :loop_amen                      # plays amen break with a cutoff of 90 and defaults for rest of args - note that amp is no longer 0.5

I agree it could possibly be added in doc for sample

@floholl
Copy link
Author

floholl commented Dec 9, 2024

Yes, to me it seems the language reference should ideally provide a complete list of options for each method, no?

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

No branches or pull requests

2 participants