Friday, July 13, 2007

 

loading orc files into csd with autoit and mdinotepad

This is a script to load csound intruments into an orc file. The scripting
language is autoit. I created two tags ; and ; to avoid some
problems that might occur in some text editors. It is hardcoded but can be
rewritten to make it a command line variable. The editor used is mdiNotepad
available at http://koti.mbnet.fi/~fidgety/ (another editor that looked
intresting is Columnizer by Gulf Coastal Software). I don't know that this
is the best way to do this and would like to hear suggestions about editors
that insert into other files. The scipt listed as a non-debugged version for vim isn't going to work well enough to mess with...

Run("mdipad.exe c:\dex_tracker\bay-at-night.csd")


; Wait for the Notepad become active - it is titled "Untitled - Notepad" on
English systems
WinWaitActive("mdiNotepad")
sleep(500)
;Send("c:\dex_tracker\bay-at-night.csd {ENTER}")
sleep(500)
send("^f")
send(";{ENTER}")
sleep(500)
send("{ESCAPE}")
sleep(500)
Send("^f")
send(";{ENTER}")
sleep(500)
send("{ESCAPE}{END}")
send("^i strings.orc{ENTER}" )


Sleep(500)

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


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