| Justin,
Nil's code could be used as a hack to linearly interpolate from .11 to
.12, but I don't think he wants to do that.
On 4/19/11, Partev Barr Sarkissian wrote:
> Good point.
>
> -pbs
>
> --- noisesmith@gmail.com wrote:
>
> From: Justin Glenn Smith
> To: csound@lists.bath.ac.uk
> Subject: Re: [Csnd] Using user defined operators in score
> Date: Tue, 19 Apr 2011 14:35:51 -0700
>
> Nil Geisweiller wrote:
>> On Tue, Apr 19, 2011 at 10:40 PM, Justin Glenn Smith
>> wrote:
>>>
>>>
>>> Nil Geisweiller wrote:
>>>> On Tue, Apr 19, 2011 at 7:38 PM, Justin Smith
>>>> wrote:
>>>>> Yeah, that would do it. Though converting to a string and then
>>>>> immediately
>>>>> back again is often intuitive, it is a pet peeve of mine. The following
>>>>> will
>>>>> do the same thing, but with fewer lines of code, an order of magnitude
>>>>> fewer
>>>>> CPU cycles and no dynamic memory allocation needed:
>>>>>
>>>>> ioct = int(rnd(12-3)+3)
>>>>> ipch = int(rnd 11)/100
>>>>> icps = cpspch(ioct+ipch)
>>>> I believe the following would work too (though I haven't tried)
>>>>
>>>> icps = cpspch(3+int(rnd(100))/100)
>>>>
>>> for cpspch you want fractional parts that are members of the set [.0 .01
>>> .02. .03 .04 .05 .06 .07 .08 .09 .1 .11]
>>> that us the purpose of ipch = int(rnd 11)/100
>>>
>>> any fractional part that is not a member of that set should not be valid
>>> input for cpspch
>>>
>>> your code gives fractional parts in the set [.0 .01 .02 .03 ... .97 .98
>>> .99]
>>
>> I tried, it does work, but I suppose that might be a side effect of
>> the way cpspch is implemented rather than an intended feature (I find
>> it reasonable though).
>>
>
> Well I wasn't sure, but in my defense I did say that it "shouldn't" work,
> not that it wouldn't :)
>
> Based on some experimentation (see the csd below) n.24 is one octave higher
> than n.12, and n.36 is two octaves higher, etc. So the problem here is that
> your output frequencies would be about 9 octaves too higher than you expect
> for any given input.
>
>
>
>
>
> sr = 44100
> ksmps = 32
> nchnls = 1
>
>
>
> instr 1
> ipch = cpspch(p4)
> printf_i "%g %g\n", 1, p4, ipch
> endin
>
>
>
>
> i 1 0 0 1.0
> i 1 0 0 1.12
> i 1 0 0 1.24
> i 1 0 0 1.36
> i 1 0 0 1.99
>
>
>
>
>
> 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"
>
>
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"
|