TJ
Joined: Oct 04, 2018 Posts: 1 Location: Oxford
|
Posted: Thu Oct 04, 2018 1:34 pm Post subject:
Need programming help for computer generated walking bass |
 |
|
Hey,
I'm a composition student working on a project in Digital Jazz.
I have no programming knowledge whatsoever but am trying to create a program in miniAudicle that will act as a computer generated walking bass.
I've got this so far:
SinOsc ge=>dac;
while( true )
{
Math.random2f(30.8,164. => ge.freq;
.2::second => now;
}
But it would be great if someone could explain how I can get the computer to choose random frequencies based on a list (the list being the frequencies of the triad of a particular chord).
I will also want to be able to change the list after a certain duration of time (ie. when the chord changes).
Not sure if this is possible but just thought I'd ask anyway.
Thanks!  |
|
MusicMan11712
Joined: Aug 08, 2009 Posts: 1082 Location: Out scouting . . .
|
Posted: Thu Oct 04, 2018 2:26 pm Post subject:
|
 |
|
I can't tell you how to do it in ChucK, but for an arduino program that generated midi notes (as oppose to sounds), I used arrays of acceptable note values and an acceptable octave range (as well as a few CCs for timbral shaping, etc.). I then had my program choose a randomized offset to the one of my pre-determined arrays. That then gave me my midi note number.
I assume you can do something similar with frequencies to be used with ChucK.
Just a thought in case it spurs some creativity to help solve your task.
Steve |
|
Lueasy

Joined: Jan 17, 2018 Posts: 4 Location: Michigan
|
Posted: Fri Oct 26, 2018 11:36 am Post subject:
|
 |
|
I suggest you check out arrays.
For example, a midi C major scale array would look like this:
[60,62,64,65,67,69,71,72] @=> int scale;
Then to convert midi to frequency, use the standard library as such:
Std.mtof(scale) => ge.freq;
Then to chose those values randomly, remember arrays start with 0 and go for however many values you have. In this case 7.
The full scale program could look as such:
[60,62,64,65,67,69,71,72] @=> int Cscale;
While(1)
{
Math.random2(0,7) => Cscale;
Std.mtof(Cscale) => ge.freq;
0.2::second => now;
} |
|