Audiorate comparator
| Date | 2016-11-20 07:43 |
| From | Eduardo Moguillansky |
| Subject | Audiorate comparator |
I need to do audiorate comparisons between signals, like a3 = a1 >= a2 |
| Date | 2016-11-20 09:40 |
| From | Victor Lazzarini |
| Subject | Re: Audiorate comparator |
|
The way to do this is to use one of the vector
reading opcodes in a loop.
and compare each value.
Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy
Maynooth University
Ireland
|
| Date | 2016-11-20 09:47 |
| From | Victor Lazzarini |
| Subject | Re: Audiorate comparator |
|
but maybe we could consider overloading
the logic ops to work on vectors as well.
Victor Lazzarini Dean of Arts, Celtic Studies, and Philosophy
Maynooth University
Ireland
|
| Date | 2016-11-20 10:11 |
| From | Eduardo Moguillansky |
| Subject | Re: Audiorate comparator |
that would be great. maybe while at it, it would be possible to fix the need for ternary operator when using comparators, to avoid repeating kx > ky ? 1 : 0On Sun, Nov 20, 2016 at 10:47 AM, Victor Lazzarini <Victor.Lazzarini@nuim.ie> wrote:
|
| Date | 2016-11-20 10:16 |
| From | Victor Lazzarini |
| Subject | Re: Audiorate comparator |
|
Can you elaborate on this, I am not quite sure what needs to be fixed?
Victor Lazzarini Dean of Arts, Celtic Studies, and Philosophy
Maynooth University
Ireland
|
| Date | 2016-11-20 10:40 |
| From | moguillansky |
| Subject | Re: Audiorate comparator |
I normally would expect that kx > ky would be 1 if the condition is true, as in most programming languages true equals to 1. On Sun, Nov 20, 2016 at 11:16 AM, Victor Lazzarini [via Csound] <[hidden email]> wrote:
View this message in context: Re: [Csnd] Audiorate comparator Sent from the Csound - General mailing list archive at Nabble.com. Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here |
| Date | 2016-11-20 10:51 |
| From | Victor Lazzarini |
| Subject | Re: Audiorate comparator |
|
I guess Csound does not parse that. It could perhaps, expanding to a triple expression
Victor Lazzarini Dean of Arts, Celtic Studies, and Philosophy
Maynooth University
Ireland
|
| Date | 2016-11-20 13:13 |
| From | John ff |
| Subject | Re: Audiorate comparator |
This would be easier in C taking a few minutes to write without introducing major changes.
Sent from TypeApp
On 20 Nov 2016, at 07:44, Eduardo Moguillansky <eduardo.moguillansky@GMAIL.COM> wrote:
|
| Date | 2016-11-20 14:18 |
| From | Steven Yi |
| Subject | Re: Audiorate comparator |
I don't think it is true that most languages permit 1 and true to be the same, nor do I think it would be good to have in Csound. It opens up ways to make mistakes, but doesn't provide enough benefit, IMO. Also you may want to use a UDO that does what you want: opcode gte, a, aa a1, a2 xin aout init 0 kindx = 0 while (kindx < ksmps) do aout[kindx] = (a1[kindx] >= a2[kindx]) ? 1 : 0 od xout aout endop aval = gte(asig, asig2) On Sun, Nov 20, 2016 at 5:40 AM, moguillansky |
| Date | 2016-11-26 15:53 |
| From | mskala@ANSUZ.SOOKE.BC.CA |
| Subject | Re: Audiorate comparator |
On Sun, 20 Nov 2016, moguillansky wrote: > I normally would expect that kx > ky would be 1 if the condition is true, as > in most programming languages true equals to 1. I think in most programming languages, booleans are a different type from integers and not equal to them at all. C is a notable exception. |
| Date | 2016-11-26 16:00 |
| From | mskala@ANSUZ.SOOKE.BC.CA |
| Subject | Re: Audiorate comparator |
On Sun, 20 Nov 2016, Eduardo Moguillansky wrote: > a3 = a1 >= a2 > > where a3 would be 1 for all samples where a1 >= to a2, 0 otherwise > > But comparators seem to be only implemented for k-rate vars. Am I missing > some evident opcode that does this? One possibility would be to compute a1-a2 and look up the result in a small table. I don't know how that compares for speed with other ways of doing it that people have suggested, but I expect it wouldn't be bad. |
| Date | 2016-11-26 16:09 |
| From | jpff |
| Subject | Re: Audiorate comparator |
How about an opcode aout select a1, a2, aless, aequal, amore which for each sample sets aout[i] = (a1[i] |
| Date | 2016-11-29 20:52 |
| From | jpff |
| Subject | Re: Audiorate comparator |
Well I have the code but not in git yet as not sure it is useful/necessary On Sat, 26 Nov 2016, jpff wrote: > How about an opcode > aout select a1, a2, aless, aequal, amore > which for each sample sets > aout[i] = (a1[i] |
| Date | 2016-11-29 21:05 |
| From | Victor Lazzarini |
| Subject | Re: Audiorate comparator |
I think it could be useful. Victor Lazzarini Dean of Arts, Celtic Studies, and Philosophy Maynooth University Ireland > On 29 Nov 2016, at 20:53, jpff |