Friday, December 04, 2009
bacon basic song compiler
sound dur
it is posted on a bbs so if you are inclinded to debug go ahead.. otherwise you can look for the latest version there later. This will be absorbed by dex tracker after I have finised it.
bacon basic beep compiler"
Labels: bacon basic, beep, python
Monday, June 29, 2009
pygame music grid beta .1
pygame music grid base
Labels: drum machine, piano roll, pygame, python, sequencer
Sunday, May 31, 2009
dexml
Labels: .net, dexml, iron python, python
Saturday, May 23, 2009
pygame libraries usefull for piano rolls, drum machines exc
Labels: drum machine, piano roll, pygame, python
Monday, April 13, 2009
pycap drum machine or piano roll 1.0
to do...
get a real button class for the save button (everything is roll your own)
get a link to the help file
nasty bug with the all the text changes color when the save button is pressed.
I was looking for a template or a preprocessor (for the gui classes) but I don't know If I will distribute a distro or not.. seems like a lot of work and pre-processing is probily easier to program from scratch rather than from m4, ml1 exc.
Drum machine
Labels: drum machine, piano roll, pycap, python
Friday, April 10, 2009
pycap drum machine or piano roll beta...
pycap drum machine
for suggestions, bug fixes, or just to say hello
THE MESSAGE BOARD"
If for some reason you reach this message without the search returning updated versions the link is here Pycap drum machine
Labels: drum machine, game engine, piano roll, pycap, python
Friday, January 23, 2009
ixi software python libraries
ixi software currently has a number of libraries they have been releasing that mainly are for super colider.. a must for a complete music python distribution.
Labels: python
Sunday, August 17, 2008
another try at parsing
I am looking at the enthought python package. I had avoided using it because it was 2.4 and I moved to 2.5.. I am under the impression that there is no problem using muliple versions (I wasn't then).. The plugin system looks interesting in that they have editors already built.. There is some broken stuff also but it is stuff that probily isn't of use to me anyway.. (enthought may want to know about it though).. There is some instructions in the graphics maya I believe that should have come with an example batch file. I am in the looking phase.. It looks like there are output windows for code (compilers like csound) and thats a big feature that I have been looking for.. The right to distribute code though is a big question mark.. I have been very fortunate that my computer didn't get wet... I had more real rain drops than water splash screens...
Labels: csound, enthought, parsing, python
Friday, August 01, 2008
changing table numbers csound command line program
In order to combine .sco and .orc files that contain tables the table numbers will have to change and the tables after the first instrument will have to be moved.
The following is a beta in the python programming language to change the table numbers in the .orc file.. some examples in the manual use a constant instead of assigning a number.. that shouldn't be a problem.. Other files may be though.
import sys
opcode = sys.argv[0]
tablenumber = sys.argv[1]
newtablenumber = str(sys.argv[2])
inputfile = open(sys.argv[3], 'r')
outputfile = open(sys.argv[4], 'w')
for line in inputfile:
if opcode in line:
if opcode == 'oscil':
count = 0
for word in line:
count = count + 1
if count == 5
word == newtablenumber
outputfile.write(line)
Friday, May 23, 2008
another csound routines beta...
csd_countlines_in_each_instrument(from_file):
and two routines to get numbers usable by a graphics interface or graphing program
def float_to_int(float_number):
def Float_Precision(float_number, precision):
the last two are listed in module graphmath.py
I was looking up float to integer + example python on the internet and got an example that was down right scary so I will post the entire 4 lines I have done here
x = str(float_number)
x2 = x.split('.')
returnnumber = int(x2[0])
return return_number
This is required first
prev version
The rest of the new stuff is here
New csound stuff
this is untested and probily has major bugs.. I would like to hear about needed routines suggestions.. suggested use if for gui's and for publication graphics with a package such as mathplotlib. You will probily need wxpython in order to get this to work if there are problems check dex tracker for it's needed files.
The april version of python magazine may have some intresting stuff for grids and spreadsheets and it can be found here. (I am not sure about thier policy on back issues.)
python mag march 2008
Labels: csound routines, python
Wednesday, May 14, 2008
graph tests for csound
This is the current distro of csound routines.. The newest function is csdInstrumentlist3('bay-at-night.csd') between the quotes is the file name in question and it should give the start and stop time of each instrument.. Tests are in tkinter and are not complete.. I am strapped for time but I was thinking of having a routine to count all the lines of each instrument and then return the counts. Not because it would be usefull but for things like pie charts exc... because I can.. The examples are currently using tkinter and python 2.5
Labels: csound, python, tkinter
Monday, May 12, 2008
new csound routine in python
This isn't tested yet so it probily doesn't work completely yet. this is the data needed to set up what is in some competing csound package (written in java) plus you can do some graphing with pie charts and other odd things that are probily useless but intertaining. Fushion charts for python was released as tw_fusioncharts (flash graphics) or somesuch and I wanted to test it out with this if it ever comes with instructions. The data and the code should always remain seperate so that it works with new graphics packages in python and even packages in c ( if the python shedskin compiler is ever up for it ) The spacing was killed by google
class instr_data:
instr_number=[]
begin_time = []
end_time = []
def csdInstrumentlist3(from_file):
"returns instr number and the start and stop time"
infile = open(from_file)
instr_number=[]
begin_time = []
end_time = []
bt = ''
et = ''
in = ''
cscore = 0
for line in infile:
if "" in line:
cscore = 1
if cscore == 1:
if line.startswith('i'):
x = line.split(' ')
iin = x[0]
x2 = iin.split(' ')
if in == '':
in = x[0]
if not in == x[0]:
in = x[0]
st = int(x2[0])
et = int(x2[1])
instr_data.instr_number.append(in)
instr_data.begin_time.append(bt)
instr_data.end_time.append(et)
if x2[0] < bt =" x2[0]"> et:
et = x2[1]
return instr_data
Friday, July 06, 2007
using vim to load csound instruments
Testing the concept of vi, vim and ex... I didn't have it as part of gnu tools so I had to look for a download and found gvim (there is also a traditional vim as part of the distribution).. To get this to work in python I used a batch file to start the program
path = c:\program files\vim #this is just an example
python_awk_bridge.py #probily should rename this...
this is a work in progress so it isn't 100% debugged.. One thing to get used to is aditional sintax.. you will notice if you use vim and just do \instr and then \endin to get to the end of the instrument you end up with something in a comment line at least with the sample file bay-at-night.csd (modified from a csound example).. for this I added ;
def load_instrument(instr_name, csdname):
"load an instrument using vim"
f = open('csdfile.tmp','w')
my_path = "/dex tracker"
cmd = ["gvim",csdname]
vimin = subprocess.Popen(cmd,stdin=subprocess.PIPE)#.comunicate()[0] #, stdout = f, stderr = f, cwd = my_path )
#f.close()
innum = csr.return_unique_instr_number(csdname) - 1
cmd = ["""/instr""",inum]
vimin.stdin.write(cmd)
cmd = [""";
f.close()
load_instrument("""c:\dex tracker\strings.orc""",'bay-at-night.csd') #"""c:\dex tracker\bay-at-night.csd""")
#f.close()
One other comment about vim and emacs is that the complaints are that they are a good operating system and not a good editor... This is a good way to get more from piping and you can run unix (and probily everything command line) right from inside vim (I haven't looked into emacs to far yet but will shortly)
Labels: csound, emacs, python, vim
Monday, June 25, 2007
automating sound morphing using csound and python
I started with some small modifications to the instrument listed in the csound manual.. constants were changed to variables.
; This is a modified version from http://csounds.com/manual/html/loris.html
; The text describes the original instrunment.
; Morph the partials in trombone.sdif into the
; partials in meow.sdif. The start and end times
; for the morph are specified by parameters p4
; and p5, respectively. The morph occurs over the
; second of four pitches in each of the sounds,
; from .75 to 1.2 seconds in the flutter-tongued
; trombone tone, and from 1.7 to 2.2 seconds in
; the cat's meow. Different morphing functions are
; used for the frequency and amplitude envelopes,
; so that the partial amplitudes make a faster
; transition from trombone to cat than the frequencies.
; (The bandwidth envelopes use the same morphing
; function as the amplitudes.)
;
instr 1
ionset = p4
imorph = p5 - p4
irelease = p3 - p5
kttbn linseg 0, ionset, p6, imorph, p7, irelease, 2.4
ktmeow linseg 0, ionset, p8, imorph, p9, irelease, 3.4
kmfreq linseg 0, ionset, 0, .75*imorph, .25, .25*imorph, 1, irelease, 1
kmamp linseg 0, ionset, 0, .75*imorph, .9, .25*imorph, 1, irelease, 1
lorisread kttbn, p10, 1, 1, 1, 1, .001
lorisread ktmeow, p11, 2, 1, 1, 1, .001
lorismorph 1, 2, 3, kmfreq, kmamp, kmamp
asig lorisplay 3, 1, 1, 1
out asig
endin
after I did that I made the .sco file so it would work with dex tracker
;instr strt dur morph_start morph_end morph1_start morph1_end morph2_start morph2_end sample1 sample2
i1 0 4 .75 2.75 .75 1.2 1.7 2.2 "trombone.sdif" "meow.sdif"
lastly I created a function in python that I can use from a gui later
def loris_morph(dur, morph_start, morph_end, morph1_start, morph1_end, morph2_start, morph2_end, sample1, sample2):
"this is used to automate the process.. think of it as a command line routine for the loris opcodes outputs as morph.wav and plays the file"
loris = open('ltemp.sco','w')
sp = ' '
morphout = dur + sp + morph_start + sp + morph_end + sp + morph1_start + sp + morph1_end + sp + morph2_start + sp + morph2_end + sp + sample1 + sp + sample2
loris.write('i1 0 ')
loris.write(morphout)
loris.close()
cmd = 'csound loris4morph.orc 1temp.sco -o morph.wav'
os.path = """c://dex_tracker"""
loris_morph = subprocess.Popen(cmd, stdout=subprocess.PIPE).communicate()[0]
os.startfile('morph.wav')
Labels: gui, loris, python, sound morphing
Monday, June 18, 2007
csound 5.06, csound routines in awk, csound routines python
This one changes the start time throughout an entire file
#usages time_offset outfile
#this is the example command line
#gawk -f altertime.awk -v time_offset=4 -v outfile="testdat.sco" i1.sco
{$2 = $2 + time_offset}
{ print $0 > outfile } # print every line
This one changes the instrument number
#usages old_number new_number outfile
#this is the example command line
#gawk -f instrnumber.awk -v old_number=30 -v new_number=1 -v outfile="testdat.orc" temp30.orc
$1 == "instr" && $2 == old_number {
$2 = new_number
}
{ print $0 > outfile } # print every line
there is a couple of new python routines in csound routines available here.
http://sourceforge.net/projects/dex-tracker/
trafic overall looks like it has dropped off.. posibly something to do with school being out.
Labels: awk, csound, dex tracker, python
Monday, May 21, 2007
snack and tkinter
Labels: python, snack, tkinter
Wednesday, April 18, 2007
pocasts made simple
Gabcast is suppost to post to your google add automaticly... looks like they have a 200 mg limit per channel anyway haven't tested if they are going to be per channel or account.. The killer app with gabcast is that you can use your telephone to post your podcast... If you have an account that pays you just download from them and upload to the paything account...
Labels: csound, podcast, python
Friday, January 12, 2007
views of fltk in csound and python
Labels: c, c++, code generator, fltk, python, Tk
Thursday, December 14, 2006
how to hardcode csound instruments with file names for code generation in python
dlg = wx.FileDialog(self,"load orc file", ".", "", "*.*", wx.OPEN)
try:
if dlg.ShowModal() == wx.ID_OK:
filename = dlg.GetPath()
(this is just part of the code generated)
The top line of this generated code can be modified to change the message on the top or to limit the type of files that can be loaded (by changing *.* to *.ext).
After we get the file name we have to get it in a format that will work in csound. I found that using the full path name will not work in csound so that the file that you are using needs to be in the same directory as csound. In the above example filename is the entire filename including the path. To shorten it up you would use the command os.path.basename(filename). That will get rid of the path that was included in the filename before. If you want to change the extension name for any reason you can use [:-4] and then the name of the extension you want to use
batfilenametemp = os.path.basename(filename[:-4]) + '.bat'
In order for our instrument to be generated we have to write it out to a file. To do that we have to create a file and prepare it for our instrument.
sampleplayerfile = open(orcfilenametemp, 'w')
orcfilenametemp in this example is the name of our file. If you want a constant file name you would use a single quote 'sample.orc' instead of the variable name we used. To write to the file we use the command
sampleplayerfile.write("""
using triple quotes we can place all the code we want written to the file and it will save all our formatting including new lines. when we are ready to place our file name in the file we would end the string by using """) and then
sampleplayerfile.write('\n')
This creates a new line.
sampleplayerfile.write('asig soundin ')
this created the non variable part of the line.
sampleplayerfile.write('\"')
this generates the quotation mark we need around the filename
sampleplayerfile.write(os.path.basename(filename))
this will write the filename out to the file.
Once we reach that part we can finish it off and go back to triple quotes
sampleplayerfile.write('\"')
sampleplayerfile.write('\n')
sampleplayerfile.write("""
The entire example is available as part of Dex Tracker.
Labels: code generator, csound, python
Saturday, December 02, 2006
dex tracker beta .010
https://sourceforge.net/project/showfiles.php?group_id=156455&package_id=174569
Labels: csound, dex tracker, python, score editor