Csound Csound-dev Csound-tekno Search About

Re: [Cs-dev] Midifile writer opcode?

Date2006-10-22 21:49
FromMichael Gogins
SubjectRe: [Cs-dev] Midifile writer opcode?
The CsoundVST python extension module contains a Score class that can write MIDI and read MIDI files. You can access this module using the Python opcodes in Csound.

You can create a new Score object:

score = CsoundVST.Score()

You can append events to the score (p1 time, p2 dur, p3 MIDI status, p4 MIDI channel, p5 MIDI key, p6 MIDI velocity):

score.append(p1, p2, p3, p4, p5... up to p11)

You can save a MIDI file:

score.save("myfile.mid")

You can load a MIDI file:

 score.load("yourfile.mid")

You can retrieve Silence events from the score:

for event in score:
   print event

Silence events in turn can be translated to Csound "i" statements:

if event[2] == 144:
  p0 = "i"
  p1 = event[3]
  p2 = event[0]
  p3 = event[1]

Or as a string:

istatement = event.toCsoundIStatement()

Regards,
Mike


-----Original Message-----
>From: Steven Yi 
>Sent: Oct 22, 2006 2:59 PM
>To: Developer discussions 
>Subject: Re: [Cs-dev] Midifile writer opcode?
>
>Hi Jean,
>
>Is the MIDI note data meant to be recalled within the same running
>session of Csound or meant strictly to file to be used later in a
>different session or different program?
>
>If it's the former, you could use midiin and write all of the data
>captured into 4 tables and then play them out later again with
>midiout.
>
>If it's specifically to file, then the only thing I can think of is to
>use one of the python opcodes and to use a python midi library, which
>is probably no less of a contortion than using fouti/foutir and having
>to write out data in midi file format.
>
>That's probably not of much help but all I can think of.  Hopefully
>someone here will have a better answer!
>
>steven
>
>
>
>On 10/22/06, Pich� Jean  wrote:
>>
>>
>> I am trying to set up a way that MIDI note events can be recorded within csound so they can be recalled later.
>>
>> Looking through the manual didn't yield an opcode that seems to write a standard MIDI file.
>> I have looked at the fouti/foutir opcodes and they seem usable for my purpose but involve quite a few contortions.
>> A straight midifile structure would be more desirable.
>>
>> Any obvious solutions?
>>
>> j
>>
>> -------------------------------------------------------------------------
>> Using Tomcat but need to do more? Need to support web services, security?
>> Get stuff done quickly with pre-integrated technology to make your job easier
>> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
>> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
>> _______________________________________________
>> Csound-devel mailing list
>> Csound-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>
>>
>>
>
>-------------------------------------------------------------------------
>Using Tomcat but need to do more? Need to support web services, security?
>Get stuff done quickly with pre-integrated technology to make your job easier
>Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
>http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
>_______________________________________________
>Csound-devel mailing list
>Csound-devel@lists.sourceforge.net
>https://lists.sourceforge.net/lists/listinfo/csound-devel




-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2006-10-23 21:26
Fromschwaahed
SubjectRe: [Cs-dev] Midifile writer opcode?
AttachmentsNone