supercollider icon indicating copy to clipboard operation
supercollider copied to clipboard

server: added binout to SpecPcile

Open woolgathering opened this issue 5 years ago • 7 comments

If enabled, outputs the bin number directly instead the calculated frequency. If interpolate is true, performs linear interpolation and outputs a fractional bin as a float.

Purpose and Motivation

I needed the functionality of SpecPcile UGen but needed the bin number as opposed to the frequency. Works as expected.

Types of changes

  • Documentation
  • New feature

To-do list

  • [x] Code is tested
  • [x] All tests are passing
  • [x] Updated documentation
  • [x] This PR is ready for review

woolgathering avatar Jul 17 '20 05:07 woolgathering

Hi Jacob! Could you please fix the formatting?

dyfer avatar Jul 17 '20 17:07 dyfer

Ah! Ok, still learning how to properly contribute.

I used clang 8.0.0 and after running ./build/format.py there are no changes to any of the files I modified. Is this expected behavior?

EDIT: I think I see my error, I only did an indent of two spaces instead of four in the nested if statements. I'll wait on your word before I make any changes, though.

woolgathering avatar Jul 17 '20 20:07 woolgathering

Amended the commit to include the correct formatting and keep the commits clean.

woolgathering avatar Jul 17 '20 22:07 woolgathering

thanks for this @woolgathering and sorry for the delay in reviewing! i have two questions about this, specifically the difference between interpolate and binout.

interpolate is set at initial rate (ir), when the UGen is constructed, while binout is chosen at control rate (kr). is there a reason for that choice? if there is a reason, it should be documented. also, whatever the final choice, whether these two arguments are ir or kr should also be documented.

interpolate is enabled if the input is > 0.0f, but if i'm reading correctly binout is enabled if the input is != 0.0f. these should be consistent. also, the fact that these are positive/nonpositive switches should be documented; right now the documentation only says that they accept 0 and 1 but don't describe the behavior with any other input.

mossheim avatar Aug 09 '20 01:08 mossheim

@brianlheim Also sorry for the delayed reply!

1.) I guess I just got kind of lazy and didn't want to go modify the struct. Makes more sense as an ir. I'll change that.

2.) Ah, yes, that is a mistake. It also should be > 0.0f; it's that way in my ugly fork of SC and forgot to edit that in the PR. I'll also more clearly document the expected input and behavior.

EDIT: Updated with a new push. Also, just to be clear, I am not the original author of interpolate; I just co-opted it for the binout stuff. Regardless, I also updated the documentation for that argument to reflect its status as an ir argument.

woolgathering avatar Aug 21 '20 04:08 woolgathering

thanks @woolgathering . looks like you've got some compiler errors, can you please sort that out?

mossheim avatar Aug 21 '20 22:08 mossheim

Fixed. Apparently I don't know how to spell.

EDIT: Looks like it failed again but for reasons unrelated to this change:

🍺  /usr/local/Cellar/nspr/4.28: 86 files, 1.1MB

==> Installing poppler dependency: nss

==> Pouring nss-3.56.high_sierra.bottle.tar.gz

tar: Error opening archive: Failed to open '/Users/travis/Library/Caches/Homebrew/downloads/9e4ec3ec2b678643fc676aad73df9fd9e838a4d764ecba365714e1e7f5852631--nss-3.56.high_sierra.bottle.tar.gz'

Error: Failure while executing; `tar xof /Users/travis/Library/Caches/Homebrew/downloads/9e4ec3ec2b678643fc676aad73df9fd9e838a4d764ecba365714e1e7f5852631--nss-3.56.high_sierra.bottle.tar.gz -C /var/folders/nz/vv4_9tw56nv9k3tkvyszvwg80000gn/T/d20200821-5319-ai2xse` exited with 1. Here's the output:

tar: Error opening archive: Failed to open '/Users/travis/Library/Caches/Homebrew/downloads/9e4ec3ec2b678643fc676aad73df9fd9e838a4d764ecba365714e1e7f5852631--nss-3.56.high_sierra.bottle.tar.gz'

Warning: Bottle installation failed: building from source.

==> make all BUILD_OPT=1 NSS_ALLOW_SSLKEYLOGFILE=1 NSS_USE_SYSTEM_SQLITE=1 NSPR_

woolgathering avatar Aug 21 '20 23:08 woolgathering