Csound Csound-dev Csound-tekno Search About

Re: [Csnd] Help creating a signal

Date2012-07-28 23:44
From"Partev Barr Sarkissian"
SubjectRe: [Csnd] Help creating a signal

> f1 0 10 65536 1
> f2 0 -7 65536 0 21845 .5 43691 1

After f1 and f2 are zeros,... remind me again, 
is 0= a[0], as in DC component or is it the 
Fundamental Frequency?

Moving to new digs and my Csound Book is still
packed away.


Thanks, cheers,
-Partev


================================================

--- stevenyi@gmail.com wrote:

From: Steven Yi 
To: csound@lists.bath.ac.uk
Subject: Re: [Csnd] Help creating a signal
Date: Fri, 27 Jul 2012 21:11:22 -0400

Hi Forrest,

One possibility might be to use two ftables, one with a sine wave, the
other with two linear segments.  The second table could be read with
an oscili or oscil3 and the value used with one of the table opcodes
to index into the sine wave table. Maybe using:

f1 0 10 65536 1
f2 0 -7 65536 0 21845 .5 43691 1

as tables, then something like:

kndx oscili 1, 6, 2
ksig tablei kndx, 1

Haven't tested the above code, but imagine something along these lines
would work.

Hope that helps!
steven

On Fri, Jul 27, 2012 at 8:56 PM, Forrest Cahoon
 wrote:
> I want to create a k-rate signal that is roughly sinusoidal, but
> asymmetrical, so that it is below zero for some multiple of the time
> it is above zero. For example, where t is some arbitrary time unit:
>
> t=0 value=0
> t=1 value=1
> t=2 value=0
> t=4 value=-1
> t=6 value=0
>
> In this case it is above zero for 2 time units and below zero for 4,
> making the below-zero duration exactly twice the above-zero duration.
> I'd like for this curve to be as smooth as possible.
>
> If I understood more about Fourier analysis, I could maybe come up
> with the appropriate harmonics to use GEN10. (Assuming that it could
> be accomplished using a reasonable number of harmonics.)
>
> Another possibility would be for me to generate the values myself -- I
> think I can get a good one using a weighted average of sinusoids of
> different periods -- in some programming language of my choice,. then
> load these values into a csound table, uh, somehow that I'm not really
> clear about.
>
> I'm sure there are probably other ways too, that I'm not thinking about.
>
> I would be most grateful for any assistance in this matter.
>
>
> Send bugs reports to the Sourceforge bug tracker
>             https://sourceforge.net/tracker/?group_id=81968&atid=564599
> Discussions of bugs and features can be posted here
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
>


Send bugs reports to the Sourceforge bug tracker
            https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"





_____________________________________________________________
Netscape.  Just the Net You Need.

Date2012-07-28 23:55
FromJustin Smith
SubjectRe: [Csnd] Help creating a signal
neither, it is the creation time of the table

An ftable used by a regular oscillator has no fundamental, as it is
simply the waveform to be reproduced (or you could say the fundamental
is the 1/n where n is the amount of time in seconds the instrument
takes to go through the ftable). The fundamental is determined by the
rate of the oscillator.

Sometimes it is helpful to track the original played note of a sampled
sound which will be transposed, (in this case you are storing multiple
cycles in one table), but this does not apply here.

On Sat, Jul 28, 2012 at 3:44 PM, Partev Barr Sarkissian
 wrote:
>
>
>> f1 0 10 65536 1
>> f2 0 -7 65536 0 21845 .5 43691 1
>
> After f1 and f2 are zeros,... remind me again,
> is 0= a[0], as in DC component or is it the
> Fundamental Frequency?
>
> Moving to new digs and my Csound Book is still
> packed away.
>
>
> Thanks, cheers,
> -Partev
>
>
> ================================================
>
> --- stevenyi@gmail.com wrote:
>
> From: Steven Yi 
> To: csound@lists.bath.ac.uk
> Subject: Re: [Csnd] Help creating a signal
> Date: Fri, 27 Jul 2012 21:11:22 -0400
>
> Hi Forrest,
>
> One possibility might be to use two ftables, one with a sine wave, the
> other with two linear segments.  The second table could be read with
> an oscili or oscil3 and the value used with one of the table opcodes
> to index into the sine wave table. Maybe using:
>
> f1 0 10 65536 1
> f2 0 -7 65536 0 21845 .5 43691 1
>
> as tables, then something like:
>
> kndx oscili 1, 6, 2
> ksig tablei kndx, 1
>
> Haven't tested the above code, but imagine something along these lines
> would work.
>
> Hope that helps!
> steven
>
> On Fri, Jul 27, 2012 at 8:56 PM, Forrest Cahoon
>  wrote:
>> I want to create a k-rate signal that is roughly sinusoidal, but
>> asymmetrical, so that it is below zero for some multiple of the time
>> it is above zero. For example, where t is some arbitrary time unit:
>>
>> t=0 value=0
>> t=1 value=1
>> t=2 value=0
>> t=4 value=-1
>> t=6 value=0
>>
>> In this case it is above zero for 2 time units and below zero for 4,
>> making the below-zero duration exactly twice the above-zero duration.
>> I'd like for this curve to be as smooth as possible.
>>
>> If I understood more about Fourier analysis, I could maybe come up
>> with the appropriate harmonics to use GEN10. (Assuming that it could
>> be accomplished using a reasonable number of harmonics.)
>>
>> Another possibility would be for me to generate the values myself -- I
>> think I can get a good one using a weighted average of sinusoids of
>> different periods -- in some programming language of my choice,. then
>> load these values into a csound table, uh, somehow that I'm not really
>> clear about.
>>
>> I'm sure there are probably other ways too, that I'm not thinking about.
>>
>> I would be most grateful for any assistance in this matter.
>>
>>
>> Send bugs reports to the Sourceforge bug tracker
>>             https://sourceforge.net/tracker/?group_id=81968&atid=564599
>> Discussions of bugs and features can be posted here
>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
>>
>
>
> Send bugs reports to the Sourceforge bug tracker
>             https://sourceforge.net/tracker/?group_id=81968&atid=564599
> Discussions of bugs and features can be posted here
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
>
>
>
>
>
> _____________________________________________________________
> Netscape.  Just the Net You Need.
>
>
> Send bugs reports to the Sourceforge bug tracker
>             https://sourceforge.net/tracker/?group_id=81968&atid=564599
> Discussions of bugs and features can be posted here
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
>

Date2012-07-31 08:10
FromForrest Cahoon
SubjectRe: [Csnd] Help creating a signal
I really appreciate all the input, but in the end I found my own way
of doing it, by using python like this:

pyinit

pyruni {{
import math

def tableValue(tableLen,
               beats,
               index):

    partLen = (1.0*tableLen)/beats
    if (index <= partLen):
        return math.sin( (index/partLen)*math.pi )

    index2 = index - partLen
    restLen = tableLen - partLen
    return math.sin( (1 + (index2/restLen)) * math.pi )
}}

gi3Sin ftgen 0, 0, 32768, 2, 0

iTabIdx = 0
tableInit:
    iTabVal pycall1i "tableValue", 32768, 3, iTabIdx
;    printf_i "%f: %f\n", 1, iTabIdx, iTabVal
    tableiw iTabVal, iTabIdx, gi3Sin
loop_lt iTabIdx, 1, 32768, tableInit


This technique will give me pretty much any mathematical table I can
describe in python, so I'm happy with that versatility. It's slow but
the work is all at startup, so that's not too onerous. Unfortunately,
I can't see the correct waveform in the window that pops up when I run
csound; that must get rendered when I first created the (empty) table.

But I've got something that works now and should have something
interesting to share in the near future.  Thanks for all the help!

Forrest