Csound Csound-dev Csound-tekno Search About

Mathematics problem or Csound caveat?

Date2017-05-01 11:02
From"Jeanette C."
SubjectMathematics problem or Csound caveat?
Hey hey,
I need to do some partial table-reading with phase shifts and possible
direction changes. Since the table-read is only partial, I can't use the
wrap-around functionality of table3, but have to wrap the phasor signal
myself. But when reading backwards, I appear to get an overrun of some
sort. Here are the expressions:
kphasor = (kphs + (iphs_shift * iiter)) % 1
iiter is an index of the recursion, moving the phase shift along.
For the reading direction:
kdirected_phasor = abs(kphasor - kdirfac)
kdirfac is either 0 (forwards) or -1 (backwards).

Did I miss something obvious?

Thanks and best wishes,

Jeanette

--------
When you need someone, you just turn around and I will be there <3

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

Date2017-05-01 16:32
FromOeyvind Brandtsegg
SubjectRe: Mathematics problem or Csound caveat?
Hi,
perhaps the wrap opcode can be useful to you here?

2017-05-01 3:02 GMT-07:00 Jeanette C. <julien@mail.upb.de>:
Hey hey,
I need to do some partial table-reading with phase shifts and possible
direction changes. Since the table-read is only partial, I can't use the
wrap-around functionality of table3, but have to wrap the phasor signal
myself. But when reading backwards, I appear to get an overrun of some
sort. Here are the expressions:
kphasor = (kphs + (iphs_shift * iiter)) % 1
iiter is an index of the recursion, moving the phase shift along.
For the reading direction:
kdirected_phasor = abs(kphasor - kdirfac)
kdirfac is either 0 (forwards) or -1 (backwards).

Did I miss something obvious?

Thanks and best wishes,

Jeanette

--------
When you need someone, you just turn around and I will be there <3

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



--
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

Date2017-05-02 12:51
From"Jeanette C."
SubjectRe: Mathematics problem or Csound caveat?
May 1 2017, Oeyvind Brandtsegg has written:

> Hi,
> perhaps the wrap opcode can be useful to you here?
It takes few words to speak a great truth. I rpobably stumbled across
its name oodleplexes of times and never noticed it. That should tell me!
THANKS!

Best wishes,

Jeanette
...

--------
When you need someone, you just turn around and I will be there <3

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

Date2017-05-02 14:54
FromForrest Curo
SubjectRe: Mathematics problem or Csound caveat?
Um, difference between that one and 'mirror'?

I expect that wrap would do something like this with a signal:

-----_------------------------
    _
  _
 _       __
_      _    _
---------------

Where 'mirror' would handle it like so:

-----_------------------------
    _  _     _
  _      __
 _                                 
_                          
---------------   which might be preferable, depending?

On Tue, May 2, 2017 at 4:51 AM, Jeanette C. <julien@mail.upb.de> wrote:
May 1 2017, Oeyvind Brandtsegg has written:

Hi,
perhaps the wrap opcode can be useful to you here?
It takes few words to speak a great truth. I rpobably stumbled across
its name oodleplexes of times and never noticed it. That should tell me!
THANKS!

Best wishes,

Jeanette
...


--------
When you need someone, you just turn around and I will be there <3

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

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

Date2017-05-02 20:35
FromOeyvind Brandtsegg
SubjectRe: Mathematics problem or Csound caveat?
Yay, happens to me all the time too

2017-05-02 4:51 GMT-07:00 Jeanette C. <julien@mail.upb.de>:
May 1 2017, Oeyvind Brandtsegg has written:

Hi,
perhaps the wrap opcode can be useful to you here?
It takes few words to speak a great truth. I rpobably stumbled across
its name oodleplexes of times and never noticed it. That should tell me!
THANKS!

Best wishes,

Jeanette
...


--------
When you need someone, you just turn around and I will be there <3

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



--
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

Date2017-05-02 20:38
FromOeyvind Brandtsegg
SubjectRe: Mathematics problem or Csound caveat?
Indeed, that is it, Forrest. 
I do think wrap would be the most useful for generally case table reading, but of course mirror could also be useful.
 

2017-05-02 6:54 GMT-07:00 Forrest Curo <treegestalt@gmail.com>:
Um, difference between that one and 'mirror'?

I expect that wrap would do something like this with a signal:

-----_------------------------
    _
  _
 _       __
_      _    _
---------------

Where 'mirror' would handle it like so:

-----_------------------------
    _  _     _
  _      __
 _                                 
_                          
---------------   which might be preferable, depending?

