[Csnd] what does sicvt mean?

classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

[Csnd] what does sicvt mean?

Paul Batchelor-2
Hello list,

"sicvt" is a variable I have seen all over the place in the csound source code. In particular, it is used in the "oscili" code. I have no idea what this one actually stands for. 

For those interested, I am in the process of documenting the linearly interpolated table lookup oscillator algorithm using Donald Knuths literate programming tool CWEB. It will be a standalone c program that uses libsndfile to write audio to disk. 

You can see the work in progress project here:


-P


Csound mailing list [hidden email] 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
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] what does sicvt mean?

Steven Yi
Interesting question, I took a look and couldn't quite figure out what
it stands for either. I do have some analyses from what I'm seeing:

1. The value of sicvt is computed in Engine/csound_orc_compile.c:693:

    csound->sicvt = FMAXLEN / csound->esr;

and FMAXLEN is defined in include/csoundCore.h:122:

#ifdef  B64BIT
#define MAXLEN     0x40000000
#define FMAXLEN    ((MYFLT)(MAXLEN))
#define PHMASK     0x3fffffff
#else

2. sicvt looks to be used used to calculate the phase increment when
reading through a function table/array. F-tables aren't an area I look
at much, but it looks to me that the values are always defined in
terms of FMAXLEN and operated in that scale. It's only when it does
the array index into the table is the phs value then right-shifted by
lobits to get it into the range of the ftable's particular
power-of-two size.

3. In an oscillator that would use floating point phase and increment,
also similarly designed to increment phase by addition (rather than
calculating it from current sample / sample rate), if a table is 1024
in size, your project is 44100 sr, your oscillator is 440hz, the phase
increment would be:

  phs = 440 * 1024 / 44100

Though the representation might be clearer in this form:

  phs = 1024 * (440 / 44100)

with the right-side giving the increment value from 0-1.0 per sample,
then multiplying by 1024 to get the values within the index range of
the table.

4. The phase calculation in oscili looks to always stay at the highest
resolution (relative to 0x4000000), then bit-shifts down to get it
within the range of the current f-table size.  That would get better
accuracy than doing the integer math within smaller range of the
f-table size.

5. sicvt is defined as far back as Csound 1988 (that's the earliest
version of Csound I have here).  I do not see it documented in terms
of its name, but it looks to be defined in value and use the same way
as in current Csound.


So, my guess: Sample-rate Integer Convert? (There is a kicvt as well
that is FMAXLEN / k-rate, which, interestingly, doesn't seem to be
used by any opcodes now...).

Perhaps this is a job for John or Victor. :)



On Sun, Aug 13, 2017 at 8:28 PM, Paul Batchelor <[hidden email]> wrote:

> Hello list,
>
> "sicvt" is a variable I have seen all over the place in the csound source
> code. In particular, it is used in the "oscili" code. I have no idea what
> this one actually stands for.
>
> For those interested, I am in the process of documenting the linearly
> interpolated table lookup oscillator algorithm using Donald Knuths literate
> programming tool CWEB. It will be a standalone c program that uses
> libsndfile to write audio to disk.
>
> You can see the work in progress project here:
>
> https://github.com/PaulBatchelor/the_oscillator
>
> -P
>
>
> Csound mailing list [hidden email]
> 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
[hidden email]
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
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] what does sicvt mean?

Steven Yi
BTW: I saw from googling that Richard Dobson mentioned [1] that he
wrote about Csound's table oscillator in the Audio Programming Book
DVD chapter 3. In the PDF chapter I have here, it's on page 11,
section 1.3.5, "Fast Table Wraparound - The Csound Oscillator". After
reading through, I was a little off in thinking of it as scaling
ranges and not thinking of it as fixed-point math. Oh well!  Anyways,
Richard's chapter is great, but I don't see a definition of sicvt in
there either unfortunately.

[1] - http://csound.1045644.n5.nabble.com/csound-sicvt-and-csdl-h-tp5733836p5733871.html




On Sun, Aug 13, 2017 at 10:31 PM, Steven Yi <[hidden email]> wrote:

