Csound Csound-dev Csound-tekno Search About

Score to MIDI ?

Date2006-01-31 16:38
FromDavid Akbari
SubjectScore to MIDI ?
Hello All,

I was wondering if any users could point me to any program that 
converts Csound SCORE data into standard MIDI format ?

The idea being simply to generate musical notation with a Csound score 
as input ? MIDI is merely a device for this and is not necessary if 
there exists such a program that converts directly Csound score to 
music notation. MIDI seems more flexible though ...

Any hints / tips / pointers on this idea are greatly appreciated!


-David

Date2006-01-31 18:18
FromSteven Yi
SubjectRe: Score to MIDI ?
AttachmentsNone  

Date2006-01-31 18:25
From"Dale Stewart"
SubjectRe: Score to MIDI ?
CSound scores typically contain more information than MIDI files, so I think
a direct translation would be difficult in many cases.  If your score
follows some very specific rules, you may be able to use an AWK or Perl
script to translate it into an intermediate text format, and then translate
to MIDI from there.  Is anyone aware of a tool that specifically converts a
text file to MIDI only?  I have experimented with LilyPond, which is capable
of generating sheet music and MIDI from the same source text file.  If you
just want a text file to MIDI conversion, give LilyPond a try.  I think some
kind of link between these tools would be great, but it would probably be a
LilyPond to CSound translation, rather than the reverse.

Disclaimer: I am not a highly experienced user of either of these tools, but
I have had some exposure to both of them, and have reproduced a few sheet
music scores in LilyPond with some success.

-----Original Message-----
From: David Akbari [mailto:dakbari@gmail.com] 
Sent: Tuesday, January 31, 2006 10:38 AM
To: csound@lists.bath.ac.uk
Subject: [Csnd] Score to MIDI ?

Hello All,

I was wondering if any users could point me to any program that 
converts Csound SCORE data into standard MIDI format ?

The idea being simply to generate musical notation with a Csound score 
as input ? MIDI is merely a device for this and is not necessary if 
there exists such a program that converts directly Csound score to 
music notation. MIDI seems more flexible though ...

Any hints / tips / pointers on this idea are greatly appreciated!


-David

-- 
Send bugs reports to this list.
To unsubscribe, send email to csound-unsubscribe@lists.bath.ac.uk

Date2006-01-31 18:44
From"R. D. Davis"
SubjectRe: Score to MIDI ?
AttachmentsNone  

Date2006-01-31 23:00
From"S. Massy"
SubjectRe: Score to MIDI ?
AttachmentsNone  

Date2006-02-01 00:03
FromDavid Akbari
SubjectRe: Score to MIDI ?
Thank you for all of your suggestions.

I wish the link that Kanata posted had the source code available !

I have checked out Midge and LilyPond and both seem to appear to do the 
job as well, but with some more work involved.

IMHO, this idea of Score to MIDI or vice-versa has taken on a much 
larger significance than in previous versions with Csound5 because of 
the addition of Format 1 support.

In the long term I will try and write a wrapper per Steven's 
suggestion. I can see there is clearly a need for it and I could 
undoubtedly learn much from attempting such an exercise.

On Jan 31, 2006, at 6:00 PM, S. Massy wrote:

> Incidentally, would there be a solution in the opposite direction:
> converting a MIDI file, or even some "text" notation to csound score?

For this I use Istvan Varga's commandline ScoreProc suite. It can be 
found at his cSounds.com site 
http://www.csounds.com/istvan/html/scoreproc.html

Although there are also several others that you may find for various 
platform specific solutions on the Utilities page at 
http://csounds.com/utilities

Incidentally, you do not even need a third party application to convert 
MIDI to Csound score. Here is a Csound file that was made by a leading 
Csound developer, Istvan Varga. With some modifications I have found 
this tool to be of great usefulness, and use it regularly when I am not 
using the commandline 'mid2sco' by the same author.



sr      =  44100
ksmps   =  100
nchnls  =  1

itmp   ftgen   1,0,16384,10,1,.5,.333333

/*--- ---*/

	opcode  cpsmid, k, k

kmid    xin

#define MIDI2CPS(xmidi) # (440.0*exp(log(2.0)*(($xmidi)-69.0)/12.0)) #
kcps    =       $MIDI2CPS(kmid)

         xout    kcps

                 endop

/*--- ---*/

		instr 1	; Play MIDI notes, record to score

inote	notnum
ivel	veloc
istrt	times
krel	release
	if (krel == 0) kgoto norel
kendt	times
kdur	=  kendt - istrt
	fprintks "mid2sco.sco", "i 1 %f %f %d %d\n", istrt, kdur, inote, ivel
	turnoff
norel:

		endin

/*--- ---*/

                instr   2 ; Play back the MIDI notes

inote	cpsmid	p4
a1      oscil   3000, inote, 1

        outs    a1,a1

                endin

/*--- ---*/


f 0 30
e




-David

Date2006-02-01 15:18
Fromjlato@mail.utexas.edu
SubjectRe: Score to MIDI ?
I'd like add that two command-line utilities, readmidi and writemidi, will
convert MIDI->score and score->MIDI.  They can be obtained from:
http://ems.music.utexas.edu/dwnld/rwmidi.zip
The binaries are for Windows, but source code is provided.  I believe readmidi
works with format 1.
John Lato

Quoting David Akbari :

> Thank you for all of your suggestions.
>
> I wish the link that Kanata posted had the source code available !
>
> I have checked out Midge and LilyPond and both seem to appear to do the
> job as well, but with some more work involved.
>
> IMHO, this idea of Score to MIDI or vice-versa has taken on a much
> larger significance than in previous versions with Csound5 because of
> the addition of Format 1 support.
>
> In the long term I will try and write a wrapper per Steven's
> suggestion. I can see there is clearly a need for it and I could
> undoubtedly learn much from attempting such an exercise.
>
> On Jan 31, 2006, at 6:00 PM, S. Massy wrote:
>
> > Incidentally, would there be a solution in the opposite direction:
> > converting a MIDI file, or even some "text" notation to csound score?
>
> For this I use Istvan Varga's commandline ScoreProc suite. It can be
> found at his cSounds.com site
> http://www.csounds.com/istvan/html/scoreproc.html
>
> Although there are also several others that you may find for various
> platform specific solutions on the Utilities page at
> http://csounds.com/utilities
>
> Incidentally, you do not even need a third party application to convert
> MIDI to Csound score. Here is a Csound file that was made by a leading
> Csound developer, Istvan Varga. With some modifications I have found
> this tool to be of great usefulness, and use it regularly when I am not
> using the commandline 'mid2sco' by the same author.
>
> 
> 
> sr      =  44100
> ksmps   =  100
> nchnls  =  1
>
> itmp   ftgen   1,0,16384,10,1,.5,.333333
>
> /*--- ---*/
>
> 	opcode  cpsmid, k, k
>
> kmid    xin
>
> #define MIDI2CPS(xmidi) # (440.0*exp(log(2.0)*(($xmidi)-69.0)/12.0)) #
> kcps    =       $MIDI2CPS(kmid)
>
>          xout    kcps
>
>                  endop
>
> /*--- ---*/
>
> 		instr 1	; Play MIDI notes, record to score
>
> inote	notnum
> ivel	veloc
> istrt	times
> krel	release
> 	if (krel == 0) kgoto norel
> kendt	times
> kdur	=  kendt - istrt
> 	fprintks "mid2sco.sco", "i 1 %f %f %d %d\n", istrt, kdur, inote, ivel
> 	turnoff
> norel:
>
> 		endin
>
> /*--- ---*/
>
>                 instr   2 ; Play back the MIDI notes
>
> inote	cpsmid	p4
> a1      oscil   3000, inote, 1
>
>         outs    a1,a1
>
>                 endin
>
> /*--- ---*/
> 
> 
> f 0 30
> e
> 
> 
>
>
> -David
>
> --
> Send bugs reports to this list.
> To unsubscribe, send email to csound-unsubscribe@lists.bath.ac.uk
>


Date2006-02-01 15:38
FromDavid Akbari
SubjectRe: Score to MIDI ?
John,

This is excellent ! It uses only standard ANSI "C" header files and 
compiles easily using just gcc on OSX and Linux !

What license is this under ? It does not have any indication within the 
source itself and I really think this utility should in some way be on 
cSounds.com or possibly merged with the CVS source tree ... since it is 
just two ANSI "C" compatible *.c files.


-David

On Feb 1, 2006, at 10:18 AM, jlato@mail.utexas.edu wrote:

> I'd like add that two command-line utilities, readmidi and writemidi, 
> will
> convert MIDI->score and score->MIDI.  They can be obtained from:
> http://ems.music.utexas.edu/dwnld/rwmidi.zip
> The binaries are for Windows, but source code is provided.  I believe 
> readmidi
> works with format 1.
> John Lato
>
> Quoting David Akbari :
>
>> Thank you for all of your suggestions.
>>
>> I wish the link that Kanata posted had the source code available !
>>
>> I have checked out Midge and LilyPond and both seem to appear to do 
>> the
>> job as well, but with some more work involved.
>>
>> IMHO, this idea of Score to MIDI or vice-versa has taken on a much
>> larger significance than in previous versions with Csound5 because of
>> the addition of Format 1 support.
>>
>> In the long term I will try and write a wrapper per Steven's
>> suggestion. I can see there is clearly a need for it and I could
>> undoubtedly learn much from attempting such an exercise.
>>
>> On Jan 31, 2006, at 6:00 PM, S. Massy wrote:
>>
>>> Incidentally, would there be a solution in the opposite direction:
>>> converting a MIDI file, or even some "text" notation to csound score?
>>
>> For this I use Istvan Varga's commandline ScoreProc suite. It can be
>> found at his cSounds.com site
>> http://www.csounds.com/istvan/html/scoreproc.html
>>
>> Although there are also several others that you may find for various
>> platform specific solutions on the Utilities page at
>> http://csounds.com/utilities
>>
>> Incidentally, you do not even need a third party application to 
>> convert
>> MIDI to Csound score. Here is a Csound file that was made by a leading
>> Csound developer, Istvan Varga. With some modifications I have found
>> this tool to be of great usefulness, and use it regularly when I am 
>> not
>> using the commandline 'mid2sco' by the same author.
>>
>> 
>> 
>> sr      =  44100
>> ksmps   =  100
>> nchnls  =  1
>>
>> itmp   ftgen   1,0,16384,10,1,.5,.333333
>>
>> /*--- ---*/
>>
>> 	opcode  cpsmid, k, k
>>
>> kmid    xin
>>
>> #define MIDI2CPS(xmidi) # (440.0*exp(log(2.0)*(($xmidi)-69.0)/12.0)) #
>> kcps    =       $MIDI2CPS(kmid)
>>
>>          xout    kcps
>>
>>                  endop
>>
>> /*--- ---*/
>>
>> 		instr 1	; Play MIDI notes, record to score
>>
>> inote	notnum
>> ivel	veloc
>> istrt	times
>> krel	release
>> 	if (krel == 0) kgoto norel
>> kendt	times
>> kdur	=  kendt - istrt
>> 	fprintks "mid2sco.sco", "i 1 %f %f %d %d\n", istrt, kdur, inote, ivel
>> 	turnoff
>> norel:
>>
>> 		endin
>>
>> /*--- ---*/
>>
>>                 instr   2 ; Play back the MIDI notes
>>
>> inote	cpsmid	p4
>> a1      oscil   3000, inote, 1
>>
>>         outs    a1,a1
>>
>>                 endin
>>
>> /*--- ---*/
>> 
>> 
>> f 0 30
>> e
>> 
>> 
>>
>>
>> -David
>>
>> --
>> Send bugs reports to this list.
>> To unsubscribe, send email to csound-unsubscribe@lists.bath.ac.uk
>>
>
>
>
> -- 
> Send bugs reports to this list.
> To unsubscribe, send email to csound-unsubscribe@lists.bath.ac.uk
>

Date2006-02-02 01:46
FromDave Phillips
SubjectRe: Score to MIDI ?
David Akbari wrote:

> I was wondering if any users could point me to any program that 
> converts Csound SCORE data into standard MIDI format ?
>
> The idea being simply to generate musical notation with a Csound score 
> as input ? MIDI is merely a device for this and is not necessary if 
> there exists such a program that converts directly Csound score to 
> music notation. MIDI seems more flexible though ...
>
> Any hints / tips / pointers on this idea are greatly appreciated!
>
Hi David:

  Don't forget about Common Music ! You can generate your Csound score 
and MIDI file at the same time. :)

  There may be a way to import a Csound score into CM. From there to 
MIDI is a simple step.

Best,

dp

Date2006-02-02 06:59
From"S. Massy"
SubjectRe: Score to MIDI ?
AttachmentsNone  

Date2006-02-02 08:19
FromAnthony Kozar
SubjectRe: Score to MIDI ?
I have had the same problem in the past using a different Midi to Score
program.  I agree that it would be nice if there were some simple opcodes
like cpspch to convert midi note numbers to cps, pch, and oct formats.

I good route to go for now might be to write some macros or user-defined
opcodes for the task.

Here is a macro that converts Midi notenum to cps, I think (from Dr. B or
David Akbari, not sure who):

#define MIDI2CPS(xmidi) # (440.0*exp(log(2.0)*(($xmidi)-69.0)/12.0)) #

This might be better like this:

#define MIDI2CPS(xmidi) # (cpsoct((($xmidi)+36.0)/12.0)) #

And to get octave-pitchclass notation:

#define MIDI2PCH(xmidi) # (pchoct((($xmidi)+36.0)/12.0)) #

I hope these are correct.  (Someone will correct me if they are not :)

Anthony Kozar
anthonykozar AT sbcglobal DOT net


S. Massy wrote on 2/2/06 1:59 AM:

> The sources compile well and the programme works likewise. However, the
> programme leaves the notes in the score in MIDI Numbers, which would be
> fine, if only I knew what pitch converter to use: the *midi opcodes seem
> to expect midi events, not p-fields, so I'm not sure where to go from
> here. Anybody knows of a suitable way to convert MIDI note numbers to
> more csound-friendly notations?
> Thanks,

Date2006-02-02 16:18
Fromjlato@mail.utexas.edu
SubjectRe: Score to MIDI ?
I've always used
cpsoct(iMIDInn/12 + 3)
John Lato

Quoting "S. Massy" :

> On Wed, Feb 01, 2006 at 09:18:11AM -0600, jlato@mail.utexas.edu wrote:
> > I'd like add that two command-line utilities, readmidi and writemidi, will
> > convert MIDI->score and score->MIDI.  They can be obtained from:
> > http://ems.music.utexas.edu/dwnld/rwmidi.zip
> > The binaries are for Windows, but source code is provided.  I believe
> readmidi
> > works with format 1.
> The sources compile well and the programme works likewise. However, the
> programme leaves the notes in the score in MIDI Numbers, which would be
> fine, if only I knew what pitch converter to use: the *midi opcodes seem
> to expect midi events, not p-fields, so I'm not sure where to go from
> here. Anybody knows of a suitable way to convert MIDI note numbers to
> more csound-friendly notations?
> Thanks,
> S.M.
> > John Lato
> >
> > Quoting David Akbari :
> >
> > > Thank you for all of your suggestions.
> > >
> > > I wish the link that Kanata posted had the source code available !
> > >
> > > I have checked out Midge and LilyPond and both seem to appear to do the
> > > job as well, but with some more work involved.
> > >
> > > IMHO, this idea of Score to MIDI or vice-versa has taken on a much
> > > larger significance than in previous versions with Csound5 because of
> > > the addition of Format 1 support.
> > >
> > > In the long term I will try and write a wrapper per Steven's
> > > suggestion. I can see there is clearly a need for it and I could
> > > undoubtedly learn much from attempting such an exercise.
> > >
> > > On Jan 31, 2006, at 6:00 PM, S. Massy wrote:
> > >
> > > > Incidentally, would there be a solution in the opposite direction:
> > > > converting a MIDI file, or even some "text" notation to csound score?
> > >
> > > For this I use Istvan Varga's commandline ScoreProc suite. It can be
> > > found at his cSounds.com site
> > > http://www.csounds.com/istvan/html/scoreproc.html
> > >
> > > Although there are also several others that you may find for various
> > > platform specific solutions on the Utilities page at
> > > http://csounds.com/utilities
> > >
> > > Incidentally, you do not even need a third party application to convert
> > > MIDI to Csound score. Here is a Csound file that was made by a leading
> > > Csound developer, Istvan Varga. With some modifications I have found
> > > this tool to be of great usefulness, and use it regularly when I am not
> > > using the commandline 'mid2sco' by the same author.
> > >
> > > 
> > > 
> > > sr      =  44100
> > > ksmps   =  100
> > > nchnls  =  1
> > >
> > > itmp   ftgen   1,0,16384,10,1,.5,.333333
> > >
> > > /*--- ---*/
> > >
> > > 	opcode  cpsmid, k, k
> > >
> > > kmid    xin
> > >
> > > #define MIDI2CPS(xmidi) # (440.0*exp(log(2.0)*(($xmidi)-69.0)/12.0)) #
> > > kcps    =       $MIDI2CPS(kmid)
> > >
> > >          xout    kcps
> > >
> > >                  endop
> > >
> > > /*--- ---*/
> > >
> > > 		instr 1	; Play MIDI notes, record to score
> > >
> > > inote	notnum
> > > ivel	veloc
> > > istrt	times
> > > krel	release
> > > 	if (krel == 0) kgoto norel
> > > kendt	times
> > > kdur	=  kendt - istrt
> > > 	fprintks "mid2sco.sco", "i 1 %f %f %d %d\n", istrt, kdur, inote, ivel
> > > 	turnoff
> > > norel:
> > >
> > > 		endin
> > >
> > > /*--- ---*/
> > >
> > >                 instr   2 ; Play back the MIDI notes
> > >
> > > inote	cpsmid	p4
> > > a1      oscil   3000, inote, 1
> > >
> > >         outs    a1,a1
> > >
> > >                 endin
> > >
> > > /*--- ---*/
> > > 
> > > 
> > > f 0 30
> > > e
> > > 
> > > 
> > >
> > >
> > > -David
> > >
> > > --
> > > Send bugs reports to this list.
> > > To unsubscribe, send email to csound-unsubscribe@lists.bath.ac.uk
> > >
> >
> >
> >
> > --
> > Send bugs reports to this list.
> > To unsubscribe, send email to csound-unsubscribe@lists.bath.ac.uk
>
> --
> smassy@sdf.lonestar.org
> --
> Send bugs reports to this list.
> To unsubscribe, send email to csound-unsubscribe@lists.bath.ac.uk
>