Great stuff, guys! This will be tons of fun to play with… I got tired of renaming files to “rtest.txt” and then renaming the jpg, so here’s a quick patch that allows you to give the batch file a file name on the command line, e.g., open up a command shell and type
polygraph my-file.txt
The jpg file is named “Polygraph-my-file.jpg.”
Patch for Polygraph.bat:
***Polygraph-orig.bat Thu Apr 17 08:43:00 2008
—Polygraph.bat Fri Apr 18 22:29:16 2008
*** 1,3 ****
! “C:\Program Files\R\R-2.6.2\bin\R.exe” --no-save < Polygraph.r 440 5 boxplot 10 1.5 equal
rem
rem For use with version 1.0.x
— 1,3 ----
! “C:\Program Files\R\R-2.6.2\bin\R.exe” --no-save < Polygraph.r 440 5 boxplot 10 1.5 equal %1
rem
rem For use with version 1.0.x
Patch for Polygraph.r:
*** Polygraph-orig.r Thu Apr 17 14:23:00 2008
— Polygraph.r Fri Apr 18 22:49:19 2008
*** 21,30 ****
args[6] ← 10
args[7] ← 1.5
args[8] ← “equal”
test to see if we’ve got the right number of command line Arguments and if we have use them
we just hope they’re all in the correct order
testArgs ← commandArgs()
! if (length(testArgs) == 8){args ← commandArgs()}
length (commandArgs)
[3] is pitch shift (real),
[4] filtering diff witdth (real),
— 21,31 ----
args[6] ← 10
args[7] ← 1.5
args[8] ← “equal”
test to see if we’ve got the right number of command line Arguments and if we have use them
we just hope they’re all in the correct order
testArgs ← commandArgs()
! if (length(testArgs) == 9){args ← commandArgs()}
length (commandArgs)
[3] is pitch shift (real),
[4] filtering diff witdth (real),
*** 32,37 ****
— 33,39 ----
[6] is min number of data points for note to be included in graph (integer)
[7] is h in vioplot which determines the smoothing - around 1.5 looks good (real)
[8] is temperament either equal or justD
#############################
What temperament are we plotting against
set equal temperament as the default
*** 40,46 ****
#############################
read data from file “rtest.txt” in current working directory
! rawdata ← read.table(“rtest.txt”, header=TRUE)
#############################
Trying some Filtering using value of cents from command line argument
— 42,48 ----
#############################
read data from file “rtest.txt” in current working directory
! rawdata ← read.table(args[9], header=TRUE)
#############################
Trying some Filtering using value of cents from command line argument
*** 129,135 ****
#############################
output graph to JPEG file rather than within R console
! jpeg(“Polygraph.jpg”, width = 800, height = 600, units = “px”,)
#############################
— 131,138 ----
#############################
output graph to JPEG file rather than within R console
! outfile ← paste(“Polygraph”,unlist(strsplit(args[9],“\.”))[1],“.jpg”,sep=“”)
! jpeg(outfile, width = 800, height = 600, units = “px”,)
#############################