Git Product home page Git Product logo

Comments (7)

digego avatar digego commented on August 15, 2024

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.

digego avatar digego commented on August 15, 2024

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.

bradrn avatar bradrn commented on August 15, 2024

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.

digego avatar digego commented on August 15, 2024

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.

bradrn avatar bradrn commented on August 15, 2024

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.

digego avatar digego commented on August 15, 2024

from extempore.

bradrn avatar bradrn commented on August 15, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.