Is there a package to output midi files for sonification of data

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

Is there a package to output midi files for sonification of data

Greg Hooper
Hi, I have been using Matlab to produce midi files for sonfication and
algorithmic composition projects. I would like to transfer that work into R
(in which I am a total newbie) and have been looking for a package that can
read and write midi files. No success so far so does anyone know of one? I
have seen that I can output to csv and then use a utility to convert csv to
midi (and vice-versa). But native R would be better if possible.
thanks for any help, Greg

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: Is there a package to output midi files for sonification of data

Suzen, Mehmet
Hi Greg,

 you can try tuneR :
http://cran.r-project.org/web/packages/tuneR/

Best,
-m

On 26 December 2012 22:04, Greg Hooper <[hidden email]> wrote:

> Hi, I have been using Matlab to produce midi files for sonfication and
> algorithmic composition projects. I would like to transfer that work into R
> (in which I am a total newbie) and have been looking for a package that can
> read and write midi files. No success so far so does anyone know of one? I
> have seen that I can output to csv and then use a utility to convert csv to
> midi (and vice-versa). But native R would be better if possible.
> thanks for any help, Greg
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: Is there a package to output midi files for sonification of data

Greg Hooper
thanks Mehmet - but I can't see how to read or write midifiles from the
tuneR docs. Looks primarily for wav file analysis. Am I missing something?
Greg

On 27 December 2012 09:49, Suzen, Mehmet <[hidden email]> wrote:

> Hi Greg,
>
>  you can try tuneR :
> http://cran.r-project.org/web/packages/tuneR/
>
> Best,
> -m
>
> On 26 December 2012 22:04, Greg Hooper <[hidden email]> wrote:
> > Hi, I have been using Matlab to produce midi files for sonfication and
> > algorithmic composition projects. I would like to transfer that work
> into R
> > (in which I am a total newbie) and have been looking for a package that
> can
> > read and write midi files. No success so far so does anyone know of one?
> I
> > have seen that I can output to csv and then use a utility to convert csv
> to
> > midi (and vice-versa). But native R would be better if possible.
> > thanks for any help, Greg
> >
> >         [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > [hidden email] mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
>

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: Is there a package to output midi files for sonification of data

bbolker
In reply to this post by Suzen, Mehmet
Suzen, Mehmet <msuzen <at> gmail.com> writes:

>
> Hi Greg,
>
>  you can try tuneR :
> http://cran.r-project.org/web/packages/tuneR/
>
> Best,
> -m

  tuneR writes Wave (.WAV?) files as output; it can also write output
suitable for lilypond input -- and lilypond can write MIDI output.
 
  Bottom line, I think you may have to use an external program to
convert Wave to midi, or something.  It wouldn't be too hard to
write ABC (http://abcnotation.org) output and run it through abc2midi ...

http://rpubs.com/bbolker/3237 is an example of some stuff I was
playing with recently along these lines.

  I don't see any midi input anywhere ... library("sos"); findFn("midi")
doesn't give a lot of hits ...

>
> On 26 December 2012 22:04, Greg Hooper <gregstuarthooper <at> gmail.com> wrote:
> > Hi, I have been using Matlab to produce midi files for sonfication and
> > algorithmic composition projects. I would like to transfer that work into R
> > (in which I am a total newbie) and have been looking for a package that can
> > read and write midi files. No success so far so does anyone know of one? I
> > have seen that I can output to csv and then use a utility to convert csv to
> > midi (and vice-versa). But native R would be better if possible.
> > thanks for any help, Greg
> >

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: Is there a package to output midi files for sonification of data

Greg Hooper
In reply to this post by Greg Hooper
thanks Ben - hmm I think I will use a midi/csv utility
http://www.fourmilab.ch/webtools/midicsv/ and see how that goes. Another
option is http://playitbyr.org/index.html and output to Csound and from
there to midi. PlayitbyR and into Csound might be something that suits your
work, Csound being enormously powerful although a bit clunky to use -
although I haven't used it in about 10 years - maybe it has improved since
then, perhaps I'd better look  :)

thanks, Greg



>tuneR writes Wave (.WAV?) files as output; it can also write output

suitable for lilypond input -- and lilypond can write MIDI output.

  Bottom line, I think you may have to use an external program to
convert Wave to midi, or something.  It wouldn't be too hard to
write ABC (http://abcnotation.org) output and run it through abc2midi ...
http://rpubs.com/bbolker/3237 is an example of some stuff I was
playing with recently along these lines.

  I don't see any midi input anywhere ... library("sos"); findFn("midi")
doesn't give a lot of hits ...






On 27 December 2012 10:03, Greg Hooper <[hidden email]> wrote:

> thanks Mehmet - but I can't see how to read or write midifiles from the
> tuneR docs. Looks primarily for wav file analysis. Am I missing something?
> Greg
>
> On 27 December 2012 09:49, Suzen, Mehmet <[hidden email]> wrote:
>
>> Hi Greg,
>>
>>  you can try tuneR :
>> http://cran.r-project.org/web/packages/tuneR/
>>
>> Best,
>> -m
>>
>> On 26 December 2012 22:04, Greg Hooper <[hidden email]>
>> wrote:
>> > Hi, I have been using Matlab to produce midi files for sonfication and
>> > algorithmic composition projects. I would like to transfer that work
>> into R
>> > (in which I am a total newbie) and have been looking for a package that
>> can
>> > read and write midi files. No success so far so does anyone know of
>> one? I
>> > have seen that I can output to csv and then use a utility to convert
>> csv to
>> > midi (and vice-versa). But native R would be better if possible.
>> > thanks for any help, Greg
>> >
>> >         [[alternative HTML version deleted]]
>> >
>> > ______________________________________________
>> > [hidden email] mailing list
>> > https://stat.ethz.ch/mailman/listinfo/r-help
>> > PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> > and provide commented, minimal, self-contained, reproducible code.
>>
>
>

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: Is there a package to output midi files for sonification of data

Suzen, Mehmet-2
On 27 December 2012 08:46, Greg Hooper <[hidden email]> wrote:
> thanks Ben - hmm I think I will use a midi/csv utility
> http://www.fourmilab.ch/webtools/midicsv/ and see how that goes. Another

Hi Greg, Yes you are right, It is for wav analysis but as Ben
suggests. Conversion
should not be difficult. Also I think it must be 'trivial' to
translate that Perl
script's (package) to R, if you are really after pure R solution.


> option is http://playitbyr.org/index.html and output to Csound and from

It is interesting. Can you do some meaningful data exploration with
playitbyr or is it
pure fun?

> there to midi. PlayitbyR and into Csound might be something that suits your

If you are going to use external program to convert that maybe you can
use wav files after all, hence the tuneR.

Best,
-m

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: Is there a package to output midi files for sonification of data

Suzen, Mehmet
In reply to this post by Greg Hooper
On 27 December 2012 08:46, Greg Hooper <[hidden email]> wrote:
> thanks Ben - hmm I think I will use a midi/csv utility
> http://www.fourmilab.ch/webtools/midicsv/ and see how that goes. Another

Hi Greg, Yes you are right, It is for wav analysis but as Ben
suggests. Conversion
should not be difficult. Also I think it must be 'trivial' to
translate that Perl
script's (package) to R, if you are really after pure R solution.
(I think having something native to read midi will be beneficial to
community)

> option is http://playitbyr.org/index.html and output to Csound and from

It is interesting. Can you do some meaningful data exploration with
playitbyr or is it
pure fun?

> there to midi. PlayitbyR and into Csound might be something that suits your

If you are going to use external program to convert that maybe you can
use wav files after all, hence the tuneR.

Best,
-m

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: Is there a package to output midi files for sonification of data

Greg Hooper
thanks again Mehmet - the midicsv utility is in C (of which I am ignorant).
I will have a look at that to see if I can write a native R version. It
only has to do midi_in and midi_out, the rest can be left up to R. That
will take me ages, but I can just use the utility externally for the moment

Greg

On 27 December 2012 23:39, Suzen, Mehmet <[hidden email]> wrote:

> On 27 December 2012 08:46, Greg Hooper <[hidden email]> wrote:
> > thanks Ben - hmm I think I will use a midi/csv utility
> > http://www.fourmilab.ch/webtools/midicsv/ and see how that goes. Another
>
> Hi Greg, Yes you are right, It is for wav analysis but as Ben
> suggests. Conversion
> should not be difficult. Also I think it must be 'trivial' to
> translate that Perl
> script's (package) to R, if you are really after pure R solution.
> (I think having something native to read midi will be beneficial to
> community)
>
> > option is http://playitbyr.org/index.html and output to Csound and from
>
> It is interesting. Can you do some meaningful data exploration with
> playitbyr or is it
> pure fun?
>
> > there to midi. PlayitbyR and into Csound might be something that suits
> your
>
> If you are going to use external program to convert that maybe you can
> use wav files after all, hence the tuneR.
>
> Best,
> -m
>

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: Is there a package to output midi files for sonification of data

bbolker
On 12-12-27 03:04 PM, Greg Hooper wrote:
> thanks again Mehmet - the midicsv utility is in C (of which I am
> ignorant). I will have a look at that to see if I can write a native R
> version. It only has to do midi_in and midi_out, the rest can be left up
> to R. That will take me ages, but I can just use the utility externally
> for the moment
>
> Greg

   I wouldn't bother to try to write a native R version.  Since  getting
R to talk to compiled C code, is pretty easy, if I wanted to integrate
it more closely into R I would take the C code and figure out how I
could integrate it into an R package as compiled code with a thin R
wrapper around it. Since the code "license" is "public domain", you
could even redistribute the package freely. But if it's just for
personal use, and you don't need it to be incredibly slick, using it
externally (via system()) seems perfectly sensible.

>
> On 27 December 2012 23:39, Suzen, Mehmet <[hidden email]
> <mailto:[hidden email]>> wrote:
>
>     On 27 December 2012 08:46, Greg Hooper <[hidden email]
>     <mailto:[hidden email]>> wrote:
>     > thanks Ben - hmm I think I will use a midi/csv utility
>     > http://www.fourmilab.ch/webtools/midicsv/ and see how that goes.
>     Another
>
>     Hi Greg, Yes you are right, It is for wav analysis but as Ben
>     suggests. Conversion
>     should not be difficult. Also I think it must be 'trivial' to
>     translate that Perl
>     script's (package) to R, if you are really after pure R solution.
>     (I think having something native to read midi will be beneficial to
>     community)
>
>     > option is http://playitbyr.org/index.html and output to Csound and
>     from
>
>     It is interesting. Can you do some meaningful data exploration with
>     playitbyr or is it
>     pure fun?
>
>     > there to midi. PlayitbyR and into Csound might be something that
>     suits your
>
>     If you are going to use external program to convert that maybe you can
>     use wav files after all, hence the tuneR.
>
>     Best,
>     -m
>
>

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: Is there a package to output midi files for sonification of data

Greg Hooper
thanks Ben - that sounds a lot more efficient

On 28 December 2012 06:23, Ben Bolker <[hidden email]> wrote:

> On 12-12-27 03:04 PM, Greg Hooper wrote:
> > thanks again Mehmet - the midicsv utility is in C (of which I am
> > ignorant). I will have a look at that to see if I can write a native R
> > version. It only has to do midi_in and midi_out, the rest can be left up
> > to R. That will take me ages, but I can just use the utility externally
> > for the moment
> >
> > Greg
>
>    I wouldn't bother to try to write a native R version.  Since  getting
> R to talk to compiled C code, is pretty easy, if I wanted to integrate
> it more closely into R I would take the C code and figure out how I
> could integrate it into an R package as compiled code with a thin R
> wrapper around it. Since the code "license" is "public domain", you
> could even redistribute the package freely. But if it's just for
> personal use, and you don't need it to be incredibly slick, using it
> externally (via system()) seems perfectly sensible.
>
> >
> > On 27 December 2012 23:39, Suzen, Mehmet <[hidden email]
> > <mailto:[hidden email]>> wrote:
> >
> >     On 27 December 2012 08:46, Greg Hooper <[hidden email]
> >     <mailto:[hidden email]>> wrote:
> >     > thanks Ben - hmm I think I will use a midi/csv utility
> >     > http://www.fourmilab.ch/webtools/midicsv/ and see how that goes.
> >     Another
> >
> >     Hi Greg, Yes you are right, It is for wav analysis but as Ben
> >     suggests. Conversion
> >     should not be difficult. Also I think it must be 'trivial' to
> >     translate that Perl
> >     script's (package) to R, if you are really after pure R solution.
> >     (I think having something native to read midi will be beneficial to
> >     community)
> >
> >     > option is http://playitbyr.org/index.html and output to Csound and
> >     from
> >
> >     It is interesting. Can you do some meaningful data exploration with
> >     playitbyr or is it
> >     pure fun?
> >
> >     > there to midi. PlayitbyR and into Csound might be something that
> >     suits your
> >
> >     If you are going to use external program to convert that maybe you
> can
> >     use wav files after all, hence the tuneR.
> >
> >     Best,
> >     -m
> >
> >
>
>

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: Is there a package to output midi files for sonification of data

Suzen, Mehmet
In reply to this post by bbolker
On 27 December 2012 21:23, Ben Bolker <[hidden email]> wrote:
> On 12-12-27 03:04 PM, Greg Hooper wrote:
> it more closely into R I would take the C code and figure out how I
> could integrate it into an R package as compiled code with a thin R
> wrapper around it. Since the code "license" is "public domain", you


Brilliant! Ben, while interfacing C code to R is very well established.


> could even redistribute the package freely. But if it's just for
> personal use, and you don't need it to be incredibly slick, using it
> externally (via system()) seems perfectly sensible.
>

I would not suggest that. Using system is just a "hack" in my opinion.
It is preferable to have a proper interface to R via .C  in a package framework.

Concerning license, It is the responsibility of user/developer to
consider that :)

Cheers,
-m

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.