> Interesting question, I took a look and couldn't quite figure out what
> it stands for either. I do have some analyses from what I'm seeing:
>
> 1. The value of sicvt is computed in Engine/csound_orc_compile.c:693:
>
>     csound->sicvt = FMAXLEN / csound->esr;
>
> and FMAXLEN is defined in include/csoundCore.h:122:
>
> #ifdef  B64BIT
> #define MAXLEN     0x40000000
> #define FMAXLEN    ((MYFLT)(MAXLEN))
> #define PHMASK     0x3fffffff
> #else
>
> 2. sicvt looks to be used used to calculate the phase increment when
> reading through a function table/array. F-tables aren't an area I look
> at much, but it looks to me that the values are always defined in
> terms of FMAXLEN and operated in that scale. It's only when it does
> the array index into the table is the phs value then right-shifted by
> lobits to get it into the range of the ftable's particular
> power-of-two size.
>
> 3. In an oscillator that would use floating point phase and increment,
> also similarly designed to increment phase by addition (rather than
> calculating it from current sample / sample rate), if a table is 1024
> in size, your project is 44100 sr, your oscillator is 440hz, the phase
> increment would be:
>
>   phs = 440 * 1024 / 44100
>
> Though the representation might be clearer in this form:
>
>   phs = 1024 * (440 / 44100)
>
> with the right-side giving the increment value from 0-1.0 per sample,
> then multiplying by 1024 to get the values within the index range of
> the table.
>
> 4. The phase calculation in oscili looks to always stay at the highest
> resolution (relative to 0x4000000), then bit-shifts down to get it
> within the range of the current f-table size.  That would get better
> accuracy than doing the integer math within smaller range of the
> f-table size.
>
> 5. sicvt is defined as far back as Csound 1988 (that's the earliest
> version of Csound I have here).  I do not see it documented in terms
> of its name, but it looks to be defined in value and use the same way
> as in current Csound.
>
>
> So, my guess: Sample-rate Integer Convert? (There is a kicvt as well
> that is FMAXLEN / k-rate, which, interestingly, doesn't seem to be
> used by any opcodes now...).
>
> Perhaps this is a job for John or Victor. :)
>
>
>
> On Sun, Aug 13, 2017 at 8:28 PM, Paul Batchelor <[hidden email]> wrote:
>> Hello list,
>>
>> "sicvt" is a variable I have seen all over the place in the csound source
>> code. In particular, it is used in the "oscili" code. I have no idea what
>> this one actually stands for.
>>
>> For those interested, I am in the process of documenting the linearly
>> interpolated table lookup oscillator algorithm using Donald Knuths literate
>> programming tool CWEB. It will be a standalone c program that uses
>> libsndfile to write audio to disk.
>>
>> You can see the work in progress project here:
>>
>> https://github.com/PaulBatchelor/the_oscillator
>>
>> -P
>>
>>
>> Csound mailing list [hidden email]
>> 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
[hidden email]
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
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] what does sicvt mean?

Victor Lazzarini-2
In reply to this post by Steven Yi
It stands for sampling increment convert. The analysis is correct. We discuss the
algorithm in the new Csound book, and
I think this conversion is mentioned
somewhere.

Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy
Maynooth University
Ireland

