Friday, December 04, 2009

 

bacon basic song compiler

this is the pre-alpha python version. there is nothing exciting about the beep command for bacon basic, I just wanted something I could test to see if I can convert a simple python program to bacon basic. It should have some errors that have to be debugged before running. the song format is

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: , ,


Monday, June 29, 2009

 

pygame music grid beta .1

I don't think I am ready to declare a release yet but I will post it here. This is a base for piano rolls, sequencers drum machines exc in the python library pygame. This is tested in python 2.5. It isn't as far as the pycap version but the graphics are working alot better.. it is based on an ants demo from some python book I will need to look up so I can credit better. The rest of the code is stuff I have released before.. The intention is that it will read a file for the default values including an external python file that will recieve data from the grid.. The grid doesn't have to know anything and will be reused




pygame music grid base

Labels: , , , ,


Sunday, May 31, 2009

 

dexml

I am playing around with balabolka(text to speech) and it uses microsoft ana on my vista machine.. Att claims it has better voices than microsoft so it may be worth a try I find microsoft ana a little bit to robotic. The python project dexml came out it claims it is a dead simple xml I was thinking about playing around with some simple parsing of csd files with it, I started searching for more text to speech I came up with my last name dexter and my city corpus (probily out of context) , I will feel much better a couple of day from now if I am not found in a field :). I haven't decided if it is worth uploading podcasts or not since the advertising part of the deal is no more. I have been playing around with iron python and jython to see if there was anything I wanted to steal, to get a toggle on .net you start with a check box and then set the apearence to button or something like that and if there is a way to get something other than grey than .net it is, plus they have amusing podcasts like .net rocks.

Labels: , , ,


Saturday, May 23, 2009

 

pygame libraries usefull for piano rolls, drum machines exc

I am starting to look through the pygame libraries for python to see what would be useful for drum machines or piano rolls, (times lines exc....). two libraries stand out one is albow. They have a widget called gridview that is a good start on almost any project. This is the one I am currently playing around with. ocempgui is another one. It has a toggle widget that is a rectangle. The problem with the latter one is that it isn't obvious how to change the color of it..

Labels: , , ,


Monday, April 13, 2009

 

pycap drum machine or piano roll 1.0

Fixed the save file, added text that loads from a text file called text.dat also added a helpfile.html. You can use it as a drum machine or a piano roll or whatever you like, just drop this file in with the full distro from the beta.

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: , , ,


Friday, April 10, 2009

 

pycap drum machine or piano roll beta...

There are some serious issues.. The goal is a graphic program for other programs where the graphics and the sound are seperate such as csound. I came across pycap (popcap with python bindings) when I was looking through game engines and noticed that it will work places that an sdl based library can not. I don't know that scite is recomended for editing spacing can cause the python.dll to crash without letting you know what happened. idle is probily a much better idea.. This version isn't saving correctly but it is very close


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: , , , ,


Friday, January 23, 2009

 

ixi software python libraries

http://www.ixi-software.net/content/body_backyard_python.html

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:


Sunday, August 17, 2008

 

another try at parsing

after a day of debugging my code generator seems like alot of work in python and it seems like it would be alot easier to generate in awk. What does that mean.. It's the aproach yes I could do it the way I am doing it but it would be easier to use a grid and create and parse it with another grid and not generate any code (I think)... THe comment language is almost the only thing that works the same as those befour me.. I only looked at windows and projects that worked on my machine well.

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: , , ,


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)                

Labels: ,


Friday, May 23, 2008

 

another csound routines beta...

I have added

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: ,


Wednesday, May 14, 2008

 

graph tests for csound

Graph tests


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: , ,


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



Labels: ,


Friday, July 06, 2007

 

using vim to load csound instruments

There is this chick that works for unique (temp service) that looks very unhappy and I was thinking about her when I noticed the I HATE UNIX book in the library (she knows how to use you though) that aside one of the best things to happen to windows is the port of unix tools to windows..

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 ; it is unlikely to be duplicated for other reasons unless the file owner doesn't like dex tracking and it can be replaced in that case... the code currently is as follows

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 = [""";""", ':r', instr_name]
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: , , ,


Monday, June 25, 2007

 

automating sound morphing using csound and python

The following is untested as of yet so there may still be bugs. I was looking at the loris opcodes and I couldn't think or a reason why I wanted to do all that work to do some sound morphing. she needs a gui I thought so I have done the palermnary work towards that end.

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: , , ,


Monday, June 18, 2007

 

csound 5.06, csound routines in awk, csound routines python

csound 5.06 has been released. Looks like there is just a small amount of traffic. I have recently descovered the awk language and it appears that small programs can be written very rapidly with it.. Here is a couple of awk programs for csound that show how small these programs are. (I would figure there is alot of these programs somewhere but not released)

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: , , ,


Monday, May 21, 2007

 

snack and tkinter

I finally managed to get snack installed. It would make sense for them to make it easier to install.. I am also finding some additional info on snack at http://mail.python.org/pipermail/edu-sig/2001-December/001899.html. This provides a couple of worth while routines. Looking at all the sound stuff available it doesn't look complete and I am thinking a combined manual for a number of the toolkit would make things easier and I may do that, should be fairly easy to get 100 to 200 pages...

Labels: , ,


Wednesday, April 18, 2007

 

pocasts made simple

Gabcast! python audio video podcast #1


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: , ,


Friday, January 12, 2007

 

views of fltk in csound and python

Fltk is a very good framework for what it does. I have noticed a couple of short commings when it comes to working with fltk. If you want to use a purely csound environment and there is no reason why you wouldn't there is not a good way to get the file name from a file picker into csound (or at least it isn't an obvious thing someone has an example of). A whole class of file players and note testers have to be code generated and not built as csound instruments. One of the claims to fame of fltk is fluid a gui builder for flick. It isn't distributed as an .exe file and it really doesn't compile out of the box. There is an app that does compile but all it does is show off some of the features. I also tried the fltk for python, examples work very well but there again is no gui builder for fltk. I did try to combine it inside of a tk widget but apparently I just ended up with two windows a fltk window and a Tk window. To sum it up fltk has alot of promise and I am looking forward to having the other tools that are needed to make it sing.

Labels: , , , , ,


Thursday, December 14, 2006

 

how to hardcode csound instruments with file names for code generation in python

Any csound instrument that uses a filename hardcoded in the .orc or .sco filename is a good canadate for a code generator. The first step I did when creating my code generator was to get the filename. I started by generating some code in boa-constructor for a filename picker.

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: , ,


Saturday, December 02, 2006

 

dex tracker beta .010

Dex Tracker beta .010 is available. Should fix any issue with the score editor (if there was one anywhere besides while I was making changes) Also adds a feature to the score editor to play a selection of lines from a csound file (makes it much more tracker like). There is alot of coding and other tasks for anyone who is looking for a chance to get some python programming practice. The column header editor was changed a little bit but isn't saving to disk for some reason. See csound_routines_manual for instruction on how to get your .sco file compatable with the score editor.

https://sourceforge.net/project/showfiles.php?group_id=156455&package_id=174569

Labels: , , ,


This page is powered by Blogger. Isn't yours?