Author |
Message |
Inventor
Stream Operator
Joined: Oct 13, 2007 Posts: 6221 Location: near Austin, Tx, USA
Audio files: 267
|
Posted: Thu Mar 20, 2008 10:57 am Post subject:
Music Newbie with Soft Modular Synth Seeks Advice Subject description: How shall I expand and use my new program, Synth Lab? |
|
|
Perhaps this post belongs in the soft synth forum but I posted there and there seems to be very little traffic. Maybe we can make a link? Anyway, I am a music novice and I just learned about modular synthesizers by reading in this forum. Now I'm hooked!
I was so exited about modular synthesisizers that I wanted to write a soft synth in the ChucK programming language that I have been learning for the past six months. After about a week of steady compulsive programming I now have a fairly stable application that seems to work pretty well and makes great sounds. Here is a photo of the user interface for Synth Lab:
I am posting about it here because I would like to get your opinion of the program and how I should expand it and make use of it. I want it to be as close to a physical modular synth as possible, so I designed it with a standard slot width for each instrument (adjustable) and I put in most of the synth-like objects that are available in the ChucK programming language. Here are the details of the program:
All instruments are connected with node-number sliders because the GUI I'm using has only buttons, sliders, and LEDs at the moment. It works pretty well and there have been commercial synthesizers that use a similar technique.
Main window with record button, volume slider , self-destruct button (closes the application), Microphone in and stereo out, plus copyright and thank-you message.
Oscillator window with SinOsc, SqrOsc, PulseOsc, TriOsc, SawOsc, and Phasor oscillators. These accept an input signal and a slider selects frequency modulation, phase modulation, or fm synth.
Two types of gain blocks with gain boost of x1, x10, x100, x1000, and x10000 (required when driving a frequency input variable), plus an operating mode slider that sets the inputs for either of add, subtract, multiply or divide.
A filter bank with LPF, BPF, HPF, BRF, and ResonZ filters. You can set the gain, frequency, and Q of the filters with sliders, plus I just coded up a WahWah input node slider and related software.
A bank of N-bit binary counters with frequency slider for notes per second which sets the frequency of the LSB, and an up/down selector input that also sets the gain. They have a node-number slider for each bit so you can access all the digits. Each counter also has a button that selects operation of 0V to 1V or -1V to 1V as desired. To accommodate retrograde sequences you can use two counters, one to count and the other to drive the up/down/gain input from one of its bits.
A delay bank with three types of delay lines.
A reverb bank with three types of reverb and variable .mix(0-1) setting.
And finally, a Misc. window with Noise source, pitch shifter, half/full wave rectifier(s), and zero crossing detector(s).
Since it is a software synth I was able to make a button at the top of each slot that cycles through the various types of objects available. For example, the six types of oscillators are available in any one of the oscillator slots by clicking on the name of the oscillator. It cycles through the different choices as you click on it.
Also I coded carefully to allow users to specify the number of each object that they would like to have appear. If you only want one oscillator, then you change the number of oscillators at the very tip-top of the program text file to one. If you want 15 nodes, then you change that. The windows all size themselves accordingly. You can also adjust the slot width down to squeeze more objects on the screen or up to get better slider sensitivity. I might extend the GUI to have a start-up screen where you can specify these numbers with sliders instead of editing the code, or I may not.
That's a fairly exhaustive description of it, it's freeware so anyone can use it, though at the moment it only works on Macs. The folks at Princeton are currently porting the GUI tools to PC and Linux, so everyone can use it soon.
My questions are: What would you add to this synth to make it more complete or more functional? What are some good things to try creating with the synth as it is? Where on this forum can I see some example patch diagrams and posts about them, so I don't try to reinvent the wheel (again). Do you have any general advice about working with such a tool? And finally, what is your reaction to this program?
I know there's lots more way better soft synths (and freeware) out there such as NMG2, but I wanted to code it up in ChucK because that way I can modify it to suit my own needs or the needs of others. For example, I am thinking of learning guitar, and what would be better than to plug your guitar into a custom soft synth to do all sorts of things with the sound?
Well, I've rambled on enough about this, as you can tell I am rather excited about it. Comments? Suggestions?
Inventor
p.s. my favorite part of Synth Lab is the self-destruct button! (suspicious grin) |
|
Back to top
|
|
|
cebec
Joined: Apr 19, 2004 Posts: 1098 Location: Virginia
Audio files: 3
G2 patch files: 31
|
Posted: Thu Mar 20, 2008 11:53 am Post subject:
|
|
|
I think you're to be commended for such an ambitious undertaking and a rather elegant execution! I look forward to trying this out.
The only things I can think of to add, which a similar soft modular called VAZ Modular includes, are sample playback modules and the like. |
|
Back to top
|
|
|
Inventor
Stream Operator
Joined: Oct 13, 2007 Posts: 6221 Location: near Austin, Tx, USA
Audio files: 267
|
Posted: Sun Mar 23, 2008 1:20 am Post subject:
|
|
|
Thanks cebec, I appreciate the compliment - such kind words motivate me to keep at it and do more cool music stuff for everyone to enjoy.
I checked out the sample playback capabilities of ChucK and I hope to add some panels for that soon. I'm still reading up on it and figuring out how to incorporate ChucK's features into Synth Lab. For now I have added a playback button that plays back whatever you recorded with the record button.
I have added some features including a system clock, a SinOsc-based keyboard user input, envelope generators, logic gates, dynos (they do limiter, compressor, expander, and noise gate), and echos. I also added that initialization screen that lets you specify how many (if any) of each item you want. For fun I added some wacky noises that play when you press the copyright or credits buttons, plus I made a Phasor to VCO sound for when you press the self destruct button - it's my toy so why not have a little fun with it? There are also some bug fixes and general code cleanup improvements.
I have been experimenting with making geometric structures from the Synth Lab objects, such as a ring of filters, ring of oscillators, and combinations of those. So far I get some pretty good sounds but nothing to write home about. Well, I'm having fun with it and that makes the effort worthwhile. |
|
Back to top
|
|
|
Uncle Krunkus
Moderator
Joined: Jul 11, 2005 Posts: 4761 Location: Sydney, Australia
Audio files: 52
G2 patch files: 1
|
Posted: Sun Mar 23, 2008 1:58 am Post subject:
|
|
|
I agree with Cebec in that the project itself and the thoroughness of your execution are already very much above and beyond the call of duty. I know from the little bit of programming I've done that a project like this takes a lot of effort and time.
As far as re-inventing the wheel goes, I personally think it is way underrated. The wheel has already been re-invented many times, and these "re-inventions" have spawned new solutions to problems which were not even related to rotation!
One thing I'd like to see, which is actually heaps easier to implement in software than it is in hardware, has been proven to be a very handy patching tool, and seems to fit with the "buttons, sliders and LEDs" constraints which you are already familiar with, is a patch matrix. Square of buttons, X rows by Y columns, inputs v/s outputs, click on a button to make a connection. Actually, in software, you get the ability to make the buttons multifunctional. ie: - One click, button turns green, standard connection. Two clicks, button turns yellow, inverted connection. Three clicks, button turns blue, connects to this and the other blue nodes. Four clicks, etc. etc. Just an idea.
Keep up the good work!
BTW, definitely need a PC version! _________________ What makes a space ours, is what we put there, and what we do there. |
|
Back to top
|
|
|
Inventor
Stream Operator
Joined: Oct 13, 2007 Posts: 6221 Location: near Austin, Tx, USA
Audio files: 267
|
Posted: Sun Mar 23, 2008 4:44 am Post subject:
|
|
|
Thanks to you too, Uncle Krunkus. I agree with your thought on reinventing, despite my prior comment. I've done plenty of it myself, hence the nickname. Funny you should mention arrays, my previous program Guitar Lab was based on an array, as shown in the image below.
Each mouse click on a square cycles it through logic 1, logic 0, random, and don't care values (only a few logic 1's are shown in the image). It's a Boolean Sequencer which enables you to make complex note sequences with just a few mouse clicks.
Funny you should mention a patch matrix, Kassen suggested a gain matrix as well. Also ChucK has FFT and IFFT capabilities, so it would be possible to make 1D and 2D arrays that perform non-realizable filter functions or construct arbitrary waveforms. Although it is possible to have a big array with multifunction buttons, it is burdensome on the CPU because each button needs a monitoring process to watch over it. But small or medium arrays are OK, or a big array where each button has only two functions is also realistic since toggle buttons are available.
I'll give this some more thought and code up some of the suggestions (or all of them!) as time and motivation permit. I appreciate your comments, thanks again. |
|
Back to top
|
|
|
Kassen
Janitor
Joined: Jul 06, 2004 Posts: 7678 Location: The Hague, NL
G2 patch files: 3
|
Posted: Sun Mar 23, 2008 5:35 am Post subject:
|
|
|
Inventor wrote: | Although it is possible to have a big array with multifunction buttons, it is burdensome on the CPU because each button needs a monitoring process to watch over it. |
Really? Aren't those just shreds waiting for events? Those shouldn't cost any cpu, I'd think? Maybe we could abstract a entire GUI window to a single device and wait for that like this;
Code: |
while(1)
{
my_gui => now;
while(my_gui.more() )
{
//etc like with the HID
}
} |
...or shreds waiting for one of a set of events (this is somewhere on The List, I think?)... This doesn't sound right to me but thanks to this cross-platform library issues that's keeping the graphics from my OS's I can't look at it in any depth. _________________ Kassen |
|
Back to top
|
|
|
Inventor
Stream Operator
Joined: Oct 13, 2007 Posts: 6221 Location: near Austin, Tx, USA
Audio files: 267
|
|
Back to top
|
|
|
Kassen
Janitor
Joined: Jul 06, 2004 Posts: 7678 Location: The Hague, NL
G2 patch files: 3
|
Posted: Sun Mar 23, 2008 10:01 am Post subject:
|
|
|
Inventor wrote: | It has about 250 shreds. For this matrix the program would need 400 shreds to watch all the buttons.
|
Oops, you are right.
Check this;
Code: |
fun void foo()
{
Event bar;
bar => now;
}
for (0 => int i; i < 1000; i++)
{
spork ~foo();
ms => now;
}
Event never;
never => now; |
Does nothing at all after the first second yet it eats cpu and quite a bit of memory. Weird. _________________ Kassen |
|
Back to top
|
|
|
Inventor
Stream Operator
Joined: Oct 13, 2007 Posts: 6221 Location: near Austin, Tx, USA
Audio files: 267
|
Posted: Sun Mar 23, 2008 7:52 pm Post subject:
|
|
|
For anyone who doesn't know ChucK, that code in the previous post from Kassen creates 1,000 child processes that do nothing, so they are minimally CPU intensive, yet that many of them bogs the system down. Thanks for doing the example, Kassen.
I also have some shreds that run at system clock frequency and I'm finding that I must set the clock to 100 Hz - 1000 Hz or my 3 year old 1.25 GHz Mac will slow down. This is a bit of an issue in Synth Lab since the system clock is in the audible range and I have found that sometimes I get unwanted buzzing in my sounds at guess what frequency? System clock frequency. The problem happens in the logic gates and possibly other places. To minimize the problem for now I recommend creating non-cascaded logic structures.
For example, I made a creative ripple-logic structure attached to the counter outputs and it buzzed noticeably in the attached sample recording. Probably on a modern computer, with all other applications closed, one could increase the system clock to the point where this effect was unheard, as is done on hardware synths. Perhaps I can recode the logic shred so that it iterates over the calculations, allowing signals to propagate through the layers of logic.
Description: |
13 second song with ripple-logic that creates undesired buzzing in the audio output. |
|
Download |
Filename: |
Synth_Lab_Ripple_Logic.mp3 |
Filesize: |
195.1 KB |
Downloaded: |
1334 Time(s) |
|
|
Back to top
|
|
|
Inventor
Stream Operator
Joined: Oct 13, 2007 Posts: 6221 Location: near Austin, Tx, USA
Audio files: 267
|
Posted: Sun Mar 23, 2008 8:05 pm Post subject:
|
|
|
I made the change described in the previous post and it worked. No more buzzing from the logic gates! |
|
Back to top
|
|
|
Kassen
Janitor
Joined: Jul 06, 2004 Posts: 7678 Location: The Hague, NL
G2 patch files: 3
|
Posted: Mon Mar 24, 2008 10:35 am Post subject:
|
|
|
Inventor wrote: | For anyone who doesn't know ChucK, that code in the previous post from Kassen creates 1,000 child processes that do nothing, so they are minimally CPU intensive, yet that many of them bogs the system down. |
Yes, sorry about that. When I posted this example I was very bussy, I had a friend over and several topics were going on at once, I wrote the example in a lost moment to kill some time. Your explanation is 100% correct and really should've been my explanation.
On to business; I think this is a potential issue. I don't understand where this high CPU usage per (dormant) shred comes from. I feel this should either go down (in time... once somebody has time for optimization....) or I would advocate thinking about abstracting a larger GUI to a single event because matrixes are really quite useful. Maybe we should open a dialogue about this with the dev's? _________________ Kassen |
|
Back to top
|
|
|
Inventor
Stream Operator
Joined: Oct 13, 2007 Posts: 6221 Location: near Austin, Tx, USA
Audio files: 267
|
Posted: Tue Mar 25, 2008 10:23 am Post subject:
|
|
|
If anyone reading here with a Mac would like to run Synth Lab, you can get it from the web page that I just created for it, which is here:
http://www.freedomodds.com/music/synth_lab.html
There you will find the source code and a link to the ChucK miniAudicle that Synth Lab runs on, plus a text introduction to installing and using Synth Lab.
If you like Synth Lab, you might also want to try Guitar Lab, which is another music program that I wrote. Guitar Lab has three guitar models, some drums, a flute and some miscellaneous stuff like rain and thunder sounds. It is based on a Boolean sequencer that enables you to make complex sequences with just a few mouse clicks. The web page for Guitar Lab is here:
http://www.freedomodds.com/music/guitar_lab.html
Getting back on-topic, I have a question about hardware modular synths. How is a piano-style keyboard interfaced with the synth? I put a keyboard in Synth Lab that receives keystrokes from the computer keyboard and plays envelope-softened sinusoids at different frequencies depending on which key you press. Is that close to how it's done? Or is there some other thing going on like control voltages or analog switches for routing signals generated by the synth? |
|
Back to top
|
|
|
|