Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Importing some .WAV files fails #780

Open
Gamebuster19901 opened this issue Jan 24, 2023 · 8 comments
Open

Importing some .WAV files fails #780

Gamebuster19901 opened this issue Jan 24, 2023 · 8 comments
Assignees
Labels

Comments

@Gamebuster19901
Copy link
Contributor

Describe the bug
Utiliti fails to import some .WAV files

Stack Trace
The error message you get either in your console or the crash.txt located in your program's root directory.

java.lang.ArrayIndexOutOfBoundsException: Index 580 out of bounds for length 580
	at javazoom.jl.decoder.LayerIIIDecoder.huffman_decode(LayerIIIDecoder.java:795)
	at javazoom.jl.decoder.LayerIIIDecoder.decode(LayerIIIDecoder.java:278)
	at javazoom.jl.decoder.LayerIIIDecoder.decodeFrame(LayerIIIDecoder.java:219)
	at javazoom.jl.decoder.Decoder.decodeFrame(Decoder.java:147)
	at javazoom.spi.mpeg.sampled.convert.DecodedMpegAudioInputStream.execute(DecodedMpegAudioInputStream.java:185)
	at org.tritonus.share.TCircularBuffer.read(TCircularBuffer.java:138)
	at org.tritonus.share.sampled.convert.TAsynchronousFilteredAudioInputStream.read(TAsynchronousFilteredAudioInputStream.java:197)
	at org.tritonus.share.sampled.convert.TAsynchronousFilteredAudioInputStream.read(TAsynchronousFilteredAudioInputStream.java:182)
	at de.gurkenlabs.litiengine.util.io.StreamUtilities.copy(StreamUtilities.java:40)
	at de.gurkenlabs.litiengine.util.io.StreamUtilities.getBytes(StreamUtilities.java:56)
	at de.gurkenlabs.litiengine.sound.Sound.<init>(Sound.java:56)
	at de.gurkenlabs.litiengine.resources.SoundResource.<init>(SoundResource.java:33)
	at de.gurkenlabs.utiliti.components.Editor.importSounds(Editor.java:537)
	at de.gurkenlabs.utiliti.components.Editor.importSounds(Editor.java:447)
	at de.gurkenlabs.utiliti.swing.menus.ResourcesMenu.lambda$7(ResourcesMenu.java:65)
	at java.desktop/javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1972)
	at java.desktop/javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2313)
	at java.desktop/javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:405)
	at java.desktop/javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:262)
	at java.desktop/javax.swing.AbstractButton.doClick(AbstractButton.java:374)
	at com.github.weisj.darklaf.ui.menu.DarkMenuItemUIBase.doClick(DarkMenuItemUIBase.java:165)
	at java.desktop/javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:1072)
	at java.desktop/java.awt.Component.processMouseEvent(Component.java:6626)
	at java.desktop/javax.swing.JComponent.processMouseEvent(JComponent.java:3389)
	at java.desktop/java.awt.Component.processEvent(Component.java:6391)
	at java.desktop/java.awt.Container.processEvent(Container.java:2266)
	at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:5001)
	at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2324)
	at java.desktop/java.awt.Component.dispatchEvent(Component.java:4833)
	at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4948)
	at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Container.java:4575)
	at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Container.java:4516)
	at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2310)
	at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2780)
	at java.desktop/java.awt.Component.dispatchEvent(Component.java:4833)
	at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:773)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:722)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:716)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:97)
	at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:746)
	at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:744)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
	at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:743)
	at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
	at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)

To Reproduce
Steps to reproduce the behavior:

  1. In Utiliti, Click on [Resources] -> [Import] -> [Sounds] -> Select [notWorking.wav]
  2. See error

Expected behavior
The file should import correctly

Your System:

Operating System: Linux
	Architecture: amd64
	Version: 5.15.0-58-generic
Memory:
	Max heap size: 7.8 GiB
	Current heap size: 148.0 MiB
	Heap used: 73.7 MiB
	Free heap: 74.3 MiB
Java Version: OpenJDK Runtime Environment 17.0.5+8-Ubuntu-2ubuntu122.04 
	Vendor: Private Build
Uptime: PT59.367S
Screens: 2
	Screen 0: 5760x2160@50hz
	Screen 1: 1920x1080

Additional context
sounds.zip

@steffen-wilke steffen-wilke self-assigned this Jan 10, 2024
@Gamebuster19901
Copy link
Contributor Author

Has anyone else been able to reproduce this?

Looks like javazoom is a dead project, so if this is a bug in that project, it's unlikely to be fixed.

@nightm4re94
Copy link
Member

unfortunately this has happened to me too in the past. Using OGG instead of WAV was generally more reliable for me and saved lots of space. But you're completely right - the underlying issue will probably not be fixed.
@steffen-wilke has been working on a replacement of our sound library for a while now, not sure what the status here is.

@Gamebuster19901
Copy link
Contributor Author

Is there an issue with the javax sound lib that comes with java?

@nightm4re94
Copy link
Member

yes, it is incredibly limited when it comes to real world use as it only supports:

  • Audio file formats: AIFF, AU and WAV
  • Music file formats: MIDI Type 0, MIDI Type 1, and Rich Music Format (RMF)
  • Sound formats: 8-bit and 16-bit audio data, in mono and stereo, with sample rates from 8 kHz to 48 kHz

@steffen-wilke
Copy link
Contributor

steffen-wilke commented Jul 6, 2024

unfortunately this has happened to me too in the past. Using OGG instead of WAV was generally more reliable for me and saved lots of space. But you're completely right - the underlying issue will probably not be fixed. @steffen-wilke has been working on a replacement of our sound library for a while now, not sure what the status here is.

for progress, you can check out the audio-spi branch
I was working on mp3 decoding algorithm last. The problem with that wav implementation is that javazoom has a bug in it where it tries to decode a wav file as mp3 (as you can see from the callstack, it's in the decoding process (huffman) of the mp3 algorithm but should actually not be there for a wav file). I also found the exact line of code where this could be fixed in the library but due to license restrictions I didn't go for a fix there.

@Gamebuster19901
Copy link
Contributor Author

unfortunately this has happened to me too in the past. Using OGG instead of WAV was generally more reliable for me and saved lots of space. But you're completely right - the underlying issue will probably not be fixed. @steffen-wilke has been working on a replacement of our sound library for a while now, not sure what the status here is.

for progress, you can check out the audio-spi branch I was working on mp3 decoding algorithm last. The problem with that wav implementation is that javazoom has a bug in it where it tries to decode a wav file as mp3 (as you can see from the callstack, it's in the decoding process (huffman) of the mp3 algorithm but should actually not be there for a wav file). I also found the exact line of code where this could be fixed in the library but due to license restrictions I didn't go for a fix there.

It's LGPL, isn't it? LGPL should be compatible, no?

@nightm4re94
Copy link
Member

If we made modifications to LGPL code, our code would have to be LGPL too. But using LGPL licensed libraries per se is not a problem.

@bowbahdoe
Copy link

bowbahdoe commented Jul 27, 2024

@steffen-wilke I maintain a fork of the audio spi stuff here https://github.com/bowbahdoe/java-audio-stack

Whenever you get around to fixing it I can upstream a fix. If merging it into that separate library would help you sidestep LGPL issues I can also oblige.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants