XML file format (but with 99% of the action of interest in a domain-specific language on the
CsInstruments
and CsScore
elements) that can be played and the reference implementation. Offers complex effects out-of-box apparently.Allows you to easily define instruments with seemingly arbitrary mathematical functions, and then use them to play notes at given time intervals.
The instrument functions can be parametrized, and each note played can have different parameters.
The instrument definition actually defines a block diagram graph, much like a hardware synthesizer would.
Csound is so not-bloated that it contains an UI system. And it includes an interactive virtual MIDI keyboard that interacts with parameter knobs: www.csounds.com/manual/html/MidiTop.html
But hey, it's fun. And like any other good domain-specific language, debugging it is barbaric of course.
If only it had been written in Python... the array manipulation boilerplate would be likely perfect for NumPy, and this would have been exactly what Ciro Santilli wanted!
CSound states that one of its design goals is backward compatibility, and it shows. Some of the stuff is utterly arcane, e.g. you have to remember what
GEN10
, GEN11
, etc. mean instead of having named enums.It just worked on Ubuntu 20.04 no questions asked:which runs this file: github.com/csound/csound/blob/92409ecce053d707360a5794f5f4f6bf5ebf5d24/examples/xanadu.csd and this plays a relly cool sound demo:
sudo apt install csound
git clone https://github.com/csound/csound
cd csound
git checkout 92409ecce053d707360a5794f5f4f6bf5ebf5d24
csound examples/xanadu.csd
Save to file instead of playing:or direct ogg output:or pipe to stdout to FFmpeg TODO: stackoverflow.com/questions/64970503/how-to-pipe-csound-output-to-ffmpeg-for-conversion-without-an-intermediate-file
csound -o xanadu.wav xanadu.csd
csound --ogg -o xanadu.ogg xanadu.csd
TODO find the most amazing set of songs made with it on GitHub? Some examples:
- www.csounds.com/toots/index.html has a good 101 on instrument design
- Csound FLOSS manual
- iainmccurdy.org/csound.html about 100 CC BY-SA examples. Each is a minimal study showing a specific technique, not a full composition, some seem advanced. Dude's a beast.
- github.com/csound/csound/tree/f2e70825fb543a6b15011c6984371f61ab2a00dd/tests/soak in-tree minimal examples
- github.com/csound/manual/tree/4049b286493d972ff7248b5596e47e7ae97a0cf9/examples contains the examples for the manual which is rendered at: It's insane, but it's fun! Ah those newbs who separate manuals from main tree.
- linuxsynths.com/CsoundPatchesDemos/csound.html on LinuxSynths
- github.com/csound/examples/tree/ae578159328178142c1055c7f78e28b42eb29774/csd as a few dozen examples
- freaknet.org/martin/audio/csound/ 10 pieces with source
Documentation-wise, it's a bit lacking. The only dude who can explain it really well, Dr Richard Boulanger, made the "The Csound Book" closed source, so, congrats, this will forever hurt the popularity of Csound.
Examples:
- csound/sine.csd
- csound/amplitude_frequency.csd
- csound/linen.csd: simple attack/release envelope, documented at: www.csounds.com/manual/html/linen.html
- csound/chorus.csd: chorus effect
- csound/bend.csd: bend using
linseg
- csound/vibrato.csd
- csound/crossfade_generators.csd
- csound/table.csd
- csound/virtual_keyboard.csd
Things that are not nice such as:
- Taboola, Outbrain, and other chumbox
- BLOBs
- Europe cookie law
- adhesive inside mobile phones and more generally, planned obsolescence
- Jupyter Notebook
- typographical characters that look like ASCII ones, but are not the ASCII ones, e.g. typographical quotes, em-dash. The non-breaking hyphen is not even whitespace, and by def Why not stick to ASCII when ASCII is good enough?
- excessive encapsulation
- replacement of master and slave terminology from technology
- mailing lists. And to add insult to injury, HTML on mailing list messages instead of plaintext.
- blank lines in code added by people trying to increase clarity, especially when there is already indentation for that. Every blank line must be preceded by a line comment explaining what the following block is about, or removed.
- messaging software that force you to have a mobile phone
- advertisements by telephone/SMS
- "state" such as global variables and object members, long live functional programming?
- mosquitoes, the only intrinsically bad thing about tropical countries
- projects with slow compilation times
- Microsoft Windows
- the 2019 Chinese government
- e-learning websites that only allows verified teachers to write content. Cowards who can't handle ranking algorithms.
- domain-specific language
- a build system without an out-of-tree option
- non-linear Git history: stackoverflow.com/questions/20348629/what-are-advantages-of-keeping-linear-history-in-git
- visual programming languages like Scratch. Waste of time. Text programming languages are already equally as visual due to indentation:Just make good serious gamedev libraries and integrated development environments for those real languages instead.
if x == 0: x = 1
- software that prevents you from running as root. Let me fucking shoot myself in the foot if I want to. It is better than having to deal with your hand holding bullshit, which is done in a different way for every project. E.g.: stackoverflow.com/questions/17466017/how-to-solve-you-must-not-be-root-to-run-crosstool-ng-when-using-ct-ng/53099177#53099177
- Medium
- luxury goods
- euphemism
- closed access academic journals are evil
- websites without OAuth
- shower room without a window to the exterior (mould!!!)
- single programs with their interface split across multiple windows, e.g. GIMP, ZynAddSubFX
- graphical user interfaces
- logograms
- infinitesimals. Just use limit instead, please
- country
- knowledge olympiads
- programming languages without a decent dominating package system
- closed source offline software used by millions
- exams
- security through obscurities
- dots in Gmail address
- things in websites that look like links, and behave like links, but don't let you middle click to open them on a separate tab
- K-pop
- numerical computing language
- fiscal paradises
- when the front-end of an website changes an important permanent state, but the URL does not change
- splash screens: you should show boot messages so that people will know what to Google for when things fail. Do you think computer newbies will be afraid and have nightmares?
- milk chocolate: why would you eat that instead of dark chocolate if you are older than 10?
- to talk about something without giving the real name to not scare off the audience
- mathematical symbol that looks like a Greek letter but isn't. Or perhaps mathematical notation in general
- when more than two people gather to play a board game or video game, and two or more people start chatting on and on about random subjects rather than concentrating on the game
- watching television while eating. Same for reading, or doing basically anything else but eat. The only acceptable activity is talking relaxedly, not about work.
- noises coming out of your bicycle. It is so hard to find where they come to fix them!!!
- code drop
- private cars as opposed to public transport. As a cyclist, you can just see the effect that large roads have on nearby areas, it just destroys nature.
- closed standards
- double consonants that make no difference to sound. Dilema? Dilemma? Dillema? Dillemma? Please!
- social media websites that show stuff from people you don't follow when you don't explicitly want that, including things which are not ads, just random suggestions. Twitter starting being like that cirac a 2022. Facebook got worse around that time. It is a constant fight against those stupid websites.
- socks with short legs that don't protect your ankle/lower calf from cold/scratches/dirt, e.g. liner socks
- Presta valves. Why would such a flimsy tech have become so popular compared to the infinitely superior Schrader!
One big advantage over FreeFem is that it uses plain old Python to describe the problems instead of a domain-specific language. Matplotlib is used for plotting by default, so we get full Python power out of the box!
Also uses variational formulation of a partial differential equation like FreeFem which is a pain.
One downside is that its documentation is a Springer published PDF link.springer.com/content/pdf/10.1007%2F978-3-319-52462-7.pdf which is several years out-of-date (tested with FEnics 2016.2. Newbs. This causes problems e.g.: stackoverflow.com/questions/53730427/fenics-did-not-show-figure-nameerror-name-interactive-is-not-defined/57390687#57390687
system of partial differential equations are mentioned at: link.springer.com/content/pdf/10.1007%2F978-3-319-52462-7.pdf 3.5 "A system of advection–diffusion–reaction equations". You don't need to manually iterate between the equations.
On Ubuntu 20.04 as per fenicsproject.org/download/Before 2020-06, it was failing with:but they seem to have created the Ubuntu 20.04 package as of 2020-06, so it now worked! askubuntu.com/questions/866901/what-can-i-do-if-a-repository-ppa-does-not-have-a-release-file
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:fenics-packages/fenics
sudo apt-get update
sudo apt-get install --no-install-recommends fenics
sudo apt install fenics
python3 -m pip install -u matplotlib
E: The repository 'http://ppa.launchpad.net/fenics-packages/fenics/ubuntu focal Release' does not have a Release file.
TODO heat equation hello world.
Filter graphs are a thing of great beauty. What an amazingly obscure domain-specific language, but which can produce striking results with very little!!!
A quick example from stackoverflow.com/questions/59551013/how-to-generate-stereo-sine-wave-using-ffmpeg-with-different-frequencies-for-eac/77730492#77730492 illustrates some of the fundamentals:
ffplay -autoexit -nodisp -f lavfi -i '
sine=frequency=500[a];
sine=frequency=1000[b];
[a][b]amerge, atrim=end=2
'
+--------+
[sine=frequency=500]--->[a]-->| |
| amerge |-->[atrim]-->[output]
[sine=frequency=1000]-->[b]-->| |
+--------+
So we see the following syntax patterns:
sine
,amerge
andatrim
are filterssine=frequency=500
: the first=
says "araguments follow"frequency=500
sets thefrequency
argument of thesine
filter- for multiple arguments the syntax is to separate arguments with colons e.g.
sine=frequency=500:duration=2
;
: separates statements[a]
,[b]
: sets the name of an edge,
: creates unnamed edge between filters that have one input and one output
A list of all filters can be obtained ith:and parameters for a single filter can be obtained with:Related question: stackoverflow.com/questions/69251087/in-ffmpeg-command-line-how-to-show-all-filter-settings-and-their-parameters-bef
ffmpeg -filters
ffmpeg --help filter=sine
TODO dump graph to ASCII art? trac.ffmpeg.org/wiki/FilteringGuide#Visualizingfilters mentions a
-dumpgraph
option, but haven't managed to use it yet.Bibliography:
- ffmpeg.org/ffmpeg-filters.html official documentation
- trac.ffmpeg.org/wiki/FilteringGuide some handy tips from the FFMpeg Wiki
Started in 1987 and written in Pascal, by the French from Pierre and Marie Curie University, the French are really strong in numerical analysis.
Ciro wasn't expecting it to be as old. Ported to C++ in 1992.
The fact that French wrote it can be seen in the documentation, for example doc.freefem.org/tutorials/index.html uses file extension
mycode.edp
instead of mycode.pde
where dep
stands for "Équation aux dérivées partielles".Besides the painful build, using FreeFem is relatively simple, as can be seen from the examples on the website.
They do use a domain-specific language on the examples, which appears to be the main/only interface, which is a bad thing, Ciro would rather have a Python API as the "main API", which is more the approach taken by the FEniCS Project, but so be it. This domain-specific language business means that you always stumble upon basic stuff you want to do but can't, and then you have to think about how to share data between the simulation and the plotting. The plotting notably is super complex and they can't implement all of what people want, upstream examples often offload that to gnuplot. This is potentially a big advantage of FEniCS Project.
It nice though that they do have some graphics out of the box, as that allows to quickly debug common problems.
Uses variational formulation of a partial differential equation, which is not immediately obvious to beginners? The introduction doc.freefem.org/tutorials/poisson.html gives an ultra quick example, but your are mostly on your own with that.
On Ubuntu 20.04, the
freefem
is a bit out-of-date (3.5.8, there isn't even a tag for that in the GitHub repo, and refs/tags/release_3_10 is from 2010!) and fails to run the examples from the website. It did work with the example package though, but the output does not have color, which makes me sad :-)sudo apt install freefem freefem-examples
freefem /usr/share/doc/freefem-examples/heat.pde
So let's just compile the latest v4.6 it from source, on Ubuntu 20.04:
sudo apt build-dep freefem
git clone https://github.com/FreeFem/FreeFem-sources
cd FreeFem-sources
# Post v4.6 with some fixes.
git checkout 3df0e2370d9752801ac744b11307b14e16743a44
# Won't apply automatically due to tab hell.
# https://superuser.com/questions/607410/how-to-copy-paste-tab-characters-via-the-clipboard-into-terminal-session-on-gnom
git apply <<'EOS'
diff --git a/3rdparty/ff-petsc/Makefile b/3rdparty/ff-petsc/Makefile
index dc62ab06..13cd3253 100644
--- a/3rdparty/ff-petsc/Makefile
+++ b/3rdparty/ff-petsc/Makefile
@@ -204,7 +204,7 @@ $(SRCDIR)/tag-make-real:$(SRCDIR)/tag-conf-real
$(SRCDIR)/tag-install-real :$(SRCDIR)/tag-make-real
cd $(SRCDIR) && $(MAKE) PETSC_DIR=$(PETSC_DIR) PETSC_ARCH=fr install
-test -x "`type -p otool`" && make changer
- cd $(SRCDIR) && $(MAKE) PETSC_DIR=$(PETSC_DIR) PETSC_ARCH=fr check
+ #cd $(SRCDIR) && $(MAKE) PETSC_DIR=$(PETSC_DIR) PETSC_ARCH=fr check
test -e $(DIR_INSTALL_REAL)/include/petsc.h
test -e $(DIR_INSTALL_REAL)/lib/petsc/conf/petscvariables
touch $@
@@ -293,7 +293,6 @@ $(SRCDIR)/tag-tar:$(PACKAGE)
-tar xzf $(PACKAGE)
patch -p1 < petsc-hpddm.patch
ifeq ($(WIN32DLLTARGET),)
- patch -p1 < petsc-metis.patch
endif
touch $@
$(PACKAGE):
EOS
autoreconf -i
./configure --enable-download --enable-optim --prefix="$(pwd)/../FreeFem-install"
./3rdparty/getall -a
cd 3rdparty/ff-petsc
make petsc-slepc
cd -
./reconfigure
make -j`nproc`
make install
cd ../FreeFem-install
PATH="${PATH}:$(pwd)/bin" ./bin/FreeFem++ ../FreeFem-sources/examples/tutorial/
Ciro's initial build experience was a bit painful, possibly because it was done on a relatively new Ubuntu 20.04 as of June 2020, but in the end it worked: github.com/FreeFem/FreeFem-sources/issues/141
The main/only dependency appears to be PETSc which is used by default, which is a good sign, as that library appears to automatically parallelize a single input to several backends (single CPU, MPI, GPU) so you know things will scale up as you reach simulations.
The problem is that it compiling such a complex dependency opens up much more room for hard to solve compilation errors, and takes a lot more time.
Tends to be Ciro Santilli's first attempt for quick and dirty graphing: github.com/cirosantilli/gnuplot-cheat.
domain-specific language. When it get the jobs done, it is in 3 lines and it feels great.
When it doesn't, you Google for an hours, and then you give up in frustration, and fall back to Matplotlib.
Couldn't handle exploration of large datasets though: Survey of open source interactive plotting software with a 10 million point scatter plot benchmark by Ciro Santilli
Music notation engine. domain-specific language input. The LaTeX of music.
They are evil because they produce closed source offline software used by millions: Microsoft Windows.
And also their monopolistic practices: United States v. Microsoft Corp.
So, as put in Video "Bill Gates vs Steve Jobs by Epic Rap Battles of History (2012)" by fake Steve Jobs to fake Bill Gates:
Why'd you name your company after your dick?
However, like all big tech companies with infinite money, they do end up doing some cool things in their research department, Microsoft Research, notably for Ciro Santilli being:
- Lean
- their quantum computing work. C is of course a bad idea, we don't need yet another domain-specific language, Python library based solutions like Qiskit are obviously the way to go
domain-specific language unfortunately, but at least it's on GitHub, looks promising.
How to play scores and save them to files is discussed at: doc.sccode.org/Guides/Non-Realtime-Synthesis.html
They have a nice looking IDE, but running anything from the command-line interface is super hard, much unlike Csound. How to get a decent hello world: stackoverflow.com/questions/65360414/how-to-play-a-supercollider-file-non-interactively-from-the-terminal-command-lin
Sample composition with custom synths + notes: sccode.org/1-5cl
leanpub.com/ScoringSound looks like a decent tutorial, it is basically the Csound FLOSS manual for SuperCollider.