On Tue, May 2, 2017 at 4:51 AM, Jeanette C. <julien@mail.upb.de> wrote:
May 1 2017, Oeyvind Brandtsegg has written:

Hi,
perhaps the wrap opcode can be useful to you here?
It takes few words to speak a great truth. I rpobably stumbled across
its name oodleplexes of times and never noticed it. That should tell me!
THANKS!

Best wishes,

Jeanette
...


--------
When you need someone, you just turn around and I will be there <3

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

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



--
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

Date2017-05-02 23:14
FromHlöðver Sigurðsson
SubjectRe: Mathematics problem or Csound caveat?
I ask without knowing doesnt this produce the same effect
aSig = bla
aWarp = -aSig
?

2017-05-02 21:38 GMT+02:00 Oeyvind Brandtsegg <oyvind.brandtsegg@ntnu.no>:
Indeed, that is it, Forrest. 
I do think wrap would be the most useful for generally case table reading, but of course mirror could also be useful.
 

2017-05-02 6:54 GMT-07:00 Forrest Curo <treegestalt@gmail.com>:
Um, difference between that one and 'mirror'?

I expect that wrap would do something like this with a signal:

-----_------------------------
    _
  _
 _       __
_      _    _
---------------

Where 'mirror' would handle it like so:

-----_------------------------
    _  _     _
  _      __
 _                                 
_                          
---------------   which might be preferable, depending?

On Tue, May 2, 2017 at 4:51 AM, Jeanette C. <julien@mail.upb.de> wrote:
May 1 2017, Oeyvind Brandtsegg has written:

Hi,
perhaps the wrap opcode can be useful to you here?
It takes few words to speak a great truth. I rpobably stumbled across
its name oodleplexes of times and never noticed it. That should tell me!
THANKS!

Best wishes,

Jeanette
...


--------
When you need someone, you just turn around and I will be there <3

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

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



--
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

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

