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

pan0 in -1 to 1 range #222

Open
yaxu opened this issue Jan 24, 2021 · 6 comments
Open

pan0 in -1 to 1 range #222

yaxu opened this issue Jan 24, 2021 · 6 comments

Comments

@yaxu
Copy link
Collaborator

yaxu commented Jan 24, 2021

(We've gone through this before elsewhere including in #36 but would be good to tackle it with #190 in mind)

A couple of problems in one

  • pan currently is in the range 0 to 1, rather than the more standard and useful -1 to 1.
  • Stereo pan is 0 for left and 1 for right, whereas multichannel (ring) is 0.25 for left and 0.75 for right. 0 and 1 are the same position.

To solve just the first problem, we could add pan0 for the 0 .. 1 range.

To solve both problems, in addition in stereo mode 0.25 is left, 0.75 is right. 0.5, 1 and 0 would all be centre. 0.5 .. 0.75 would then be the same as 1 .. 0.75.

In multichannel mode 0.25 and 0.75 would also be left and right, but 0.5 would be front and 0 and 1 would be rear.

(I might be mixing up left/right and front/rear, I'm not too bothered about where they go :) )

(not sure what to call a -1 .. 1 signal. I thought it was a 'bipolar' signal but looking it up that seems to be one in a binary state)

I've already made sine0, tri0 etc in tidal to support the -1 .. 1 range.

@telephon
Copy link
Contributor

some questions:

  • in multichannel panning, -1 and 1 are both rear, and 0 is front, when the orientation is set to 0. Strange that this is not the case, but in a ring it depends on the number of channels of course. We should check all that before.
  • it is easy to do a dependent translation in superdirt between pan0 and pan, but this won't work for bus mappings again. So it would be better if the conversion happened at the tidal end probably

(not sure what to call a -1 .. 1 signal. I thought it was a 'bipolar' signal but looking it up that seems to be one in a binary state)

in sclang, we have unipolar 0...1 and bipolar -1...1.

I've already made sine0, tri0 etc in tidal to support the -1 .. 1 range.

if pan is unipolar and pan0 bipolar, then shouldn't sine and sine0 be analogous? One possibility is to add 2 to the names to signify bipolarity, so pan2, sine2, tri2.

@telephon
Copy link
Contributor

Just to be sure, here is a plot of the standard pan for 8 channels:

(
{ 
	var sig = DC.ar(1);
	var pan = Line.ar(-1, 1, 1/100);
	DirtSplayAz.ar(8, sig, 1, pan, orientation: 0);
}.plot(1/100)
)

Screenshot 2021-01-24 at 15 18 06

@yaxu
Copy link
Collaborator Author

yaxu commented Jan 24, 2021

Ah sorry for mixing up front and rear, to tell the truth I just switch cables around until things sound right. :)

In earlier versions of tidal sine was bipolar and sine1 was the range 0..1. Eventually I standardised sine and the other signals as unipolar to match the effect range in dirt (including pan), and there was no bipolar version.

I thought the 0 suffix would make sense as that's the what the signal is centred on, which means you can add/multiply them together. That there's a range of 2 somehow seemed less important? But then the unipolar signal should be sine0.5, which seems silly. I guess you suggest 2 not because there's a range of 2 in particular, but because it goes in two directions relative to 0..

I still think it makes sense for most effects to be unipolar. But then it's nice to be able to multiply signals together to get a more complex waveform before scaling to the 0 .. 1 range. Unfortunately tidal's range operator assumes a unipolar input.

Maybe this needs solving with types. Then sine can be of type Pattern Unipolar and sine2 of type Pattern Bipolar and both can be of typeclass Signal, membership of which requires the conversion function needed by the range function. Plus there can be toUni and toBi functions for quickly converting between them.

@telephon
Copy link
Contributor

telephon commented Jan 24, 2021

That there's a range of 2 somehow seemed less important?

no, sorry, that's not what I meant. In supercollider, the bipolar versions have a 2 on the end, like clip2. As long as all is consistent it's file (0 is intuitive as well).

@yaxu
Copy link
Collaborator Author

yaxu commented Jan 24, 2021

Ok I think I prefer 2 and good to keep consistent with supercollider as well.

I guess there's no specific function for conversion in supercollider, as (sig+1)/2 is so easy?

@yaxu
Copy link
Collaborator Author

yaxu commented Jan 25, 2021

Oh and yes tidal could just always send pan0 (or rather, pan2), doing any conversion. pan could then be deprecated in superdirt, but stay be there for backward compatibility.

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