How to convert SFZ synthesizer format to (soundfont) SF2? - soundfont

I have created a sfz file and compiled a corresponding file-tree of instrument samples.
Is there software that convert this sfz filetree to a sf2 soundfont file?
The reason is: I can easily create the sfz file-tree, and easily use the sf2 file. However, creating the sf2 requires special software and playing the sfz does not appear to be supported by timidity.

Here are two different utilities you can use to convert an sfz file and file-tree to an sf2 file.
Use polyphone with the following command: polyphone -1 -i your-soundfont.sfz
Use convertSoundBank.py from freepats-tools: convertSoundBank.py grandPiano.sfz grandPiano.sf2

Related

Read a file in R without changing the working directory

How can others who run my R program read a file(eg: csv) used in my R code without having to change the working directory in setwd()?
I will suggest you use the here() function in the here package in your code like this:
library(here)
Data1 <- read_csv(here("test_data.csv"))
read.csv has a file argument and if I were to quote from the inbuilt R help about file:
If it does not contain an absolute path, the file name is relative to
the current working directory, getwd().
So, providing the absolute path of the file inside the file argument solves this problem.
In Windows
Suppose your file name is test.csv and it's located in D:\files\test_folder (you can get the location of any file from its properties in Windows)
For reading this file you run:
df<-read.csv('D:\\files\\test_folder\\test.csv')
or
df<-read.csv('D:/files/test_folder/test.csv')
Suggested reading: Why \\ instead of \ and Paths in programming languages
Haven't used R in Linux but maybe Getting a file path in Linux might help
Read from web
Just type in the web address of the dataset in the file attribute. Try:
df<-read.csv('https://raw.githubusercontent.com/AdiPersonalWorks/Random/master/student_scores%20-%20student_scores.csv')
Note: This link contains a list of 25 students with their study hours and marks. I myself used this dataset for one of my earlier tasks and its perfectly safe

How do I copy a file in Julia?

I am trying to copy a file using Julia functions with the hope of manipulating the file and then use that copied version for various tasks in the Julia programming language. Can someone provide some example code of copying a file in Julia?
I guess I could do use read then write but it seems like I would be reinventing the wheel.
Is there a standard library function for this?
Inspired by this question.
Just use the built in function cp(src, dst).
Copy the file, link, or directory from src to dst. force=true will first remove an existing dst.
Afterwards you can open the file and manipulate it. Of course you could also open both source an destination files simultaneously and copy and manipulate it line by line.

How to avoid/disable .crc files for writing csv files in sparklyr?

I am writing spark data frame to local file system as a csv file by using the spark_write_csv function. In the output directory, there is one .crc file for each part file.
I am looking for any functions or property of Hadoop/Spark that avoid generation of these .crc files.
flights_tbl<-copy_to(sc,flights,"flights")
spark_write_csv(flights_tbl, path="xxx" , mode = "overwrite")
This is the output i get:
.part-00000-365d53be-1946-441a-8e25-84cb009f2f45-c000.csv.crc
part-00000-365d53be-1946-441a-8e25-84cb009f2f45-c000
It is not possible. Checksum files are generated for all Spark Data Sources and built-in legacy RDD API and the behavior is not configurable.
To avoid it completely you'd have:
Implement your own Hadoop Input format.
Or implement your own Data Source (v1 or v2) which doesn't depend on Hadoop input formats.
and add spakrlyr wrappers to expose in R codebase.

Renaming files in RStudio that have been sourced other places

I have a few R files that contain functions imported and used by several other R files. I import these functions with the source function. Naturally, the scope of a particular file might change over time, and recently I wanted to rename a file I had already sourced in many other places.
I'm using RStudio, and I have been unable to find a way to do this except for either manually updating each dependent file, or creating some external code to scan through the files.
Is there no way to do consistent renaming in RStudio? Alternatively, am I doing something wrong by using source to add functions?
You may or may not find this satisfactory. Create a parent script with the old name that sources the script with the new name.
Extending this, you could just create a general preamble script, called something like "preamble.R", that sources all general utility scripts you have. Such an approach is common (I believe) with TeX. Then you only have one place to update file names.

run saxon xquery over batch of xml files and produce one output file for each input file

How do I run xquery using Saxon HE 9.5 on a directory of files using the build in command-line? I want to take one file as input and produce one file as output.
This sounds very obvious, but I can't figure it out without using saxon extensions that are only available in PE and EE.
I can read in the files in a directory using fn:collection() or using input parameters. But then I can only produce one output file.
To keep things simple, let's say I have a directory "input" with my files 01.xml, 02.xml, ... 99.xml. Then I have an "output" directory where I want to produce the files with the same names -- 01.xml, 02.xml, ... 99.xml.
Any ideas?
My real data set is large enough (tens of thousands of files) that I don't want to fire off the jvm, so writing a shell script to call the saxon command-line for each file is out of the question.
If there are no built-in command-line options, I may just write my own quick java class.
The capability to produce multiple output files from a single query is not present in the XQuery language (only in XSLT), and the capability to process a batch of input files is not present in Saxon's XQuery command line (only in the XSLT command line).
You could call a single-document query repeatedly from Ant, XProc, or xmlsh (or of course from Java), or you could write the code in XSLT instead.

Resources