How to Combine Oscillators

#1

Hello everyone! I want to create synth sound presets from SP sound engine. I would like to combine two or more oscillators but in my code I listened only one. In addition I don’t hear any changes to sound’s parameters changing the filters. Here is an example:

define :twooscs do
use_synth :square,amp: 2,lpf: 120
use_synth :saw,amp: 1,lpf: 80,res: 70
end

live_loop :combine do
twoosc
play :e4
sleep 1
end

I would appreciate any help.
Thank you

Nikos

#2

Hi @Nikos,

the way you wrote your function, the second use_synth will just replace/overwrite the first one. One more problem: you can’t specify amp or lpf with the use_synth command, but with use_synth_defaults.

Try something like that (not very elegant but working):

define :twooscs do |n|
  use_synth :square
  use_synth_defaults amp: 2, lpf: 120
  play n
  use_synth :saw
  use_synth_defaults amp: 1, lpf: 80, res: 70
  play n
end

live_loop :combine do
  twooscs :e4
  sleep 1
end
2 Likes
#3

Thank you very much for your help @Martin!

This is what I wanted to do. Is it possible to recall this function from one buffer to another without the need of copy/paste the whole code?

#4

Just try it out :wink:

(It should. Once the function has been evaluated, it should be available in all buffer.)

1 Like
#5

Thanks again! :slightly_smiling_face:

#6

I have made some presets:

This is a combination of additive and subtractive synthesis, and you can get quite complex sounds.
I have been working on envelopes for other parameters, but the whole thing gets very CPU-demanding.

2 Likes
#7

Many thanks for your help @Davids-Fiddle! I really like your tutorials on your blog. I have learned a lot from your interesting ideas on SP. I hope that you continue your great work!

#8

@Nikos I’ve only been using Sonic Pi for a couple of months now but FWIW I posted up my attempt at creating (possibly over-engineering!) a way of combining and detuning multiple oscillators here.

Unfortunately, being fairly new to electronic music production in general, I was unaware but quickly realised just how complex sound design actually is (don’t even get me started on phasing issues :face_with_raised_eyebrow:). So, for me, I’ve instead headed down the path of using Sonic Pi to send Midi to a Synth VSTi where all of the smarts around dealing with multiple voices and phasing are built in.

But, having said that, I would sincerely love to hear from some of the veterans on their thoughts on the past, present and future of rich sound design in Sonic Pi :pray:

#9

Thanks @aen1gma for you code!

I also use external synths and VST’s . To me, programming in Sonic Pi, is a bit different approach for sound sound design. I have been using hardware synths like Waldorf Blofeld, Korg Minilogue or VST’s like Reaktor and Omnisphere. What I wanted to do with SP, in the terms of sound design, is to use only SP’s synth engine. It is great to create a complete live performance with just one programming language.

I am novice programmer, but so far, I have some fairly nice sound design results. Of course this is a work on progress!:slightly_smiling_face: Wavetable, or Granular synthesis can be achieved with good quality results. Also the tutorials inside SP’s documentation about Subtractive and Additive synthesis are quite enlightening.
I agree that it would be great to hear from experienced SP’s users about sound design techniques.

P.S sorry for my bad English! :slightly_smiling_face:

#10

Hi Nikos,

if you are willing to dive deeper, this document about synth design might be interesting. Also my very first attempt (and until now also the last :wink: ) to create a Rhodes-like sound as well as the discussion, which preceeded this attempt.

Cheers
Martin

#11

I don’t know how familiar everyone reading this thread may be with the components of Sonic Pi’s architecture, so pardon me if I’m repeating stuff you’re already aware of. Sonic Pi’s audio synthesis engine is SuperCollider, and Sonic Pi’s synths are essentially compiled SuperCollider synth definitions (SynthDefs). As Martin has alluded to, it is possible to build your own synths for Sonic Pi. This is one way to enable new sounds without the need to layer lots of sines/saws/tris in Sonic Pi code.

I personally have been very interested in the idea of making new synths and using them in Sonic Pi, as have others. I have plans for several that I’m going to try to build, and that I would love to have included in the built in collection of synths. Martin is right, if you are interested in exploring synth design, have a look at the links he mentions. Keep in mind that for that synth design document, for new synths we may be moving away from using Overtone as the design tool, and just using SuperCollider directly - so for new synths that make their way into Sonic Pi’s built in collection, they would need to be designed with SuperCollider as mentioned in Compiling your synths using SuperCollider.

(In addition to the links that Martin mentioned, there’s also a little discussion about synth design in this thread: Making New Synths from SuperCollider SynthDefs?).

1 Like
#12

Hi Ethan,

thanks for this more detailed information (more than my rather ‘frugal’ earlier entry :wink: ) I would like to complement and add that I find the additive approach within Sonic Pi very helpfull to learn the basics of synthesis or for didactic purposes in seminars.

It is probably less suitable for actual sound design. As far as I know decades ago it was the (very short lasting) hope of musicians/composers (such as Stockhausen) and later synthesizer manufacturers to create all sorts of sounds by additive synthesis - which is theoretically possible but practically much to complicated and even more, not feasable given the restraints of hardware power.

PS.: I think it is well invested time to explore the ‘knobs’ which can tweak the available synths within Sonic Pi such as here and here (search this forum e. g. for ‘synth’ and you will find other valuable contributions).

Ah, and here is another thread started by @enkerli about synth design with SuperCollider.

3 Likes
#13

Ahaha! We both thought to link to the same discussion at the end of our replies :rofl: :+1:

1 Like
#14

Oh, yes. But you were first :wink: :+1:

1 Like
#15

So potentially sound designers could provide synthdefs in the same way they provide VSTi’s/presets? Sounds promising

#16

@Nikos I agree, it would be amazing to be able provide a really rich live performance with nothing but single piece of open source software. Keen to hear what you come up with!

1 Like
#17

I consider Sonic Pi a musical instrument. I think that it could be great if there was a learning curve for all kinds of user levels. For me, as a double bass teacher, the importance of a solid technique is extremely high. Probably, the same applies in live coding. Of course SP is a work in progress (many many thanks to Mr. @samaaron!!! :grinning:) and many obstacles have to be overcome!