freenode/#sicl - IRC Chatlog
Search
6:02:29
beach
I haven't done this calculation for some time, so please help me check it: Let's say I want to use mainly additive synthesis to synthesize a symphony orchestra. The sample rate is CD quality. Let's approximate that with 50kHz. So I have 20μs to compute 1 sample.
6:02:40
beach
Also, let's say that an instrument requires 100 simultaneous sine waves and that a single sample of a single sine wave requires 2 multiplications and 2 additions taking perhaps 10ns. That means a single instrument takes 1μs per sample, so I can generate 20 simultaneous instruments with a single core.
6:02:41
beach
Now if I have 8 cores or so, that should be plenty for an entire orchestra. Did I do this right?
6:04:18
beach
It is possible that some instruments require more than 100 simultaneous sine waves, but on the other hand, one should be able to inspect the total collection of sine waves and apply some psychoacoustic result and eliminate masked oscillators.
6:05:22
beach
So, if this calculation is correct, a single modern processor should be able to generate an entire orchestra.
6:05:48
no-defun-allowed
Although...that seems like a very uncommon and unusual approach for synthesis, from what I know about computer music.
6:07:17
no-defun-allowed
Sure, but from a practical/production point of view I've hardly used it, except for trivial cases of additive synthesis like electric organs.
6:08:38
no-defun-allowed
I have two physical (though digital) synthesisers: one is a "subtractive" synthesiser which produces two saw waves or square waves and filters (usually) high frequencies out, and the other is a sampler with a similar optional filter.
6:09:38
no-defun-allowed
Additionally, "frequency" (which is actually phase-) modulation is sometimes used, notably by synths like the DX7 and early sound cards like the SoundBlaster.
6:10:24
beach
Ah, I think we are talking different things here. My idea is to analyze existing instruments into something like a sum of percussion sounds and a bunch of sine waves. Then, it will be easy to modify those sounds with respect to duration, volume, pitch, etc.
6:10:31
no-defun-allowed
You are right in using it as a performance benchmark though, but I'm not sure about how applicable it is as a pitch for CLOSOS as a sound production operating system.
6:11:57
beach
Right now I am not thinking CLOSOS in particular. I am thinking about how an instrument such as the Kurtzweil that Jordan Rudess is using in his demos could be created.
6:12:29
beach
It probably used to be the case that it had to have a large number of dedicated signal processors.
6:16:46
beach
This video is more about composition and playing, but he has others that are specifically showing off how sound is created.
6:21:18
no-defun-allowed
The piano on my sampler interpolates between samples of the same pitch played with different dynamics. It does have the same utilities like layering and splitting, so I think it is a fairly normal "music workstation".
6:21:51
beach
Here is a more recent one, and it has more sound stuff: https://www.youtube.com/watch?v=HUErvWA5pYE
6:23:30
beach
"interpolating between samples" doesn't sound right in terms of psychoacoustics, but maybe the result is acceptable.
6:25:57
no-defun-allowed
Well, looking at the product page, there are specific engines for pianos, electric pianos, plucked strings and tonewheel organs, but sampling and analog-modelling synthesis are also provided.
6:27:47
no-defun-allowed
There's probably a significant amount of cleaning and preprocessing on the samples to allow sample blending to be possible, however. You can't create your own samples on my keyboard to my knowledge.
6:45:00
beach
As usual, I haven't looked into how things are done in products. I prefer to imagine how to do things if I were in charge. At least to begin with.
8:07:49
|3b|
ACTION wonders if orchestra would be better with FFT based rather than just adding sine waves
8:11:50
|3b|
question is whether you can build coefficients corresponding to current state of orchestra and do IFFT more efficiently than you can build and add a bunch of sine waves
8:13:03
|3b|
similarly to whether you can do a convolution faster than an FFT + per-element multiply + IFFT in image processing
8:20:46
beach
SIN can not be relied upon anyway. You get cancellation of significant digits after a while.
8:24:45
|3b|
'digital differential analyser', old signal processing (and 2d graphics) trick for calculating lots of sequential values of various equations (points on line/circle for graphics) efficiently
8:25:17
beach
Well, I know of two techniques for generating sine waves. I think they are called "resonators".
8:27:26
beach
The other technique is to use a rotating vector in the complex plane and multiply it by e^(i φ) in each iteration. That requires two multiplications and two additions.
8:38:24
beach
My previous calculation estimated 10ns to generate a sample. I think it can be shorter than that.
8:39:13
beach
Plus, I didn't take into account techniques for reducing the number of oscillators based on psychoacoustics.
8:39:49
|3b|
SIMD could probably give you 2x or 4x or reasonably easily (assuming the part that gives you access to simd stuff is already implemented, not sure about current state of that in cl)
8:41:13
beach
For a project like this, I am pretty sure the implementation maintainer(s) would make an effort to help out.
8:41:26
|3b|
ACTION has seen recent activity in that area (SIMD stuff in general) from SBCL, but not looked at details
8:45:22
no-defun-allowed
ACTION throws a (n unfortunately not real) space cadet in the general direction |3b|
8:46:56
pierpal
IIRC, the korg chronos, used in the videos, is made from an off the shelf Intel MB running linux
8:47:57
no-defun-allowed
yeah, most "hardware" synths are usually some embedded processor running some kind of rtos or linux with a decent dsp
8:48:30
no-defun-allowed
a chronos probably isn't handling anything else like networking or complex graphics/compositing while emitting sound though
8:55:56
|3b|
(integrated GPUs are better at latency than dedicated, since they share memory with host)
8:56:46
no-defun-allowed
yeah, it's mostly sampling with some specific synthesis for simpler waveforms like analog synths, electric pianos and organs
8:59:25
beach
I think someone should try a scaled-up experiment with additive synthesis using Common Lisp.
9:01:35
no-defun-allowed
with your resonator x(t+1) = k x(t) - x(t-1), k = cos (2 pi f/fx), is f the sample frequency and fx the desired sample rate?
9:01:50
|3b|
https://marcan.st/2016/06/hacking-and-upgrading-the-korg-kronos/ has some interesting info on the korg, separate arm CPU for IO, 1 core of atom for synth, 1 for effects, both in kernel modules