> On 14 Aug 2017, at 04:32, Steven Yi <[hidden email]> wrote:
>
> Interesting question, I took a look and couldn't quite figure out what
> it stands for either. I do have some analyses from what I'm seeing:
>
> 1. The value of sicvt is computed in Engine/csound_orc_compile.c:693:
>
>    csound->sicvt = FMAXLEN / csound->esr;
>
> and FMAXLEN is defined in include/csoundCore.h:122:
>
> #ifdef  B64BIT
> #define MAXLEN     0x40000000
> #define FMAXLEN    ((MYFLT)(MAXLEN))
> #define PHMASK     0x3fffffff
> #else
>
> 2. sicvt looks to be used used to calculate the phase increment when
> reading through a function table/array. F-tables aren't an area I look
> at much, but it looks to me that the values are always defined in
> terms of FMAXLEN and operated in that scale. It's only when it does
> the array index into the table is the phs value then right-shifted by
> lobits to get it into the range of the ftable's particular
> power-of-two size.
>
> 3. In an oscillator that would use floating point phase and increment,
> also similarly designed to increment phase by addition (rather than
> calculating it from current sample / sample rate), if a table is 1024
> in size, your project is 44100 sr, your oscillator is 440hz, the phase
> increment would be:
>
>  phs = 440 * 1024 / 44100
>
> Though the representation might be clearer in this form:
>
>  phs = 1024 * (440 / 44100)
>
> with the right-side giving the increment value from 0-1.0 per sample,
> then multiplying by 1024 to get the values within the index range of
> the table.
>
> 4. The phase calculation in oscili looks to always stay at the highest
> resolution (relative to 0x4000000), then bit-shifts down to get it
> within the range of the current f-table size.  That would get better
> accuracy than doing the integer math within smaller range of the
> f-table size.
>
> 5. sicvt is defined as far back as Csound 1988 (that's the earliest
> version of Csound I have here).  I do not see it documented in terms
> of its name, but it looks to be defined in value and use the same way
> as in current Csound.
>
>
> So, my guess: Sample-rate Integer Convert? (There is a kicvt as well
> that is FMAXLEN / k-rate, which, interestingly, doesn't seem to be
> used by any opcodes now...).
>
> Perhaps this is a job for John or Victor. :)
>
>
>
>> On Sun, Aug 13, 2017 at 8:28 PM, Paul Batchelor <[hidden email]> wrote:
>> Hello list,
>>
>> "sicvt" is a variable I have seen all over the place in the csound source
>> code. In particular, it is used in the "oscili" code. I have no idea what
>> this one actually stands for.
>>
>> For those interested, I am in the process of documenting the linearly
>> interpolated table lookup oscillator algorithm using Donald Knuths literate
>> programming tool CWEB. It will be a standalone c program that uses
>> libsndfile to write audio to disk.
>>
>> You can see the work in progress project here:
>>
>> https://github.com/PaulBatchelor/the_oscillator
>>
>> -P
>>
>>
>> Csound mailing list [hidden email]
>> 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
> [hidden email]
> 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
[hidden email]
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
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] what does sicvt mean?

Richard
In reply to this post by Steven Yi
Thank you for the thumbs up. I guess with hindsight it would have been
good to offer some "decryptions" of some of the more terse and exotic
Csound varaible names...but they do seem so much part of the character
and mystique (ho ho) of Csound, it might feel a bit like explaining a
joke :-). Anyway, yes, Sample Increment ConVerT must be it.

Richard Dobson

On 14/08/2017 04:13, Steven Yi wrote:
> BTW: I saw from googling that Richard Dobson mentioned [1] that he
> wrote about Csound's table oscillator in the Audio Programming Book
> DVD chapter 3. In the PDF chapter I have here, it's on page 11,
> section 1.3.5, "Fast Table Wraparound - The Csound Oscillator". After
> reading through, I was a little off in thinking of it as scaling
> ranges and not thinking of it as fixed-point math. Oh well!  Anyways,
> Richard's chapter is great, but I don't see a definition of sicvt in
> there either unfortunately.
>
...

Csound mailing list
[hidden email]
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
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] what does sicvt mean?

moguillansky
It is defined as:

sicvt = FMAXLEN / samplerate

and is the factor to multiply a freq (in Hz) to obtain the integer phase
increment (in supercollider code, which is almost a copy of the csound
code, this is named `cpstoinc`)

* FMAXLEN is (MYFLT)MAXLEN
* MAXLEN being the max. length of a table (depends on B64BIT being defined,
which is the case for 64-bit builds).

For oscils using integer arithmetics:

intPhaseIncrement = sicvt * cps

Then, for each sample:

sample = *(tablePointer + (phase >> lobits)) * amp
phase += intPhaseIncrement
phase &= mask

where:
* phase is the integer phase
* lobits depends on the size of the table (given the condition that the
table is a power of 2) and c

On Montag, 14. August 2017 11:48:24 CEST, Richard Dobson wrote:

> Thank you for the thumbs up. I guess with hindsight it would
> have been good to offer some "decryptions" of some of the more
> terse and exotic Csound varaible names...but they do seem so
> much part of the character and mystique (ho ho) of Csound, it
> might feel a bit like explaining a joke :-). Anyway, yes, Sample
> Increment ConVerT must be it.
>
> Richard Dobson
>
> On 14/08/2017 04:13, Steven Yi wrote:
>> BTW: I saw from googling that Richard Dobson mentioned [1] that he
>> wrote about Csound's table oscillator in the Audio Programming Book
>> DVD chapter 3. In the PDF chapter I have here, it's on page 11,
>> section 1.3.5, "Fast Table Wraparound - The Csound Oscillator". After
>> reading through, I was a little off in thinking of it as scaling
>> ranges and not thinking of it as fixed-point math. Oh well!  Anyways,
>> Richard's chapter is great, but I don't see a definition of sicvt in
>> there either unfortunately.
>>
> ...
>
> Csound mailing list
> [hidden email]
> 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
[hidden email]
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
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] what does sicvt mean?

