sonic-pi icon indicating copy to clipboard operation
sonic-pi copied to clipboard

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

Open floholl opened this issue 1 year ago • 2 comments

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 avatar Nov 26 '24 18:11 floholl