Csound Csound-dev Csound-tekno Search About

[Csnd] Linear sounding pitch progression.

Date2008-11-27 00:34
FromTobiah
Subject[Csnd] Linear sounding pitch progression.
Given pitch l and h, and step s, how shall I calculate
s pitches which are to include l and h, and will be
spaced in frequency so that the progression will sound
linear, as when one move up the piano in half steps?

Thanks,

Tobiah


Date2008-11-27 00:42
From"Paulo Mouat"
Subject[Csnd] Re: Linear sounding pitch progression.
AttachmentsNone  

Date2008-11-27 00:48
FromTobiah
Subject[Csnd] Re: Re: Linear sounding pitch progression.
Paulo Mouat wrote:
> the ratio r of each step is
> 
> r = (h / l) ^ (1/(s - 1))
> 
> the i-th step is given by l * r ^ i, where i goes from 0 to s - 1.
> 

I don't quite understand it, but I can sure 
program it!  Thanks for the answer.  It came
minutes after I sent the query.

Tobiah

Date2008-11-27 01:25
FromTobiah
Subject[Csnd] Re: Re: Re: Linear sounding pitch progression.
Tobiah wrote:
> Paulo Mouat wrote:
>> the ratio r of each step is

def zither(low_freq, high_freq, steps):

        ratio = (high_freq / low_freq) ** (1.0 / float(steps - 1))

        for step in range(steps):
                pitch = low_freq * ratio ** step
                yield pitch


After writing this in python, I understand it better.
Just as dividing an octave into twelve parts involves
n/12 roots of two, here our goal is not the octave, but
h / l, so we progressively multiply l by fractional powers
of the ratio between our target frequencies.