philburk / freehorn

Computer music application, composed by Larry Polansky
17 stars 1 forks source link

JSyn error: Too many tokens. Table size exceeded. #2

Open philburk opened 1 year ago

philburk commented 1 year ago

Mike Winter has reported by email that when he runs FreeHorn.jar he gets that error. I initially thought that was coming from an old CSyn based JSyn. But now I believe it is being thrown by the Pure Java JSyn. FreeHorn was written using the old JSyn API and it uses a bridge to the new JSyn API. The bridge implements the old CSyn token table in Java. That is in "com.softsynth.jsyn.bridge.ThingTable.java" in addThing().

Message from Mike follows:

I am not on a Mac. I am running Arch Linux (with jack) and have only been using the following to run Freehorn:

java -jar Freehorn.jar 

or

javac -d classes -cp 'path_to_jsyn' org/frogpeak/horn/*.java

followed by

java -cp classes:'path_to_jsyn' org.frogpeak.horn.FreeHorn

Either way... When I launch, there is a long delay and my computer gets pretty consumed. Then the audio settings window opens but nothing else and in the terminal. The full message is:

[mwinter@unboundedpress ~]$ java -jar '/home/mwinter/Downloads/freehorn/freehorn/FreeHorn.jar'
freeHorn by Larry Polansky
Today is Tue Jan 31 11:41:53 CST 2023
  java.version = 1.8.0_352, java.vendor = Oracle Corporation, os.arch = amd64
totalLength = 3.0
fundamentalFrequency = 110.0
Jan 31, 2023 11:42:57 AM com.jsyn.engine.SynthesisEngine start
INFO: Pure Java JSyn from [www.softsynth.com](http://www.softsynth.com/), rate = 44100, RT, V16.7.3 (build 457, 2014-12-25)
com.softsynth.jsyn.SynthException: JSyn error: Too many tokens. Table size exceeded.  -  Could not allocate a slot in token table., 0x0=0, 0x0=0
philburk commented 1 year ago

I cannot reproduce this on Mac or Linux. Here is my output on Linux:

$ java -jar FreeHorn.jar
freeHorn by Larry Polansky
Today is Sat Feb 04 15:20:51 PST 2023
  java.version = 11.0.17, java.vendor = Ubuntu, os.arch = amd64
totalLength = 3.0
fundamentalFrequency = 110.0
Feb 04, 2023 3:20:52 PM com.jsyn.engine.SynthesisEngine start
INFO: Pure Java JSyn from www.softsynth.com, rate = 44100, RT, V16.7.3 (build 457, 2014-12-25)
java.awt.Point[x=20,y=20]
java.awt.Point[x=72,y=27]
java.awt.Point[x=72,y=27]
totalLength = 3.0
fundamentalFrequency = 110.0
SectionPlayer: 0 finished...
SectionPlayer: 1 finished...
SectionPlayer: 2 finished...
SectionPlayer: 3 finished...
SectionPlayer: -1 finished...
HornPlayer finished...
philburk commented 1 year ago

I suspect there is a problem with an audio device on Arch Linux. It may be reporting a huge number of channels. That would account for the long time it takes to open the Audio Settings dialog and the token table overflow.

I am building a test version that displays the number of devices and channels and clips them to reasonable values.

mwinter80 commented 1 year ago

Thanks! Strangely, the current Jar launched today. I have yet to even restart my computer. But something is acting differently which does seem related to your diagnosis. It has launched but without the registering my sound card or jack (when I have jack running). It does seem to register my hdmi outputs and my loopback, but unfortunately no sound. If your idea is correct, I imagine that before it was actually connecting to my internal soundcard and/or jack and that might have tried to register too many channels. I will report back next time I restart my computer.

philburk commented 1 year ago

Is there a way to specify a default audio output device in your settings? Did you have any USB devices plugged in? Or did you have any virtual audio devices running?

mwinter80 commented 1 year ago

I am pretty sure that when jack audio is off, my system uses pulseaudio. Now that the program is launching, is it possible that my soundcard does not show because it is fixed at a SR of 48000. I can see that jsyn is initializing to 41k: INFO: Pure Java JSyn from www.softsynth.com, rate = 44100, RT, V16.7.3 (build 457, 2014-12-25)