Making music with clang

Hello,

we all know that clang can compile C++ code. But using the power of constexpr it can also create
sounds, even music: <constexpr で音階生成&シンセサイザー&音声合成 - ボレロ村上 - ENiyGmaA Code; (Japanese)

Not knowing Japanese myself I had to resort to Microsoft's translator to understand the description
in the blog post: At compile-time, constexpr is used to generate a huge array (44100 elements for a
single second of sound) with the sound's waveform. The generated application then simply writes
this array into a .wav file (which are included in the blog post via Youtube).

It takes time though: Depending on the sound/music being generated, compiling (i.e. executing
the meta-program that generates the waveform) takes between a few minutes and several hours.
But it's still an interesting exploration of constexpr's possibilities.

Jonathan

Thanks for reporting this, it's very interesting to see what people
are doing with constexpr. I find it particularly interesting that GCC
couldn't cope with this code because its memoization used up too much
memory (although it looks like Clang had some trouble with memory
usage too, on some of the later examples).

If nothing else, this provides us with a set of interesting testcases
for any constexpr optimization work. I'm also curious whether
globalopt would have been able to reduce the initialization down to
constant if we removed the 'constexpr' keywords!