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 (536)
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 4561 times)
0 Members and 1 Guest are viewing this topic.
Offline Noisefever

Senior Newbie





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

hi!

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: http://www.noizefever.de/?page_id=418
Offline krasse
« Reply #1 - Posted 2012-03-23 16:28:06 »

Very nice!

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

Offline Noisefever

Senior Newbie





« Reply #2 - Posted 2012-03-23 19: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 20: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!
java.io.UTFDataFormatException: malformed input around byte 3
   at java.io.DataInputStream.readUTF(Unknown Source)
   at java.io.DataInputStream.readUTF(Unknown Source)
   at noisefever.nordosc.instrument.Instrument.load(Instrument.java:226)
   at noisefever.nordosc.sequencer.Sequencer.loadSong(Sequencer.java:450)
   at noisefever.nordosc.player.Player.start(Player.java:37)
   at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
   at java.lang.Thread.run(Unknown 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.

"Greetings my friends! We are all interested in the future, for that is where you and I are going to spend the rest of our lives!" -- The Amazing Criswell
Offline ShannonSmith
« Reply #4 - Posted 2012-03-23 21: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: 340
Projects: 2
Exp: 5 years


I'm the King!


« Reply #5 - Posted 2012-03-23 23: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 08: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 DataInputReader.read(byte[],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.

@ShannonSmith:
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 09:16:42 »

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

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.
1  
2  
3  
4  
5  
6  
//  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);

"Greetings my friends! We are all interested in the future, for that is where you and I are going to spend the rest of our lives!" -- The Amazing Criswell
Offline Noisefever

Senior Newbie





« Reply #9 - Posted 2012-03-26 09: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)

1  
2  
3  
4  
5  
6  
7  
if(song==null || song.isEmpty()) song = "http://www.noizefever.de/games/Demosong.nos";
try {
   //sequencer.loadSong(new DataInputStream(getClass().getResourceAsStream(song)));
  sequencer.loadSong(new DataInputStream(new URL(song).openConnection().getInputStream()));
} catch (IOException e) {
   e.printStackTrace();
}


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

1  
2  
3  
4  
data = new byte[reader.readInt()];
if(reader.read(getData(), 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 11: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 14: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.

"Greetings my friends! We are all interested in the future, for that is where you and I are going to spend the rest of our lives!" -- The Amazing Criswell
Offline Noisefever

Senior Newbie





« Reply #12 - Posted 2012-03-27 21: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 10: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).

http://www.noizefever.de/?page_id=418
Offline rburgosnavas

Junior Newbie





« Reply #14 - Posted 2012-11-07 09: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.

 

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 (20 views)
2014-07-29 18:09:19

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

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

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

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

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

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

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

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

ctomni231 (60 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!