Paul Batchelor-2
Thank you for all the responses. Sampling increment convert it is. I'll have to read the analysis in the new csound book. It's a really neat little algorithm.

-P

On Aug 14, 2017 07:10, "Eduardo Moguillansky" <[hidden email]> wrote:
It is defined as:

sicvt = FMAXLEN / samplerate

and is the factor to multiply a freq (in Hz) to obtain the integer phase increment (in supercollider code, which is almost a copy of the csound code, this is named `cpstoinc`)

* FMAXLEN is (MYFLT)MAXLEN
* MAXLEN being the max. length of a table (depends on B64BIT being defined, which is the case for 64-bit builds).
For oscils using integer arithmetics:

intPhaseIncrement = sicvt * cps

Then, for each sample:

sample = *(tablePointer + (phase >> lobits)) * amp
phase += intPhaseIncrement
phase &= mask

where:
* phase is the integer phase
* lobits depends on the size of the table (given the condition that the table is a power of 2) and c


On Montag, 14. August 2017 11:48:24 CEST, Richard Dobson wrote:
Thank you for the thumbs up. I guess with hindsight it would have been good to offer some "decryptions" of some of the more terse and exotic Csound varaible names...but they do seem so much part of the character and mystique (ho ho) of Csound, it might feel a bit like explaining a joke :-). Anyway, yes, Sample Increment ConVerT must be it.

Richard Dobson

On 14/08/2017 04:13, Steven Yi wrote:
BTW: I saw from googling that Richard Dobson mentioned [1] that he
wrote about Csound's table oscillator in the Audio Programming Book
DVD chapter 3. In the PDF chapter I have here, it's on page 11,
section 1.3.5, "Fast Table Wraparound - The Csound Oscillator". After
reading through, I was a little off in thinking of it as scaling
ranges and not thinking of it as fixed-point math. Oh well!  Anyways,
Richard's chapter is great, but I don't see a definition of sicvt in
there either unfortunately.

...

Csound mailing list
[hidden email]
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
[hidden email]
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 [hidden email] 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
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] what does sicvt mean?

Steven Yi
+1 Thanks all for contributing, nice to learn more about this. :)

On Mon, Aug 14, 2017 at 10:50 AM, Paul Batchelor
<[hidden email]> wrote:

> Thank you for all the responses. Sampling increment convert it is. I'll have
> to read the analysis in the new csound book. It's a really neat little
> algorithm.
>
> -P
>
>
> On Aug 14, 2017 07:10, "Eduardo Moguillansky"
> <[hidden email]> wrote:
>
> It is defined as:
>
> sicvt = FMAXLEN / samplerate
>
> and is the factor to multiply a freq (in Hz) to obtain the integer phase
> increment (in supercollider code, which is almost a copy of the csound code,
> this is named `cpstoinc`)
>
> * FMAXLEN is (MYFLT)MAXLEN
> * MAXLEN being the max. length of a table (depends on B64BIT being defined,
> which is the case for 64-bit builds).
> For oscils using integer arithmetics:
>
> intPhaseIncrement = sicvt * cps
>
> Then, for each sample:
>
> sample = *(tablePointer + (phase >> lobits)) * amp
> phase += intPhaseIncrement
> phase &= mask
>
> where:
> * phase is the integer phase
> * lobits depends on the size of the table (given the condition that the
> table is a power of 2) and c
>
>
> On Montag, 14. August 2017 11:48:24 CEST, Richard Dobson wrote:
>>
>> Thank you for the thumbs up. I guess with hindsight it would have been
>> good to offer some "decryptions" of some of the more terse and exotic Csound
>> varaible names...but they do seem so much part of the character and mystique
>> (ho ho) of Csound, it might feel a bit like explaining a joke :-). Anyway,
>> yes, Sample Increment ConVerT must be it.
>>
>> Richard Dobson
>>
>> On 14/08/2017 04:13, Steven Yi wrote:
>>>
>>> BTW: I saw from googling that Richard Dobson mentioned [1] that he
>>> wrote about Csound's table oscillator in the Audio Programming Book
>>> DVD chapter 3. In the PDF chapter I have here, it's on page 11,
>>> section 1.3.5, "Fast Table Wraparound - The Csound Oscillator". After
>>> reading through, I was a little off in thinking of it as scaling
>>> ranges and not thinking of it as fixed-point math. Oh well!  Anyways,
>>> Richard's chapter is great, but I don't see a definition of sicvt in
>>> there either unfortunately.
>>>
>> ...
>>
>> Csound mailing list
>> [hidden email]
>> 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
> [hidden email]
> 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 [hidden email]
> 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
[hidden email]
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
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] what does sicvt mean?

