Hi !
Featured games (84)
games approved by the League of Dukes
Games in Showcase (603)
Games in Android Showcase (171)
games submitted by our members
Games in WIP (650)
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  
  nordOsc Synthesizer  (Read 5682 times)
0 Members and 1 Guest are viewing this topic.
Offline Noisefever

Senior Newbie

« Posted 2012-03-23 12:51:33 »


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:
Offline krasse
« Reply #1 - Posted 2012-03-23 15:28:06 »

Very nice!

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

Offline Noisefever

Senior Newbie

« Reply #2 - Posted 2012-03-23 18:51:45 »

I will release it for free if it's that what you mean. And if there is interest I will of course improve it.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline philfrei
« Reply #3 - Posted 2012-03-23 19:22:52 »

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.

"We all secretly believe we are right about everything and, by extension, we are all wrong." W. Storr, The Unpersuadables
Offline ShannonSmith
« Reply #4 - Posted 2012-03-23 20:03:31 »

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.
Offline ra4king

JGO Kernel

Medals: 389
Projects: 3
Exp: 5 years

I'm the King!

« Reply #5 - Posted 2012-03-23 22:59:30 »

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

Using Java 7 on Windows 7.

Offline Noisefever

Senior Newbie

« Reply #6 - Posted 2012-03-24 07:48:20 »

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 Smiley 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!
Offline Deza

Senior Newbie

Projects: 1

« Reply #7 - Posted 2012-03-24 08:16:42 »

Make it available noooooow!
Offline philfrei
« Reply #8 - Posted 2012-03-25 22:19:20 »

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

...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);

"We all secretly believe we are right about everything and, by extension, we are all wrong." W. Storr, The Unpersuadables
Offline Noisefever

Senior Newbie

« Reply #9 - Posted 2012-03-26 07:41:07 »

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 Smiley
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Noisefever

Senior Newbie

« Reply #10 - Posted 2012-03-26 09:34:22 »

I'm so dumb! Cheesy

I think I have fixed it. Could you please approve that?
Offline philfrei
« Reply #11 - Posted 2012-03-26 12:54:22 »

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.

"We all secretly believe we are right about everything and, by extension, we are all wrong." W. Storr, The Unpersuadables
Offline Noisefever

Senior Newbie

« Reply #12 - Posted 2012-03-27 19:24:44 »

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.
Offline Noisefever

Senior Newbie

« Reply #13 - Posted 2012-04-25 08:45:10 »

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).
Offline rburgosnavas

Junior Newbie

« Reply #14 - Posted 2012-11-07 08:10:14 »

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! Grin
Pages: [1]
  ignore  |  Print  
You cannot reply to this message, because it is very, very old.

Jesse (16 views)
2015-07-29 04:35:27

Riven (37 views)
2015-07-27 16:38:00

Riven (19 views)
2015-07-27 15:35:20

Riven (22 views)
2015-07-27 12:26:13

Riven (12 views)
2015-07-27 12:23:39

BurntPizza (32 views)
2015-07-25 00:14:37

BurntPizza (42 views)
2015-07-24 22:06:39

BurntPizza (24 views)
2015-07-24 06:06:53

NoxInc (31 views)
2015-07-22 22:16:53

NoxInc (20 views)
2015-07-22 22:13:39
List of Learning Resources
by gouessej
2015-07-09 11:29:36

How Do I Expand My Game?
by bashfrog
2015-06-14 11:34:43

List of Learning Resources
by PocketCrafter7
2015-05-31 05:37:30

Intersection Methods
by Roquen
2015-05-29 08:19:33

List of Learning Resources
by SilverTiger
2015-05-05 10:20:32

How to: JGO Wiki
by Mac70
2015-02-17 20:56:16

2D Dynamic Lighting
by ThePixelPony
2015-01-01 20:25:42

How do I start Java Game Development?
by gouessej
2014-12-27 19:41:21 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‑
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!