electro-music.com   Dedicated to experimental electro-acoustic
and electronic music
 
    Front Page  |  Articles  |  Radio
 |  Media  |  Forum  |  Wiki  |  Links  |  Store
Forum with support of Syndicator RSS
 FAQFAQ   CalendarCalendar   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   LinksLinks
 RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in  Chat RoomChat Room 
 Forum index » DIY Hardware and Software » ChucK programming language
Creating a synth bass sound
Post new topic   Reply to topic Moderators: Kassen
Page 1 of 1 [4 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
Author Message
Dr. Spankenstein



Joined: Mar 03, 2007
Posts: 136
Location: Cambridge
Audio files: 1

PostPosted: Mon Mar 26, 2007 2:18 pm    Post subject: Creating a synth bass sound Reply with quote  Mark this post and the followings unread

I'm experimenting with creating a bass synth sound combining various different oscillators and cant figure out how to combine 2 oscillators such as SinOsc and SawOsc and then change the gain in stereo.

Can anyone help as the code below is rubbish and is all I've come up with so far.... Embarassed

Code:

SinOsc Bass => Pan2 basspan => dac;
Bass => Gain Volume;
SawOsc Bass => dac;


Thanks[/list]
Back to top
View user's profile Send private message
kijjaz



Joined: Sep 20, 2004
Posts: 765
Location: bangkok, thailand
Audio files: 4

PostPosted: Mon Mar 26, 2007 4:35 pm    Post subject: Reply with quote  Mark this post and the followings unread

actually there are also many many instruments in the STK set that
you can use easily as a bass sound by choosing its 'presets'

I'll review myself on building some basic synth sound here also..
so i'll start with some examples i usually make to create a small patch
that'd be nice as a bass.

I'll be using these Ugens:
Oscillators: SinOsc PulseOsc SqrOsc TriOsc SawOsc
and surely Noise ...

Filter: LPF HPF BPF

and some simple enveloping.

maybe i'll try using the Dynamic compressor feature if possible
(i'm the new version's newbie ahah)

ok.. i'll start with a basic Sine Oscillator bass sound
Code:
SinOsc s1 => dac;
Std.mtof(36) => s1.freq;
second => now;

that sounds really basic.. but i'm loving it already hahhaa.
let's add an envelope to use as its amplitude envelope

Code:
SinOsc s1 => Envelope e1 => dac;
Std.mtof(36) => s1.freq;
e1.duration(4::ms);

e1.keyOn();
second => now;
e1.keyOff();
second => now;


to change the waveform, just change SinOsc to another type of oscillator.

now.. what i'd like to do with a bass sound is a nice warm Overdrive..
(you might not like it but it kills me)..
i'm gonna use a technic called 'Waveshaping Distortion'
it's done by passing the value on one signal into a mathematical function..
and the result of the function is the output.
for example.. transfer function f(x) = x^3 .. x is the input signal,
the result's gonna have the value x^3 for each sample.

the waveshaping function i love to use easily in chuck is..
Sine function.. and Triangle Wave function..
so it can be easily used by our original SinOsc and TriOsc.
These have interesting / warm overdrive sound.
and can be pushed to be very distorted by increasing the input gain also.

it can be done by chucking one signal into the Oscillator we want to use as a waveshaper..
and set the sync option of the oscillator to "phase modulation" (.sync = 1)
let's hear the above patch with SinOsc as the waveshaper.
and let's hear it fade out with a longer (500ms) release.

Code:
SinOsc s1 => Envelope e1 => SinOsc waveshaper1 => dac;
s1.gain(0.5);
Std.mtof(36) => s1.freq;

waveshaper1.sync(1);

e1.duration(4::ms);
e1.keyOn();
second => now;
e1.duration(500::ms);
e1.keyOff();
second => now;


You can try using a TriOsc instead of SinOsc at the waveshaper
it'd create a more crispy sound.
you can change the s1.gain to hear the different amount of distortion.
it can actually sound like FM synth also.

i'll let you hear when we can choose to mix the dry oscillator sound
with the overdrive sound..
because sometimes this kind of overdrive sound can love its warmth..
so i wanna choose to mix the original sound with the drive sound also.

Code:
SinOsc s1 => Envelope e1 => Gain drivegain1 => SinOsc waveshaper1 => dac;
drivegain1.gain(1.1);
e1 => Gain dry1 => dac;
Std.mtof(36) => s1.freq;
waveshaper1.sync(1);
waveshaper1.gain(0.2);
dry1.gain(0.8);

e1.duration(4::ms);
e1.keyOn();
second => now;
e1.duration(50::ms);
e1.keyOff();
second => now;


one another famous technic is the use of Frequency Modulation (FM)..
we'll let another oscillator modulating the Frequency of the main oscillator
that's by setting the main oscillator's sync option to FM (.sync = 2)

Code:
SinOsc smod1 => SinOsc s1 => Envelope e1 => dac;
smod1.gain(500);
s1.sync(2);
Std.mtof(36) => s1.freq;
s1.freq() * 3 => smod1.freq;
e1.duration(4::ms);

e1.keyOn();
second => now;
e1.keyOff();
second => now;


you can change the oscillator types.. to see the different effects you can do with the combinations of oscillators.
you can also change the freqency of smod1.freq to change the modulator's frequency.
you can use any integer: 1, 2, 3, 4, 5, ... etc.
to get the sound of the note the same.
or use 0.5, 1.5, 2.5, 3.5, etc. to hear the FM that makes the bass note sounds an octave lower.

i'll come back to share with you all more.
so sleepy now.
take care all. let's share soon.
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
Kassen
Janitor
Janitor


Joined: Jul 06, 2004
Posts: 7678
Location: The Hague, NL
G2 patch files: 3

PostPosted: Wed Mar 28, 2007 4:33 am    Post subject: Re: Creating a synth bass sound Reply with quote  Mark this post and the followings unread

Dr. Spankenstein wrote:
....and cant figure out how to combine 2 oscillators such as SinOsc and SawOsc and then change the gain in stereo.


Ok, fortuantely that's quite easy. Let's modify your code for a bit;

Code:

//this line is fine
SinOsc Bass => Pan2 basspan => dac;
//now watch what happens;
SawOsc Bass2 => basspan;



Now you see both oscs end up at the input of the pan. per default inputs like that are set to mix all their inputs so now the pan is also a mixer.

Using this;

0.5 => Bass.gain;

you can now set the volume of the first osc. if we'd like to get very clever we can then use this;

( 1 - Bass.gain() ) => Bass2.gain;

That way they'll add up to normal volume, of course you can also set them seperately if you like that better.

basspan.gain now acts as you final volume; That's the volume after the two oscs got mixed.

Likely you'll now want to use a envelope inbetween the oscilators and the pan. That's quite easy as well. If you want to keep it clear where and how you are mixing signals you can always define a seperate Gain and name it "mixer"and chuck all signals that need to be mixed to that.

Of course it gets even more fun if you combine mixing with some of Kijjaz's ideas!

_________________
Kassen
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Dr. Spankenstein



Joined: Mar 03, 2007
Posts: 136
Location: Cambridge
Audio files: 1

PostPosted: Wed Mar 28, 2007 2:08 pm    Post subject: Reply with quote  Mark this post and the followings unread

Thanks for the info guys, this is definitely putting me on the right track!

One question though...

Is this a sensible way to change an instrument during a track?

Code:

// INSTRUMENT 1
SinOsc Bass => Gain DriveGain => SinOsc BassWaveShaper => Pan2 BassPan => dac;

// INSTRUMENT 2
TriOsc Bass2 => DriveGain => SinOsc Bass2WaveShaper => BassPan;

DriveGain.gain(1.3);

BassWaveShaper.sync(1);
Bass2WaveShaper.sync(1);

1.0 => Bass1.gain;
1.0 => Bass1WaveShaper.gain;

0.0 => Bass2.gain;
0.0 => Bass2WaveShaper.gain;

second => now;

0.0 => Bass1.gain;
0.0 => Bass1WaveShaper.gain;

1.0 => Bass2.gain;
1.0 => Bass2WaveShaper.gain;

second => now;




...or is there a better way to change the main Oscillator and sound of the instrument when the code is running?

Thanks
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic Moderators: Kassen
Page 1 of 1 [4 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
 Forum index » DIY Hardware and Software » ChucK programming language
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum
e-m mkii

Please support our site. If you click through and buy from
our affiliate partners, we earn a small commission.


Forum with support of Syndicator RSS
Powered by phpBB © 2001, 2005 phpBB Group
Copyright © 2003 through 2009 by electro-music.com - Conditions Of Use