-
-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Analyzer stops working when input AudioSample/SoundFile playback stops/runs out #95
Comments
Hello, thanks for reporting. Could you please first try adding |
Sound.list() got stuck:
NoSuchMethodError: java.lang.String.repeat(I)Ljava/lang/String; |
Aaaah I see. The simplest solution would probably be for you to upgrade your Processing installation to version 4. But I will make sure to add a fix which makes v2.4 of the library backwards-compatible with Processing 3 installations in the next few hours. |
Thanks for your time. I just ran my sketch on Processing 4.1.1 and it works fine with library v2.3. Then I changed it to v2.4, no sound, same as on P3:
A side note, it would be nice to have the library version in the status information. So I though I might have to switch output ID 3 and I did:
|
That's super helpful, thank you very much! Could you please post your full sketch code? I think it should also be possible to upload the Another fix you could try right now is to call Also could I ask what sound card/hardware you are using? Best |
I tried to write a simple sketch. But that worked. Now I'm attaching a stripped down version of my program which plays no sound with lib2.4. |
MultiChannel is not recognized. Do I have to import something? |
Are you sure you have library version 2.4 installed at the moment? Thanks for posting your sketch by the way, it's extremely helpful for us to figure out any troubles that arise between 2.3 and 2.4, especially for complex sketches such as this! |
Sorry, I didn't know it's from Sound library. I thought it's native Processing. Therefor I tried that on P3 and P4.
and this is from P4:
|
@bigboss97 and do you still not get any audio when you run your sketch on Processing4 with |
Correct, still silent. |
I'm still trying to understand your testSoundLib sketch, it's very complex... What sound generators should the audio output be coming from, is it just the microphone? I wonder if it's just that the wrong input channel is selected, which would require adjusting the input index in AudioIn newAudioIn() {
return new AudioIn(this, 0);
} |
Hmmm that's strange, but good to know. What type of object is |
You can try following piece of code. That works on P4 with lib2.3, but no sound with lib2.4:
|
Any update? |
Have you got a chance to look at... ? |
Sorry for the delay, I finally looked into it and found a workaround that might work for you: it looks like music = new SoundFile( this, dataPath("something.mp3"));
FFT fft = new FFT(this, 64);
// soundfile not audible if called in this order
fft.input(music);
music.play();
// everything fine if called in this order
music.play();
fft.input(music); I will look into a permanent solution, but you might be able to fix your sketch with a workaround. |
Thanks for the response. I'll use the workaround to try out on some songs which have a too slow playback on v2.3. |
I got interested in this thread and decided to go checkout the fft object in the repo. protected void setInput(UnitOutputPort input) {
// superclass makes sure that input unit is actually playing, just connect it
Engine.getEngine().add(this.fft);
this.fft.input.connect(input);
this.fft.start();
} The code comment implies the author was aware of the need to have the audio playing but felt convinced the setInput function doesn't need to check for it. Pix ❣️ |
I've added two lines to workaround and that works perfectly:
I tried v2.4 on some MP3's. Those used to run too slow on v2.3. Now they are fine. Also those were fail to play. Now they are all good. Well done! |
I use my workaround to get the audio played. When I run the below code the spectrum remains 0.0. But it works with v2.3. This is probably a separate issue.
|
Did you get a chance to look into that? |
Any update? I'm still very interested in using v2.4. |
Still hope to see an update here. |
Sorry for the delay on this one:
The superclass refers to the public processing-sound/src/processing/sound/Analyzer.java Lines 25 to 45 in 75e4d7b
The current issue seems to be a different one though: it looks like the FFT analyzer is consuming data from the input source, only when that source's playback is started only after connecting to the analyzer, the source's output (or rather its |
The issue was in the way that played back units were (unnecessarily) only selectively connected to outputs when they were already part of the synth network (such as when they are already connected to an analyzer unit), introduced in a52fa9d. @bigboss97 if you could test this sound.jar (just replace the sound.jar in your (Leaving this issue open because there remains an |
I compared the new sound.jar with the default one in lib-2.4, no difference:
With stop(), it plays sound, but all spectrum values are zero. |
With this sound.jar it is not necessary to use the
or
The issue with |
@bigboss97 this sound.jar should also stop soundfiles from getting disconnected when they are stopped! |
This is working perfectly:
But no sound after swap:
It's not a big deal. I can swap the commands in my codes. |
Hmmm that is strange. Since you are on Windows, you might have to quit Processing, replace the |
Yes, I always close Processing whenever I change library files. It doesn't let me rename or move if Processing is running.
|
I've been testing the new library on many MP3 files. Those files which were having issues in v2.3, e.g. incorrect speed, unable to open, are all good now. Well done!👍 Thanks for your effort. It was worth to wait for the version 2.4 😊 |
I've written many sketches using v2.3.1. I always have the issue with incorrect sample rate in MP3 which causes slower playback.
I want to see whether this is still in v2.4. Today I downloaded v2.4 and tried on my old sketch. Everything works fine, i.e. progress bar, FFT etc. but no sound. I tried to use amp(1), still no luck. What could be the reason?
I'm running Processing 3.5.4 on Windows 11 Home.
The text was updated successfully, but these errors were encountered: