Csound Csound-dev Csound-tekno Search About

[Csnd] exprand and random pitches

Date2013-02-08 21:23
FromAlex Weiss
Subject[Csnd] exprand and random pitches
Hi list

For an instrument of mine, I need to pick random frequencies between 20Hz and 20kHz. Because we perceive pitch logarithmically, a uniform distribution won't work as it will be biased towards higher pitches. My limited mathematical knowledge leads me to believe that an exponential distribution should fit the bill (correct me if I'm wrong). But this is where my mathematical knowledge ends; should i adjust the klambda parameter in exprand empirically, or is there a mathematically sound value that would make sense in this context?

Thanks,
Alex

Date2013-02-08 21:40
FromRory Walsh
SubjectRe: [Csnd] exprand and random pitches
Can you use MIDI notes and convert them to frequency. This way you can
stay in a linear scale, but have the appropriate exponential output.
The midicps udo here should work ok I think?

http://www.csounds.com/udo/displayOpcode.php?opcode_id=64


On 8 February 2013 21:23, Alex Weiss  wrote:
> Hi list
>
> For an instrument of mine, I need to pick random frequencies between 20Hz
> and 20kHz. Because we perceive pitch logarithmically, a uniform distribution
> won't work as it will be biased towards higher pitches. My limited
> mathematical knowledge leads me to believe that an exponential distribution
> should fit the bill (correct me if I'm wrong). But this is where my
> mathematical knowledge ends; should i adjust the klambda parameter in
> exprand empirically, or is there a mathematically sound value that would
> make sense in this context?
>
> Thanks,
> Alex

Date2013-02-08 21:53
FromSteven Yi
SubjectRe: [Csnd] exprand and random pitches
Another possibility might be to use the uniform distribution and then
map it to a logarithmic curve (could try using the logcurve opcode).

On Fri, Feb 8, 2013 at 9:40 PM, Rory Walsh  wrote:
> Can you use MIDI notes and convert them to frequency. This way you can
> stay in a linear scale, but have the appropriate exponential output.
> The midicps udo here should work ok I think?
>
> http://www.csounds.com/udo/displayOpcode.php?opcode_id=64
>
>
> On 8 February 2013 21:23, Alex Weiss  wrote:
>> Hi list
>>
>> For an instrument of mine, I need to pick random frequencies between 20Hz
>> and 20kHz. Because we perceive pitch logarithmically, a uniform distribution
>> won't work as it will be biased towards higher pitches. My limited
>> mathematical knowledge leads me to believe that an exponential distribution
>> should fit the bill (correct me if I'm wrong). But this is where my
>> mathematical knowledge ends; should i adjust the klambda parameter in
>> exprand empirically, or is there a mathematically sound value that would
>> make sense in this context?
>>
>> Thanks,
>> Alex
>
>
> 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"
>

Date2013-02-10 21:56
FromAlex Weiss
SubjectRe: [Csnd] exprand and random pitches
Thanks everyone. I ended up using a combination of unirand and expcurve, which works fairly well.

Alex

On Fri, Feb 8, 2013 at 1:53 PM, Steven Yi <stevenyi@gmail.com> wrote:
Another possibility might be to use the uniform distribution and then
map it to a logarithmic curve (could try using the logcurve opcode).

On Fri, Feb 8, 2013 at 9:40 PM, Rory Walsh <rorywalsh@ear.ie> wrote:
> Can you use MIDI notes and convert them to frequency. This way you can
> stay in a linear scale, but have the appropriate exponential output.
> The midicps udo here should work ok I think?
>
> http://www.csounds.com/udo/displayOpcode.php?opcode_id=64
>
>
> On 8 February 2013 21:23, Alex Weiss <alexweiss86@gmail.com> wrote:
>> Hi list
>>
>> For an instrument of mine, I need to pick random frequencies between 20Hz
>> and 20kHz. Because we perceive pitch logarithmically, a uniform distribution
>> won't work as it will be biased towards higher pitches. My limited
>> mathematical knowledge leads me to believe that an exponential distribution
>> should fit the bill (correct me if I'm wrong). But this is where my
>> mathematical knowledge ends; should i adjust the klambda parameter in
>> exprand empirically, or is there a mathematically sound value that would
>> make sense in this context?
>>
>> Thanks,
>> Alex
>
>
> 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"



Date2013-02-12 06:31
FromAlex Weiss
SubjectRe: [Csnd] exprand and random pitches
Hi list

As an aside for anybody that's interested: Another method that seems to work fairly well is to generate the numbers with a uniform distribution in the Mel scale, then convert from Mel to frequency. Never used Mels before and was pleasantly surprised: http://en.wikipedia.org/wiki/Mel_scale

Alex 

On Sun, Feb 10, 2013 at 1:56 PM, Alex Weiss <alexweiss86@gmail.com> wrote:
Thanks everyone. I ended up using a combination of unirand and expcurve, which works fairly well.

Alex


On Fri, Feb 8, 2013 at 1:53 PM, Steven Yi <stevenyi@gmail.com> wrote:
Another possibility might be to use the uniform distribution and then
map it to a logarithmic curve (could try using the logcurve opcode).

On Fri, Feb 8, 2013 at 9:40 PM, Rory Walsh <rorywalsh@ear.ie> wrote:
> Can you use MIDI notes and convert them to frequency. This way you can
> stay in a linear scale, but have the appropriate exponential output.
> The midicps udo here should work ok I think?
>
> http://www.csounds.com/udo/displayOpcode.php?opcode_id=64
>
>
> On 8 February 2013 21:23, Alex Weiss <alexweiss86@gmail.com> wrote:
>> Hi list
>>
>> For an instrument of mine, I need to pick random frequencies between 20Hz
>> and 20kHz. Because we perceive pitch logarithmically, a uniform distribution
>> won't work as it will be biased towards higher pitches. My limited
>> mathematical knowledge leads me to believe that an exponential distribution
>> should fit the bill (correct me if I'm wrong). But this is where my
>> mathematical knowledge ends; should i adjust the klambda parameter in
>> exprand empirically, or is there a mathematically sound value that would
>> make sense in this context?
>>
>> Thanks,
>> Alex
>
>
> 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"




Date2013-02-12 07:59
Fromjoachim heintz
SubjectRe: [Csnd] exprand and random pitches
thanks - interesting alternative for some situations!
	j


Am 12.02.2013 07:31, schrieb Alex Weiss:
> Hi list
>
> As an aside for anybody that's interested: Another method that seems to
> work fairly well is to generate the numbers with a uniform distribution
> in the Mel scale, then convert from Mel to frequency. Never used Mels
> before and was pleasantly surprised: http://en.wikipedia.org/wiki/Mel_scale
>
> Alex
>
> On Sun, Feb 10, 2013 at 1:56 PM, Alex Weiss  > wrote:
>
>     Thanks everyone. I ended up using a combination of unirand and
>     expcurve, which works fairly well.
>
>     Alex
>
>
>     On Fri, Feb 8, 2013 at 1:53 PM, Steven Yi      > wrote:
>
>         Another possibility might be to use the uniform distribution and
>         then
>         map it to a logarithmic curve (could try using the logcurve opcode).
>
>         On Fri, Feb 8, 2013 at 9:40 PM, Rory Walsh          > wrote:
>          > Can you use MIDI notes and convert them to frequency. This
>         way you can
>          > stay in a linear scale, but have the appropriate exponential
>         output.
>          > The midicps udo here should work ok I think?
>          >
>          > http://www.csounds.com/udo/displayOpcode.php?opcode_id=64
>          >
>          >
>          > On 8 February 2013 21:23, Alex Weiss          > wrote:
>          >> Hi list
>          >>
>          >> For an instrument of mine, I need to pick random frequencies
>         between 20Hz
>          >> and 20kHz. Because we perceive pitch logarithmically, a
>         uniform distribution
>          >> won't work as it will be biased towards higher pitches. My
>         limited
>          >> mathematical knowledge leads me to believe that an
>         exponential distribution
>          >> should fit the bill (correct me if I'm wrong). But this is
>         where my
>          >> mathematical knowledge ends; should i adjust the klambda
>         parameter in
>          >> exprand empirically, or is there a mathematically sound
>         value that would
>          >> make sense in this context?
>          >>
>          >> Thanks,
>          >> Alex
>          >
>          >
>          > 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"
>
>
>