Victor Lazzarini-2
In reply to this post by Paul Batchelor-2
Actually, I don't think we talk in that much detail about the oscillator code.

What Eduardo said is right. It's all to do with the max table size. This is the integer indexing code; the floating point one is way simpler. On modern machines, their performance is not too dissimilar.

So just to note: this not the table lookup
oscillator algorithm per se, but an algorithm
for fixed-point indexing.

Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy
Maynooth University
Ireland

On 14 Aug 2017, at 16:50, Paul Batchelor <[hidden email]> wrote:

Thank you for all the responses. Sampling increment convert it is. I'll have to read the analysis in the new csound book. It's a really neat little algorithm.

-P

On Aug 14, 2017 07:10, "Eduardo Moguillansky" <[hidden email]> wrote:
It is defined as:

sicvt = FMAXLEN / samplerate

and is the factor to multiply a freq (in Hz) to obtain the integer phase increment (in supercollider code, which is almost a copy of the csound code, this is named `cpstoinc`)

* FMAXLEN is (MYFLT)MAXLEN
* MAXLEN being the max. length of a table (depends on B64BIT being defined, which is the case for 64-bit builds).
For oscils using integer arithmetics:

intPhaseIncrement = sicvt * cps

Then, for each sample:

sample = *(tablePointer + (phase >> lobits)) * amp
phase += intPhaseIncrement
phase &= mask

where:
* phase is the integer phase
* lobits depends on the size of the table (given the condition that the table is a power of 2) and c


On Montag, 14. August 2017 11:48:24 CEST, Richard Dobson wrote:
Thank you for the thumbs up. I guess with hindsight it would have been good to offer some "decryptions" of some of the more terse and exotic Csound varaible names...but they do seem so much part of the character and mystique (ho ho) of Csound, it might feel a bit like explaining a joke :-). Anyway, yes, Sample Increment ConVerT must be it.

Richard Dobson

On 14/08/2017 04:13, Steven Yi wrote:
BTW: I saw from googling that Richard Dobson mentioned [1] that he
wrote about Csound's table oscillator in the Audio Programming Book
DVD chapter 3. In the PDF chapter I have here, it's on page 11,
section 1.3.5, "Fast Table Wraparound - The Csound Oscillator". After
reading through, I was a little off in thinking of it as scaling
ranges and not thinking of it as fixed-point math. Oh well!  Anyways,
Richard's chapter is great, but I don't see a definition of sicvt in
there either unfortunately.

...

Csound mailing list
[hidden email]
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
[hidden email]
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 [hidden email] 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 [hidden email] 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
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] what does sicvt mean?

Paul Batchelor-2
> This is the integer indexing code; the floating point one is way simpler. On modern machines, their performance is not too dissimilar.

Are there any advantages to the fixed point algorithm on fixed point machines, or is just a Csound relic? If there was any advantage, my hunch is that there could be some better numerical properties using fixed point.

-P


On Mon, Aug 14, 2017 at 11:59 AM, Victor Lazzarini <[hidden email]> wrote:
Actually, I don't think we talk in that much detail about the oscillator code.

What Eduardo said is right. It's all to do with the max table size. This is the integer indexing code; the floating point one is way simpler. On modern machines, their performance is not too dissimilar.

So just to note: this not the table lookup
oscillator algorithm per se, but an algorithm
for fixed-point indexing.

Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy
Maynooth University
Ireland

On 14 Aug 2017, at 16:50, Paul Batchelor <[hidden email]> wrote:

Thank you for all the responses. Sampling increment convert it is. I'll have to read the analysis in the new csound book. It's a really neat little algorithm.

-P