Date2017-05-02 23:20
FromOeyvind Brandtsegg
SubjectRe: Mathematics problem or Csound caveat?
Ah (you're asking about wrap, yes?), it is not inversion, but wrapping, that is once the signal goes above a max threshold it will wrap around to the minimum threshold.  It is more like modulo, but with custom max and min thresholds

2017-05-02 15:14 GMT-07:00 Hlöðver Sigurðsson <hlolli@gmail.com>:
I ask without knowing doesnt this produce the same effect
aSig = bla
aWarp = -aSig
?

2017-05-02 21:38 GMT+02:00 Oeyvind Brandtsegg <oyvind.brandtsegg@ntnu.no>:
Indeed, that is it, Forrest. 
I do think wrap would be the most useful for generally case table reading, but of course mirror could also be useful.
 

2017-05-02 6:54 GMT-07:00 Forrest Curo <treegestalt@gmail.com>:
Um, difference between that one and 'mirror'?

I expect that wrap would do something like this with a signal:

-----_------------------------
    _
  _
 _       __
_      _    _
---------------

Where 'mirror' would handle it like so:

-----_------------------------
    _  _     _
  _      __
 _                                 
_                          
---------------   which might be preferable, depending?

On Tue, May 2, 2017 at 4:51 AM, Jeanette C. <julien@mail.upb.de> wrote:
May 1 2017, Oeyvind Brandtsegg has written:

Hi,
perhaps the wrap opcode can be useful to you here?
It takes few words to speak a great truth. I rpobably stumbled across
its name oodleplexes of times and never noticed it. That should tell me!
THANKS!

Best wishes,

Jeanette
...


--------
When you need someone, you just turn around and I will be there <3

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

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



--
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

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



--
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

Date2017-05-02 23:21
FromHlöðver Sigurðsson
SubjectRe: Mathematics problem or Csound caveat?
ah ok, just curiousity popping in, thanks.

2017-05-03 0:20 GMT+02:00 Oeyvind Brandtsegg <oyvind.brandtsegg@ntnu.no>:
Ah (you're asking about wrap, yes?), it is not inversion, but wrapping, that is once the signal goes above a max threshold it will wrap around to the minimum threshold.  It is more like modulo, but with custom max and min thresholds

2017-05-02 15:14 GMT-07:00 Hlöðver Sigurðsson <hlolli@gmail.com>:
I ask without knowing doesnt this produce the same effect
aSig = bla
aWarp = -aSig
?

2017-05-02 21:38 GMT+02:00 Oeyvind Brandtsegg <oyvind.brandtsegg@ntnu.no>:
Indeed, that is it, Forrest. 
I do think wrap would be the most useful for generally case table reading, but of course mirror could also be useful.
 

2017-05-02 6:54 GMT-07:00 Forrest Curo <treegestalt@gmail.com>:
Um, difference between that one and 'mirror'?

I expect that wrap would do something like this with a signal:

-----_------------------------
    _
  _
 _       __
_      _    _
---------------

Where 'mirror' would handle it like so:

-----_------------------------
    _  _     _
  _      __
 _                                 
_                          
---------------   which might be preferable, depending?

On Tue, May 2, 2017 at 4:51 AM, Jeanette C. <julien@mail.upb.de> wrote:
May 1 2017, Oeyvind Brandtsegg has written:

Hi,
perhaps the wrap opcode can be useful to you here?
It takes few words to speak a great truth. I rpobably stumbled across
its name oodleplexes of times and never noticed it. That should tell me!
THANKS!

Best wishes,

Jeanette
...


--------
When you need someone, you just turn around and I will be there <3

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

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



--
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

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



--
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

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

Date2017-05-03 19:06
From"Jeanette C."
SubjectRe: Mathematics problem or Csound caveat?
Hi again,
I still have problems with my phasors. I'm still working on Risset glissandi. 
Everything works fine if the frequency rises, but when the frequency is 
falling, something goes wrong with my phasor(s). The code is here:
http://juliencoder.de/risset_filter.zip
The relevant file is m_risset_int.udo and there probably the line which 
defines kphasor.

I took a look at an ealier experiment, written in one Csound instrument using 
simple oscil opcodes. To properly change the direction, I only used a negative 
frequency value to modulate frequency and amplitude. As far as I'm aware, I'm 
doing nothing different here. Still, the high note enters at an amplitude >0.

I'd be grateful for a pointer to my obvious mistake.

Best wishes,

Jeanette

--------
When you need someone, you just turn around and I will be there <3

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

Date2017-05-03 20:24
FromOeyvind Brandtsegg
SubjectRe: Mathematics problem or Csound caveat?
In m_risset_int.udo,
replace
kphasor wrap ((kphs * kdirfac) + (iphs_shift * iiter)), 0, 1
kfm table3 kphasor*(ioctave/10), irise, 1, 0, 0
with
kphasor wrap (kphs  + (iphs_shift * iiter)), 0, 1
kfm table3 kphasor*kdirfac*(ioctave/10), irise, 1, 0, 1

There are two things, one is that the windowing function should still progress "forwards" even though the frequency trajectory is reversed, the other that I enabled wrapping in the kfm oscillator.

2017-05-03 11:06 GMT-07:00 Jeanette C. <julien@mail.upb.de>:
Hi again,
I still have problems with my phasors. I'm still working on Risset glissandi. Everything works fine if the frequency rises, but when the frequency is falling, something goes wrong with my phasor(s). The code is here:
http://juliencoder.de/risset_filter.zip
The relevant file is m_risset_int.udo and there probably the line which defines kphasor.

I took a look at an ealier experiment, written in one Csound instrument using simple oscil opcodes. To properly change the direction, I only used a negative frequency value to modulate frequency and amplitude. As far as I'm aware, I'm doing nothing different here. Still, the high note enters at an amplitude >0.

I'd be grateful for a pointer to my obvious mistake.

Best wishes,

Jeanette


--------
When you need someone, you just turn around and I will be there <3

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



--
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

Date2017-05-04 12:35
From"Jeanette C."
SubjectRe: Mathematics problem or Csound caveat?
May 3 2017, Oeyvind Brandtsegg has written:

> In m_risset_int.udo,
> replace
> kphasor wrap ((kphs * kdirfac) + (iphs_shift * iiter)), 0, 1
> kfm table3 kphasor*(ioctave/10), irise, 1, 0, 0
> with
> kphasor wrap (kphs  + (iphs_shift * iiter)), 0, 1
> kfm table3 kphasor*kdirfac*(ioctave/10), irise, 1, 0, 1
Hey hey Oeyvind,
thank you for that. I amended it slightly, I removed the wraparound
parameter from the table3 opcode to create kfm and instead created a
second phasor signal from the first with:
kfphasor wrap (kphasor *kdirfac)
That way the frequencies stay where they should be. Otherwise the
example with three octaves sounds very surprising. :)

I also found the error, that probably beat me all along: the parameter
to the wndow function. I set it to 1.8, which sounded good in my trials,
but caused the small peak of the high frequencies, when going down
somehow.

Thanks again, now I can finish and upload. :)


Best wishes,

Jeanette
...

--------
When you need someone, you just turn around and I will be there <3

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