nordOsc Synthesizer


I have a small synthesizer in development. It aims at making small music for e.g. games. The demosong has around 39kb at the moment. nordOsc itself has 60kb. But I’m trying to make it even smaller :wink:
At the moment I’m working on a classic tracker styled editor.
Is there any interest for such a thing?

more info and a quick & dirty demosong:

Very nice!

What are your plans for releasing them (player and editor)?

I will release it for free if it’s that what you mean. And if there is interest I will of course improve it.

I’m curious, but wasn’t able to get it to play.

I have Windows XP, the Java being used is HotSpot. This run was using IE, but I will give Mozilla a try. Nope. Same error:

Note A (Midi note 45) calculated: 110.00023.
Error loading sampledata! malformed input around byte 3
at Source)
at Source)
at noisefever.nordosc.instrument.Instrument.load(
at noisefever.nordosc.sequencer.Sequencer.loadSong(
at noisefever.nordosc.player.Player.start(
at sun.plugin2.applet.Plugin2Manager$ Source)
at Source)

I hope the above helps you figure out what is going on.

Getting an “all Java” solution to sound that works reliably on all setups has been a challenge, to say the least. So I wish you luck and will be watching closely. I’ve been working, on an off, on an FM-based synth to do real-time playing for my games.

Nord (specifically the nord lead) is what is inspired me to start doing synthesizers and I assume is the inspiration for nordOsc. Iv’e done about 20 synths in java, trying just about every technique under the sun. One thing I would recommend (for use in games) would be ditching trying to perfectly reproduce classic band-limited waveforms/sync as it is HARD and takes a lot of time. As long as you have a good band-limiting wavetable interpolater I would say just stick to PCM samples. Even with just few hundred Kb you can pack in enough samples for a broad variety of sounds and still retain real-time modulation possibilities.
Consider the Korg M1, shipped with just 4Mb wave rom and had hundreds excellent sounding instruments and is still used in tracks today.

I got the same exception as philfrei, except it was “around byte 1”.

Using Java 7 on Windows 7.

this error is… interesting. I had the same when I packaged the song into the jar and tried to load it with getResourceAsStream(). Now it loads from URL and this works for me. But as you showed, not for everyone. It seems that this is a problem with[],offset,len). This is the only location in the code where I use this read method (loading the sample data). In my getResourceFromStream() tests it worked without sample data. I’m puzzled :slight_smile: Will try to work around this.

yes, the nord lead was the name inspiration :wink: for myself I never had one so it was not the model for the synth architecture. the synth is able to handle sample data, and yes, for ingame I would recommend to use them preferred. but I try to improve the speed of the synthesized waveforms.
btw: your synths are looking and sounding really nice!

Make it available noooooow!

Tried again. I’m still bombing out at line 226.

[quote]…packaged the song into the jar and tried to load it with getResourceAsStream(). Now it loads from URL and this works for me…
You are reminding me of a recent problem loading resources. If an “InputStream” is involved as a substep, it requires the ability to mark/reset the stream. There is a way of using URL that works around the InputStream issue, and perhaps you are already doing it, but it is hard to know without seeing the code.

Any chance you can display the code around 226 and we can look to see if there are any suggestions for fixes or improvements?

Following is an example of the problem and its fix. I don’t know at all if it is applicable to your code. The AudioMixer.class refers to a class in my program that is being used as a reference to the codebase.

//  This doesn't always work
//      AudioInputStream ais = AudioSystem.getAudioInputStream(
//            AudioMixer.class.getResourceAsStream(fileName));
     // better...
      URL url = AudioMixer.class.getResource(fileName);
      AudioInputStream ais =  AudioSystem.getAudioInputStream(url); 

from the applet I open it like this: (and it seems that it makes no matter which method I use if it’s not local on my computer)

if(song==null || song.isEmpty()) song = "";
try {
   //sequencer.loadSong(new DataInputStream(getClass().getResourceAsStream(song)));
   sequencer.loadSong(new DataInputStream(new URL(song).openConnection().getInputStream()));
} catch (IOException e) {

then it takes a long way through some classes down to the sample data loader, which is basically that:

data = new byte[reader.readInt()];
if(, 0, getData().length) < getData().length){
   System.out.println("Error loading sampledata!");

as a quick fix I could use the version of the demosong without samples… yes… i’ll do that. now :slight_smile:

I’m so dumb! :smiley:

I think I have fixed it. Could you please approve that?

It’s working now!

The rhythm is perfectly solid, and the synth tones sound good.

Very nice, that this can be done for under 100kb!

I’d love to take a look at the code, myself. I want to figure out how to get my fm sounds (I’ve had some success converting Yamaha DX7 patches to playable java) to work via java Synth & Midi control.

I’m sorry but I don’t want to publish the source code. At least not yet.

But I can post the parts that are interesting for you. I don’t use midi at all. Or the synth provided by java. The mixer starts a thread, that handles the sequencer events and then collects the audiodata for mixing in a buffer. Then this buffer is pushed to an audio line. This makes the sequencer playing rock solid. For live controls (like your fm synth) it’s another story. They will be always delayed for the buffer length or more because they not part of the same thread. No timing warranty!

I can post the mixer thread code if you want.

The download is finally there.
Be warned: the GUI is more like a TUI (Text User Interface :wink: ) and very ugly! But doing a good GUI is very hard and so that will only happen if there is enough interest (or somebody else to help me with that).

Oh man, this is so awesome, super, super awesome!!! Is there a way to be able to look at the code for educational purposes only?

I’m kinda of a newbie, or sort of at the crossroads of between newbie and intermediate, and I have passion for music apps, synths, and audio in general. I always wondered about making awesome synths in Java but everywhere I stick my nose in, I see or read that Java is not the way to go for these kinds of things (C++, C, is the way to go, blah, blah, blah). You nordOsc has given me a nice “light at the end of the tunnel” moment.

Anyway, I’m serious about the possibility of checking out the code for educational purposes, or at the very least, if I could become your best friend and pick your brain about doing something like this on my own, that would be so very much appreciated! ;D