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

BufWr doesn't throw an error for wrong input rate #3748

Closed
telephon opened this issue May 28, 2018 · 1 comment · Fixed by #3749
Closed

BufWr doesn't throw an error for wrong input rate #3748

telephon opened this issue May 28, 2018 · 1 comment · Fixed by #3749
Labels
bug Issues that relate to unexpected/unwanted behavior. Don't use for PRs. comp: class library SC class library comp: server plugins

Comments

@telephon
Copy link
Member

telephon commented May 28, 2018

When you play a control rate signal through an audio rate BufWr it doesn't complain, but records arbitrary spikes to the buffer.

b = Buffer.alloc(s, 1024);
{ BufWr.ar(0, b, Phasor.ar(0, 1, 0, BufFrames.kr(b))); 0.0 }.play;
b.plot

To fix this, we could either convert the input automatically or throw an error, like this:

checkInputs {
		if (rate == 'audio') {
			if(inputs.at(1).rate != 'audio') {
				^"phase input is not audio rate: % %".format(inputs.at(1), inputs.at(1).rate)
			} {
				if(inputs[3..].any { |x| x.rate != 'audio' }) {
					^"inputArray input is not audio rate: % %".format(inputs[3..], inputs[3..].collect(_.rate))
				}
			}
		};
		^this.checkValidInputs
	}
@telephon telephon added comp: server plugins comp: class library SC class library bug Issues that relate to unexpected/unwanted behavior. Don't use for PRs. labels May 28, 2018
@telephon
Copy link
Member Author


{ BufWr.kr(5, 0, Phasor.kr(0, 1, 0, 1)); 0.0 }.play; // should not fail
{ BufWr.ar(5, 0, Phasor.ar(0, 1, 0, 1)); 0.0 }.play; // should fail
{ BufWr.ar(DC.ar(5), 0, Phasor.ar(0, 1, 0, 1)); 0.0 }.play; // should not fail


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issues that relate to unexpected/unwanted behavior. Don't use for PRs. comp: class library SC class library comp: server plugins
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant