[R] sound library

Uwe Ligges ligges at statistik.uni-dortmund.de
Sat Dec 20 16:25:48 CET 2003


giojona at libero.it wrote:

> I'm collaborating with and electronic musician to experiment on the production of music from number sequences. As I'm an R user I started playing around with the sound library and I found it very useful. However there are several things I do not understand (I'm not an expert in acustic nor audio signal treatment).
> 
> The first thing I'd like to understand is: let s be a normalized sample and suppose it generates a waveform with non audible frequencies. Then if I play it trough the function "play" (I'm using an R-window version) I won't hear anything. Then I play: play(10000*s) and I can hear something. What is happening to the audio sample? 

Looks like it is not checked whether the generated "sound", i.e. a wave 
file, is valid. Using 16 bit resolution, you cannot have more than 2^16 
integers, but 10000*s contains invalid integers for the wave representation.


> I saved as wave files both s and 10000*s and then with my musician friend we looked at the waveforms we got.
> They are totally different from each other and we couldn't fidure out which transformation of s generated the 10000*s waveform.

Since you are writing invalid values to the file, those are interpreted 
in the "wrong" way and you might get something different.


> Can anyone explain what is going on?

Two more comments:
"sound" as is does not pass Rcmd check on Windows (because Media Player 
is not available on the system I do compile on, etc.) and has some more 
deficiencies. It's only available as a Windows binary on CRAN because of 
my personal interest in the package.
The author of the package, Matthias Heymann, has been informed, but he 
is not going to fix the bugs in the near future, unfortunately.

I am planing to write a package for the analysis of music (including 
loading / playing / saving wave files) next year myself.

Uwe Ligges



> Thanks in advance
> 
> Giovanna Jona Lasinio
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help




More information about the R-help mailing list