On Aug 14, 2017 07:10, "Eduardo Moguillansky" <[hidden email]> wrote:
It is defined as:

sicvt = FMAXLEN / samplerate

and is the factor to multiply a freq (in Hz) to obtain the integer phase increment (in supercollider code, which is almost a copy of the csound code, this is named `cpstoinc`)

* FMAXLEN is (MYFLT)MAXLEN
* MAXLEN being the max. length of a table (depends on B64BIT being defined, which is the case for 64-bit builds).
For oscils using integer arithmetics:

intPhaseIncrement = sicvt * cps

Then, for each sample:

sample = *(tablePointer + (phase >> lobits)) * amp
phase += intPhaseIncrement
phase &= mask

where:
* phase is the integer phase
* lobits depends on the size of the table (given the condition that the table is a power of 2) and c


On Montag, 14. August 2017 11:48:24 CEST, Richard Dobson wrote:
Thank you for the thumbs up. I guess with hindsight it would have been good to offer some "decryptions" of some of the more terse and exotic Csound varaible names...but they do seem so much part of the character and mystique (ho ho) of Csound, it might feel a bit like explaining a joke :-). Anyway, yes, Sample Increment ConVerT must be it.

Richard Dobson

On 14/08/2017 04:13, Steven Yi wrote:
BTW: I saw from googling that Richard Dobson mentioned [1] that he
wrote about Csound's table oscillator in the Audio Programming Book
DVD chapter 3. In the PDF chapter I have here, it's on page 11,
section 1.3.5, "Fast Table Wraparound - The Csound Oscillator". After
reading through, I was a little off in thinking of it as scaling
ranges and not thinking of it as fixed-point math. Oh well!  Anyways,
Richard's chapter is great, but I don't see a definition of sicvt in
there either unfortunately.

...

Csound mailing list
[hidden email]
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
[hidden email]
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 [hidden email] 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 [hidden email] 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 [hidden email] 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
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] what does sicvt mean?

Michael Gogins-2
The bar way to tell is to try it both ways and time it. 

Regards, 
Mike

On Aug 14, 2017 19:00, "Paul Batchelor" <[hidden email]> wrote:
> This is the integer indexing code; the floating point one is way simpler. On modern machines, their performance is not too dissimilar.

Are there any advantages to the fixed point algorithm on fixed point machines, or is just a Csound relic? If there was any advantage, my hunch is that there could be some better numerical properties using fixed point.

-P


On Mon, Aug 14, 2017 at 11:59 AM, Victor Lazzarini <[hidden email]> wrote:
Actually, I don't think we talk in that much detail about the oscillator code.

What Eduardo said is right. It's all to do with the max table size. This is the integer indexing code; the floating point one is way simpler. On modern machines, their performance is not too dissimilar.

So just to note: this not the table lookup
oscillator algorithm per se, but an algorithm
for fixed-point indexing.

Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy
Maynooth University
Ireland

On 14 Aug 2017, at 16:50, Paul Batchelor <[hidden email]> wrote:

Thank you for all the responses. Sampling increment convert it is. I'll have to read the analysis in the new csound book. It's a really neat little algorithm.

-P

On Aug 14, 2017 07:10, "Eduardo Moguillansky" <[hidden email]> wrote:
It is defined as:

sicvt = FMAXLEN / samplerate

and is the factor to multiply a freq (in Hz) to obtain the integer phase increment (in supercollider code, which is almost a copy of the csound code, this is named `cpstoinc`)

* FMAXLEN is (MYFLT)MAXLEN
* MAXLEN being the max. length of a table (depends on B64BIT being defined, which is the case for 64-bit builds).
For oscils using integer arithmetics:

intPhaseIncrement = sicvt * cps

Then, for each sample:

sample = *(tablePointer + (phase >> lobits)) * amp
phase += intPhaseIncrement
phase &= mask

where:
* phase is the integer phase
* lobits depends on the size of the table (given the condition that the table is a power of 2) and c


On Montag, 14. August 2017 11:48:24 CEST, Richard Dobson wrote:
Thank you for the thumbs up. I guess with hindsight it would have been good to offer some "decryptions" of some of the more terse and exotic Csound varaible names...but they do seem so much part of the character and mystique (ho ho) of Csound, it might feel a bit like explaining a joke :-). Anyway, yes, Sample Increment ConVerT must be it.

