Comments (7)
You can run as many instrument per dsp function as you like - at least as many as your cpu will support. So, for example, change dsp1 from:
(set! out (syn1 in time chan dat))
to
(set! out (+ (syn1 in time chan dat) (mysynth in time chan dat)))
you can make this change on-the-fly no problem. then when you need another instrument on-the-fly add it to dsp2 then 3 then 4 then 5 then back to 1 etc.. i.e. balance is the key. Now also important to point out is that not all instruments use the same compute power - you will be able to run about 5-10 samplers for the cost of 1 analogue synth. Getting that balance right will require a bit of trial and error.
So while you can't "add" more dsp functions, you can recompile the ones that are there, which is all you need to add more instruments on-the-fly.
A little more information. dspmt is specifically for multi-threaded execution - and it is for that reason that there are multiple dsp functions. Single threaded behaviour only requires 1 dsp function - and no aggregator. That's what happens when you call (dsp:set! dsp) - it takes only a single dsp function that does everything. You could easily implement your "dsp-all-instruments" that way - but only running on 1 cpu core.
In order to maximize performance on multi-core systems dspmt supports multiple dsp functions to distribute the load - but yes, you have to decide on the number of "cores" you want to use at the start of your session. In an idealized sense there would be 1 dsp function per hyperthread saving 1 for the dspmt aggregate summation function. So on my 12core AMD I might choose to run dsp(1-23) + dspmt.
five really was just a number picked out of a hat for the standardsystem. Something that I thought would probably run ok on a 2 core 4 HT cpu (i.e. low end), but provide enough dsp "cores" to allow for people to expand with their own instruments.
Also worth pointing out that if you want to run more dsp functions than you need just make sure the body of the dsp simple returns 0.0 (i.e. does not work). Then you can use it later in the session if you need it.
Cheers,
Andrew.
from extempore.
sorry second last line should say: (i.e. does no work). In other words all your dsp function "cores" need to be valid at startup, but they can be configured to do very little work by simply returning 0.0 (silence)
from extempore.
Thanks for the quick and helpful response @digego! I didn’t realise that I could recompile the dsp
functions already there — I thought I had to have one function per instrument when using dsp:set!
with multiple arguments. (Maybe it’s worth documenting that somewhere.)
from extempore.
no worries, you can also recomplile dspmt whenever you like - you just can't call (dsp:set! ...) more than once in a session.
from extempore.
you can also recomplile dspmt whenever you like
I did realise this actually — you’ll see in my first post that I mentioned recompiling dspmt as part of my attempted solution. My issue was that I thought I could only add another instrument by calling dsp:set!
more than once, which I can’t do.
Also, do you think it’s worth documenting how to use dsp:set!
somewhere? The reference only mentions how to do it with one argument, but the sharedsystem code uses multiple arguments, which don’t seem to be documented anywhere. And if there were some documentation, then maybe it would avoid any more misunderstandings like this.
from extempore.
from extempore.
No doubt - pull requests welcome :)
I’d happily make one, but I’m not at all familiar with the syntax of dsp:set!
(which was the cause of this issue). I know that (dsp:set! fn)
sets the DSP function to fn
, and I now know that (dsp:set! #f dspmt f g ...)
runs f
, g
, … on separate “cores” and then combines the results with dspmt
, but I’m not sure if there’s any other way to use it, or even if my descriptions above are at all correct.
from extempore.
Related Issues (20)
- Callback (Scheme) misbehaves with non-top-level closures HOT 5
- ubuntu LLVM errors on knight's landing (maybe AVX512?) HOT 6
- Switch from CMake's ExternalProject to git submodules HOT 16
- Pattern language synchronisation HOT 1
- Oddness in the test suite HOT 5
- Build glitch: files built, but not present in required directory HOT 4
- Mismatching MD5 for patched LLVM tarball HOT 8
- scale function? HOT 4
- audio not working on macOS 11 (Big Sur) HOT 2
- "sprintf %f" returns "f" for double instead of value HOT 4
- gui example crashing on gui_init HOT 5
- pc:make-chord-fixed can't take symbols HOT 2
- Audio Underflow on loading "examples/sharedsystem/audiosetup.xtm" HOT 5
- unable to build on gnu/linux with portaudio jack backend HOT 6
- Trying to play a buffer on Windows 10 plain terminates extermpore HOT 1
- Question: dsp swap with longer cross-fade? HOT 3
- Record and replay a coding session HOT 3
- cmake error: llvm tar download 404s HOT 4
- use extempore in a browser (web audio module wasm)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from extempore.