Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: jLossyWav (Read 10598 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

jLossyWav

This is the initial implementation of the lossyWav algorithm in Java.

It is based on the C# port, and doesn't provide yet most of the parameters ( it only accepts the -q parameter).

To execute it:  java -jar jLossyWav.jar -q 5.0 inputFile.wav.


The sources are included inside the .jar file. They can be seen with 7-Zip or be imported directly into Eclipse IDE.


[Current posted version: 0.5.1]

jLossyWav

Reply #1
I had to recompile because of this error:
Code: [Select]
Exception in thread "main" java.lang.UnsupportedClassVersionError: Bad version number in .class file
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:675)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:316)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:280)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:374)
    at org.lossywav.dsp.InplaceFFT.<clinit>(InplaceFFT.java:48)
    at org.lossywav.algorithm.Analyzer.<init>(Analyzer.java:103)
    at org.lossywav.algorithm.LossyWav.<init>(LossyWav.java:53)
    at org.lossywav.frontend.jLossyWavConsole.main(jLossyWavConsole.java:60)

I had to remove the invalid @Override in ComplexArrayBuffer.java and DoubleArrayBuffer.java for compiling too.
After that it seems to work

Bugs found: does not accept mono files. Does not work properly with the following file (sample rate 22kHz)-
[attachment=4841:attachment]

jLossyWav

Reply #2
I had to remove the invalid @Override in ComplexArrayBuffer.java and DoubleArrayBuffer.java for compiling too.


Which java version are you using? This has been compiled with java 1.6.0r10
@Override is a valid annotation. Requires java 5.

Bugs found: does not accept mono files. Does not work properly with the following file (sample rate 22kHz)-

I'll check why mono doesn't work. there shouldn't be a problem. about samplerate of 22Khz, the ported code may not cope with it, but i'll take a look too.



Edit:it
The problems with mono and other sampling rates were pretty trivial. It was all due to fixed values when creating the writer. I've replaced those to use the values from the .wav file.
Uploaded a version with those changed.

jLossyWav

Reply #3
Quote
' date='Jan 24 2009, 08:31' post='611054']

I had to remove the invalid @Override in ComplexArrayBuffer.java and DoubleArrayBuffer.java for compiling too.


Which java version are you using? This has been compiled with java 1.6.0r10
@Override is a valid annotation. Requires java 5.

Yeah that is the problem, I still have Java 5 (1.5.0_16).
You should not use @Override when the method does not exist in the superclass (here the superclass is Object), should you?

Quote

Bugs found: does not accept mono files. Does not work properly with the following file (sample rate 22kHz)-

I'll check why mono doesn't work. there shouldn't be a problem. about samplerate of 22Khz, the ported code may not cope with it, but i'll take a look too.

Edit:it
The problems with mono and other sampling rates were pretty trivial. It was all due to fixed values when creating the writer. I've replaced those to use the values from the .wav file.
Uploaded a version with those changed.

Great, thanks!

jLossyWav

Reply #4
Uploaded a new version which now trully works (when testing another file, i realized that the FFT analisys was using one bit too much, which implied that it was using erroneous information).

It still doesn't produce the same output than lossywav 1.1.1 but it is pretty close now.

jLossyWav

Reply #5
Hey there...

I tried to convert a track with "-q -4" as quality settings as could be done with the original lossyWav 1.1.0e, but it didn't accept the settings.

Thanks tho very much for your effort and hard work to port it to Java! When I get the chance, I'll have a look or two over the source code

All the best,
monoton

 

jLossyWav

Reply #6
Yes, I know.

My initial implementation just provides a conversion of the algorithm in an informative way, and i left the options a bit on the side.

I plan to upgrade it for 1.2.0, although i don't have a timeline for that set up yet.

The source code is separated in classes and methods that should represent the process itself, and have some javadoc in them trying to describe what everything does.

I hope to improve those comments and source separation further with the new release too, but sure a look from other people could help to find out if i'm on the good path

jLossyWav

Reply #7
I've got a freshly new version of jLossyWav ready. I've labeled it 0.5.0 .

This one is a big improvement over the older.

- Uses an intermediate buffer for file IO. This has increased the speed considerably (obviously, slower than LossyWav, but not by a mile now)
- It implements most of the console switches that LossyWav supports (important ones still missing are stdin/out and --merge )
- The algorithm is updated to LossyWav 1.1.4c
- Several things have been changed to conform better with the official one.


This release is bit-perfect with the default settings (and the single file I've tried) compared to the official.


As always, the .jar contains the sources so anyone can look and either help or learn.


Also, you would like to know that Nick and I are in contact about the sources and we will attempt to make both easier to understand and manage (Comparing the Delphi to the Java implementation is not an easy task right now ).

Expect more versions to follow due to these changes.

jLossyWav

Reply #8
Great work [JAZ] - my Delphi's not **that** illegible, is it? 

As discussed, I'm working on making my Delphi easier to read and am currently creating more units to split the code up into functional chunks.

Nick.
lossyWAV -q X -a 4 -s h -A --feedback 2 --limit 15848 --scale 0.5 | FLAC -5 -e -p -b 512 -P=4096 -S- (having set foobar to output 24-bit PCM; scaling by 0.5 gives the ANS headroom to work)

jLossyWav

Reply #9
Error with this version...
Code: [Select]
Exception in thread "main" java.lang.NoClassDefFoundError: org/lossywav/frontend/jLossyWavConsole


This command works:

Code: [Select]
java -cp jLossyWav.jar org.lossywav.frontend.JLossyWavConsole

(note that it is a capital J. The normal command may work on Windows though)

After that jLossyWav seems to work fine.

jLossyWav

Reply #10
Ops!

I decided to change the class name, since usually in Java every class starts with a capital letter

I've also took the opportunity to fix the -o option. It was failing if the input file already contained a path.