Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (107)
games submitted by our members
Games in WIP (535)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Software Synth in the make  (Read 3329 times)
0 Members and 1 Guest are viewing this topic.
Offline erikd

JGO Ninja


Medals: 16
Projects: 4
Exp: 14 years


Maximumisness


« Posted 2004-04-25 17:07:11 »

Hi all,

I'm creating a library for real time sound synthesis. It can help keeping your distribution size down and you will be able to alter everything at real time so you can create sound effects just like in the old days :-)

Currently it supports the following features:
- Tone generator capable of playing sinus, sawtooth, triangle and square waves or user wave tables.Supports pulse width modulation.
- White noise generator
- Low pass filter with resonance.
- Envelope generator (with attack, decay, sustain, release).
- Mixer with unlimited inputs.
- Amplifier/Attenuator
- Panning
- Internal processing using floats for huge signal-noise ratio and head room.
- Sample recorder for creating samples from your generated sounds.
- Modular design: you can patch everything any way you want.
- Play back using javax.sound.
- Easy to understand API.

I'm planning to create more modules such as LFO, Ring Modulator, FM, HPF, BPF etc. and some effects like chorus, phaser, reverb and such. Maybe I could even add some sort of sequencer.
OpenAL using LWJGL will also be supported (JOAL support will probably just be trivial to add as well).
Maybe I'll also add some sort of import of patches using XML.
Well, anything I can think of I feel like adding will be there ;-)

It's not finished although all currently supported features do work. If anybody wants to give it a go, just mail me and I'll send it to you.

Erik

Offline erikd

JGO Ninja


Medals: 16
Projects: 4
Exp: 14 years


Maximumisness


« Reply #1 - Posted 2004-04-25 18:53:22 »

Update: added ring modulator  Smiley

Offline oNyx

JGO Coder


Medals: 1


pixels! :x


« Reply #2 - Posted 2004-04-25 19:01:19 »

Sounds great Smiley

I guess there are alot of people, searching something better than midi and smaller than ogg. I would really like taking a look in 2-3 weeks or so... right now I'm a bit stressed to death Wink

弾幕 ☆ @mahonnaiseblog
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline princec

JGO Kernel


Medals: 343
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #3 - Posted 2004-04-25 20:37:40 »

Hurrah!

Cas Smiley

Offline erikd

JGO Ninja


Medals: 16
Projects: 4
Exp: 14 years


Maximumisness


« Reply #4 - Posted 2004-04-26 09:37:23 »

Update: added LFO  Smiley

[EDIT]: and FM Synthesis

Offline oNyx

JGO Coder


Medals: 1


pixels! :x


« Reply #5 - Posted 2004-04-26 23:29:51 »

Hmmmm... a little webstart demo wich plays some random sounds would be nice Wink

And sequencer... eventually I could support you with some graphics there... after I'm through my scary schedule Wink

弾幕 ☆ @mahonnaiseblog
Offline erikd

JGO Ninja


Medals: 16
Projects: 4
Exp: 14 years


Maximumisness


« Reply #6 - Posted 2004-04-26 23:51:18 »

I'll create a little webstart demo when I have some time Smiley

Quote
And sequencer... eventually I could support you with some graphics there... after I'm through my scary schedule

Thanks Smiley, but I'm thinking about loading an existing format like MIDI files and/or 'tracker' files. Would save lots of time, and access to existing tools (and music).

Another update:
A rather useless(?) feature, but cool nevertheless; I added support for audio input. Running your voice through a ring modulator is freaky, hehe

* erikd talking through microphone, hearing an alien chat back through the speaker *  Grin

Offline oNyx

JGO Coder


Medals: 1


pixels! :x


« Reply #7 - Posted 2004-04-27 00:50:09 »

Quote
I'll create a little webstart demo when I have some time Smiley


Sweet Smiley

Quote
Thanks Smiley, but I'm thinking about loading an existing format like MIDI files and/or 'tracker' files. Would save lots of time, and access to existing tools (and music).


Hmyea... I guess that makes sense. Btw is there a good free midi editor?

Quote
Another update:
A rather useless(?) feature, but cool nevertheless; I added support for audio input. Running your voice through a ring modulator is freaky, hehe

