electro-music.com   Dedicated to experimental electro-acoustic
and electronic music
 
    Front Page  |  Radio
 |  Media  |  Forum  |  Wiki  |  Links
Forum with support of Syndicator RSS
 FAQFAQ   CalendarCalendar   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   LinksLinks
 RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in  Chat RoomChat Room 
 Forum index » DIY Hardware and Software » ChucK programming language
Need programming help for computer generated walking bass
Post new topic   Reply to topic Moderators: Kassen
Page 1 of 1 [3 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
Author Message
TJ



Joined: Oct 04, 2018
Posts: 1
Location: Oxford

PostPosted: Thu Oct 04, 2018 1:34 pm    Post subject: Need programming help for computer generated walking bass Reply with quote  Mark this post and the followings unread

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.Cool => 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! Very Happy
Back to top
View user's profile Send private message
MusicMan11712



Joined: Aug 08, 2009
Posts: 1082
Location: Out scouting . . .

PostPosted: Thu Oct 04, 2018 2:26 pm    Post subject: Reply with quote  Mark this post and the followings unread

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
Back to top
View user's profile Send private message
Lueasy



Joined: Jan 17, 2018
Posts: 4
Location: Michigan

PostPosted: Fri Oct 26, 2018 11:36 am    Post subject: Reply with quote  Mark this post and the followings unread

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;
}
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic Moderators: Kassen
Page 1 of 1 [3 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
 Forum index » DIY Hardware and Software » ChucK programming language
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Forum with support of Syndicator RSS
Powered by phpBB © 2001, 2005 phpBB Group
Copyright © 2003 through 2009 by electro-music.com - Conditions Of Use