Richard Dobson

On 14/08/2017 04:13, Steven Yi wrote:
BTW: I saw from googling that Richard Dobson mentioned [1] that he
wrote about Csound's table oscillator in the Audio Programming Book
DVD chapter 3. In the PDF chapter I have here, it's on page 11,
section 1.3.5, "Fast Table Wraparound - The Csound Oscillator". After
reading through, I was a little off in thinking of it as scaling
ranges and not thinking of it as fixed-point math. Oh well!  Anyways,
Richard's chapter is great, but I don't see a definition of sicvt in
there either unfortunately.

...

Csound mailing list
[hidden email]
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
[hidden email]
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 [hidden email] 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 [hidden email] 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 [hidden email] 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 [hidden email] 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
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] what does sicvt mean?

Victor Lazzarini-2
In reply to this post by Paul Batchelor-2
On fixed-point machines (no fpu), the integer indexing is needed for reasonable
performance.

Integer indexing is not as precise as double floating point (hence poscil = precise oscil), particularly with large tables and low freqs, since these take away some bits of precision in the algorithm. Since Csound 6, this got somewhat better as we moved to using 64 bits in 64-bit machines (but it is still as before in 32bit archs). I have not compared
this with doubles yet, but I think it's close.


Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy
Maynooth University
Ireland

On 15 Aug 2017, at 01:01, Paul Batchelor <[hidden email]> wrote:

> This is the integer indexing code; the floating point one is way simpler. On modern machines, their performance is not too dissimilar.

Are there any advantages to the fixed point algorithm on fixed point machines, or is just a Csound relic? If there was any advantage, my hunch is that there could be some better numerical properties using fixed point.

-P


On Mon, Aug 14, 2017 at 11:59 AM, Victor Lazzarini <[hidden email]> wrote:
Actually, I don't think we talk in that much detail about the oscillator code.

What Eduardo said is right. It's all to do with the max table size. This is the integer indexing code; the floating point one is way simpler. On modern machines, their performance is not too dissimilar.

So just to note: this not the table lookup
oscillator algorithm per se, but an algorithm
for fixed-point indexing.

Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy
Maynooth University
Ireland

On 14 Aug 2017, at 16:50, Paul Batchelor <[hidden email]> wrote:

Thank you for all the responses. Sampling increment convert it is. I'll have to read the analysis in the new csound book. It's a really neat little algorithm.

-P

On Aug 14, 2017 07:10, "Eduardo Moguillansky" <[hidden email]> wrote:
It is defined as:

sicvt = FMAXLEN / samplerate

and is the factor to multiply a freq (in Hz) to obtain the integer phase increment (in supercollider code, which is almost a copy of the csound code, this is named `cpstoinc`)

* FMAXLEN is (MYFLT)MAXLEN
* MAXLEN being the max. length of a table (depends on B64BIT being defined, which is the case for 64-bit builds).
For oscils using integer arithmetics:

intPhaseIncrement = sicvt * cps

Then, for each sample:

sample = *(tablePointer + (phase >> lobits)) * amp
phase += intPhaseIncrement
phase &= mask

where:
* phase is the integer phase
* lobits depends on the size of the table (given the condition that the table is a power of 2) and c


On Montag, 14. August 2017 11:48:24 CEST, Richard Dobson wrote:
Thank you for the thumbs up. I guess with hindsight it would have been good to offer some "decryptions" of some of the more terse and exotic Csound varaible names...but they do seem so much part of the character and mystique (ho ho) of Csound, it might feel a bit like explaining a joke :-). Anyway, yes, Sample Increment ConVerT must be it.

Richard Dobson

On 14/08/2017 04:13, Steven Yi wrote:
BTW: I saw from googling that Richard Dobson mentioned [1] that he
wrote about Csound's table oscillator in the Audio Programming Book
DVD chapter 3. In the PDF chapter I have here, it's on page 11,
section 1.3.5, "Fast Table Wraparound - The Csound Oscillator". After
reading through, I was a little off in thinking of it as scaling
ranges and not thinking of it as fixed-point math. Oh well!  Anyways,
Richard's chapter is great, but I don't see a definition of sicvt in
there either unfortunately.

...

Csound mailing list
[hidden email]
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
[hidden email]
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 [hidden email] 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 [hidden email] 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 [hidden email] 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 [hidden email] 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