* erikd talking through microphone, hearing an alien chat back through the speaker *  Grin


Webstart webstart Smiley

弾幕 ☆ @mahonnaiseblog
Offline erikd

JGO Ninja


Medals: 16
Projects: 4
Exp: 14 years


Maximumisness


« Reply #8 - Posted 2004-04-27 07:56:54 »

I haven't used it myself (I use Cubase SX & Reason), but I heard this one is pretty good:

http://www.hitsquad.com/smm/programs/MusicStuProd/

Offline oNyx

JGO Coder


Medals: 1


pixels! :x


« Reply #9 - Posted 2004-04-27 10:17:16 »

Quote
I haven't used it myself (I use Cubase SX & Reason), but I heard this one is pretty good:

http://www.hitsquad.com/smm/programs/MusicStuProd/


Hadn't much fun with it. Open/import/whatsoever didn't work... however I could drag midis into it... and 10mins later a total crash. 20mins of rendering down the drain... oh well.

I guess I should just give up making midis Wink

弾幕 ☆ @mahonnaiseblog
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline erikd

JGO Ninja


Medals: 16
Projects: 4
Exp: 14 years


Maximumisness


« Reply #10 - Posted 2004-04-27 10:30:26 »

There's loads of others at

http://www.hitsquad.com/smm/win95/MIDI_SEQUENCERS/

Have fun  Grin

Offline erikd

JGO Ninja


Medals: 16
Projects: 4
Exp: 14 years


Maximumisness


« Reply #11 - Posted 2004-04-27 10:33:19 »

But really, there's no reason to give up on MIDI. A good MIDI sequencer is so much better and versatile than 'trackers' (and MIDI files are usually a lot smaller since there's usually no sound data in it).

EDIT: a MIDI sequencer in java:
http://www.sam-con.com/dj_gopz/toc.html

Offline erikd

JGO Ninja


Medals: 16
Projects: 4
Exp: 14 years


Maximumisness


« Reply #12 - Posted 2004-04-27 22:31:54 »

Little update:

I'm doing a major change in the API Smiley

I used to process little buffers of 32 samples. This was because I eventually need to send a buffer of a given size to the soundcard to play, so I thought I'd just create those buffers and mix, filter etc along the way and finally send the same buffer (after converting it to bytes) to the sound card.
Every 32 samples (or whatever you set the buffer size), the controllers (Volume settings of tone generators, Envelopes etc.) were updated (adding a tiny bit of 'zipper noise' in the process).

Bad Idea  :-/

In the process I created unneeded overhead, because of all the arrays everywhere. Java's bounds checks do take a performance hit (in the client anyway). The need to copy arrays in certain places (in panning for example which has to split a mono signal to stereo) doesn't help there either.
Also the API became a little bit more complex than needed because I had to have AudioInput/AudioOutput interfaces (writing arrays) and ControlInput/ControlOutput interfaces (those not being compatible of course, Controls write just a float).

So, I got rid of all those little arrays and now have only arrays where absolutely needed (sending samples to the sound card, getting sound from the sound card etc).
And, I can get rid of the control interfaces, because there's now just one type of signal that can be used for both audio and controllers, which means more flexibility in the connections you can make.

So in short, the score is:

+ improved performance in audio processing
+ simpler API
+ more flexible API
+ no zipper noise = better audio quality

- controllers like envelopes will be updated 32 times as
 much, so will cause a little performance hit. The
 improved sound quality, better API and faster audio
 processing easily makes up for that.

</diary_update>

Offline Catharsis

Junior Member


Exp: 18 years


TyphonRT rocks!


« Reply #13 - Posted 2004-04-27 23:27:00 »

Quote

- controllers like envelopes will be updated 32 times as
 much, so will cause a little performance hit. The
 improved sound quality, better API and faster audio
 processing easily makes up for that.


It sounds from the above that you are running control signals at the audio rate.

You might want to have a look at SuperCollider for ideas. SuperCollider has a separate audio rate and control rate. Control rate changes are interpolated at the audio rate to remove zipper artifacts..  

I've not had the chance to dig into your project yet, but that might be something to look into if possible..

Offline erikd

JGO Ninja


Medals: 16
Projects: 4
Exp: 14 years


Maximumisness


« Reply #14 - Posted 2004-04-28 07:46:38 »

Quote


It sounds from the above that you are running control signals at the audio rate.

You might want to have a look at SuperCollider for ideas. SuperCollider has a separate audio rate and control rate. Control rate changes are interpolated at the audio rate to remove zipper artifacts..  

I've not had the chance to dig into your project yet, but that might be something to look into if possible..


Yes, I am running control signals at the audio rate now. I did think about interpolation (I used to have some interpolation here and there; there's still an interpolator class which I used previously), but I think I'm going to keep it this way for a while.
Control signals are most of the time cheap operations anyway (not much more expensive than interpolation I guess), and getting rid of the separation between controls and audio gains so much more flexibility and simplicity... I get to delete some classes, *and* get a more powerful api at the same time  Cheesy

But let's see how it turns out.
Maybe I'll have to make some changes in controls again later, *if* control signals turn out to be a performance bottleneck. But then I think I would change something in the implementations of some controllers to speed them up, not the interfaces / API design.

Offline erikd

JGO Ninja


Medals: 16
Projects: 4
Exp: 14 years


Maximumisness


« Reply #15 - Posted 2004-04-28 17:24:52 »

http://www.mycgiserver.com/~movegaga/SynDemo1.jnlp

A little web started demo with some sliders to play with.
When you get distorted sound, turn down the 'gain' a little.
I noticed that in this demo I *sometimes* get an ArrayOutOfBoundsException in an oscillator. Which should never happen, according to the code. Maybe some threading issue or something :-/

Offline oNyx

JGO Coder


Medals: 1


pixels! :x


« Reply #16 - Posted 2004-04-28 18:29:41 »

Ooooooh neatness Grin

weeeoooob weeeeooooob weeeeoooob haha great Smiley

弾幕 ☆ @mahonnaiseblog
Offline erikd

JGO Ninja


Medals: 16
Projects: 4
Exp: 14 years


Maximumisness


« Reply #17 - Posted 2004-04-28 22:32:08 »

Here's another one: :-)

http://www.mycgiserver.com/~movegaga/SynDemo2.jnlp

Make sure you select your microphone for recording in your Volume Control -> Options -> Properties -> recording (windows).

Then talk in your mic and hear HAL gone crazy  Grin

Offline Catharsis

Junior Member


Exp: 18 years


TyphonRT rocks!


« Reply #18 - Posted 2004-04-28 23:19:32 »

Yeah.. the demo is cool.. Keep it going.. Smiley  Make sure that you can construct patches programmatically!  

All of my GUI work with Scream should work great with your project. Plus eventually you might consider using OSC, Open Sound Control, to get your synth running via the network; Scream already has a client based OSC framework; I'll be extending it with server capability after J1; should be as easy as defining a protocol for your synth and interfacing with Scream...

I tipped off someone who might be interested in contributing to your project.. So who knows... Have you made a web page for it yet?

Offline Seekely

Senior Newbie




I am java


« Reply #19 - Posted 2004-04-29 01:04:02 »

for some reason when I was messing with the sounds, almost every one of them reminded me of Excite Bike for the Nintendo Tongue

Good job, keep up the work

http://www.untoldevils.com  
An RPG like every other, except this one is made by me
Offline erikd

JGO Ninja


Medals: 16
Projects: 4
Exp: 14 years


Maximumisness


« Reply #20 - Posted 2004-04-29 07:42:16 »

Quote
Make sure that you can construct patches programmatically!


This is some code of the first demo:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
        Oscillator osc1 = new Oscillator(WaveTables.SAWTOOTH);
        Oscillator osc2 = new Oscillator(WaveTables.SQUARE);
        LowPassFilter lpf1 = new LowPassFilter();
        LowPassFilter lpf2 = new LowPassFilter();
        LFO lfo1 = new LFO(WaveTables.SINUS);
        LFO lfo2 = new LFO(WaveTables.SINUS);
        Amplifier amp1 = new Amplifier();
        Amplifier amp2 = new Amplifier();
        PanPot pan1 = new PanPot();
        PanPot pan2 = new PanPot();
        Mixer mixL = new Mixer();
        Mixer mixR = new Mixer();
        ToJavaSound out = new ToJavaSound(ToJavaSound.STEREO, 32, 8196);
       
        mixL.connectTo(out.inputL);
        mixR.connectTo(out.inputR);
        mixL.addChannel(pan1.outputL);
        mixL.addChannel(pan2.outputL);
        mixR.addChannel(pan1.outputR);
        mixR.addChannel(pan2.outputR);
        amp1.connectTo(pan1);
        amp2.connectTo(pan2);
        lfo1.connectTo(lpf1.cutOffControl);
        lfo2.connectTo(lpf2.cutOffControl);
        lpf1.connectTo(amp1);
        lpf2.connectTo(amp2);
        osc1.connectTo(lpf1);
        osc2.connectTo(lpf2);

Is this what you mean?

Quote
All of my GUI work with Scream should work great with your project. Plus eventually you might consider using OSC, Open Sound Control, to get your synth running via the network; Scream already has a client based OSC framework; I'll be extending it with server capability after J1; should be as easy as defining a protocol for your synth and interfacing with Scream...


Scream looks fantastic.  Smiley
Is OSC a java framework?

Quote
I tipped off someone who might be interested in contributing to your project.. So who knows... Have you made a web page for it yet?


No web page yet. I'm thinking about either a sourceforge.net project or a java.net project.

Offline oNyx

JGO Coder


Medals: 1


pixels! :x


« Reply #21 - Posted 2004-04-29 17:51:36 »

Quote
Here's another one: :-)

http://www.mycgiserver.com/~movegaga/SynDemo2.jnlp

Make sure you select your microphone for recording in your Volume Control -> Options -> Properties -> recording (windows).

Then talk in your mic and hear HAL gone crazy  Grin


Hehe absolutly odd Grin

弾幕 ☆ @mahonnaiseblog
Offline Catharsis

Junior Member


Exp: 18 years


TyphonRT rocks!


« Reply #22 - Posted 2004-05-01 00:19:00 »

Quote


This is some code of the first demo:
<snip>
Is this what you mean?
Scream looks fantastic.  Smiley
Is OSC a java framework?


Open Sound Control is an application protocol (network based and otherwise).

A good overview can be found here:
http://www.cnmat.berkeley.edu/Research/NIME2003/NIME03_Wright.pdf

The main page is here:
http://www.cnmat.berkeley.edu/OpenSoundControl/

As far as my Java implementation I started with Chandrasekhar Ramakrishnan's code, but extended it for NIO and efficiency; packet conservation.
http://www.mat.ucsb.edu/%7Ec.ramakr/illposed/javaosc.html

Checking into OSC will give you an idea about being able to configure your synth programmatically.

The audio engine I am using, SuperCollider3, which is covered in the OSC PDF can only be addressed via OSC.

The goal of a programmatic interface is language independence.  I am able to fully configure and control SuperCollider3 from Java over the network.

Essentially, it would be awesome to have an interface that exposes the functionality of your synthesis system without having to know the implementation details.

The example you listed of being able to connect your synth is programmatic, but still tied more to OO programming than a generic interface.  For instance you will probably want to break down your Oscillator class to particular implementation SinOscillator, SawOscillator, etc.

Spending time to review SuperCollider3 could be very beneficial in gaining some ideas on your project.  SC3 is under GPL, but you should be able to convert the code for basic unit generators (oscillators, filters, etc.) to Java and not break GPL... I'd like to see your synth be released under BSD if possible.

I'd be glad to continue discussing all of this..  Time permitting I would also like to help out with implementation.

Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

Riven (6 views)
2014-07-29 18:09:19

Riven (4 views)
2014-07-29 18:08:52

Dwinin (7 views)
2014-07-29 10:59:34

E.R. Fleming (23 views)
2014-07-29 03:07:13

E.R. Fleming (9 views)
2014-07-29 03:06:25

pw (39 views)
2014-07-24 01:59:36

Riven (39 views)
2014-07-23 21:16:32

Riven (26 views)
2014-07-23 21:07:15

Riven (28 views)
2014-07-23 20:56:16

ctomni231 (59 views)
2014-07-18 06:55:21
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!