-
-
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
UnsupportedOperationException: Cannot create AudioRecord in Android mode #37
Comments
@markcosmic thanks for reporting! Could you please call @Calsign any idea what's going on there? I've got a hunch that either the device doesn't support capturing audio at all (hence the |
Thanks for getting back to me. The error this thread now refers to is interesting because the sketch I listed in my original thread only uses playback. I get the same error if I change “import processing.sound.*” to “import processing.sound.SoundFile”. I am not setting up to audio record, nor am I trying to. I’m just trying to get the playback function to work as it did before I used the SDK updater. In using Sound.list(), the emulator reports: |
@markcosmic yeah I can see that, I'll have a look. I'm also a bit confused why you're still getting the |
I'm using: |
@markcosmic this issue should be fixed with Sound library version 2.2.1, which will become available from the contribution manager in the next couple of days. In the meantime you could already download the new version from here: https://github.com/processing/processing-sound/releases/download/v2.2.1/sound.zip |
Thank you |
Ok, been testing the new update 2.2.1. In Java Mode I still get this INFO message: |
Does it just not load smoothly or is it also not playing back smoothly? Either way if this is limited to the Android device emulator then there's probably nothing that can be done on the sound library side. Have you tried running the sketch on an actual Android device? It's true that playback currently does not stop when the sketch is backgrounded on Android (or stopped from the Processing IDE). When running on an actual device the sound only stops when the app is killed on the device itself. If we want to implement the default behaviour to be pausing the playback while the sketch is backgrounded, the appropriate code will have to go here: processing-sound/src/processing/sound/Engine.java Lines 240 to 253 in 919be00
I'm a bit confused why the sound keeps playing on the emulator though when the sketch is stopped since dispose() seems to be implemented correctly. @codeanticode do you know more about how these callback functions are invoked differently on the device emulator in comparison to an actual Android system?
|
I don't know that the callback functions are invoked differently on the device emulator in comparison to an actual Android device, but they act the same. The sound playback did not pause when the sketch was backgrounded on the Android device I tested on. The sound only stopped when the app was killed on the device. Same as the emulator |
I honestly don't think the issue is with the Processing Sound library. It seemed to be working fine until the latest Android SDK update. I believe the issue is in the SDK and Google needs to fix it. It's this simple... |
Since doing the recent SDK update in Processing for Android:
The Sound Library is no longer functioning in Android mode. I get this error:
java.lang.UnsupportedOperationException: Cannot create AudioRecord
at android.media.AudioRecord$Builder.build(AudioRecord.java:626)
at processing.sound.JSynAndroidAudioDeviceManager$AndroidAudioInputStream.start(Unknown Source:66)
at com.jsyn.engine.SynthesisEngine$EngineThread.run(Unknown Source:29)
I installed Processing 3 on 2 windows 10 PCs and a windows 7 PC and received the same error.
As a test I tried the “SimplePlayback” Processing 3 Sound example.
It worked in JAVA mode; giving this INFO:
Jun 11, 2019 12:32:42 PM com.jsyn.devices.javasound.JavaSoundAudioDevice
INFO: JSyn: default output latency set to 80 msec for Windows 10
Here is the sketch, slightly modified:
import processing.sound.*;
SoundFile soundfile;
void setup() {
//fullScreen();
size(640, 360);
background(255);
soundfile = new SoundFile(this, “vibraphon.aiff”);
println(“SFSampleRate= " + soundfile.sampleRate() + " Hz”);
println(“SFSamples= " + soundfile.frames() + " samples”);
println(“SFDuration= " + soundfile.duration() + " seconds”);
soundfile.loop();
}
void draw() {
float playbackSpeed = map(mouseY, 0, width, 0.25, 4.0);
soundfile.rate(playbackSpeed);
float panning = map(mouseX, 0, width, -1.0, 1.0);
soundfile.pan(panning);
}
void mouseDragged(){
float amplitude = map(mouseY, 0, height, 0.2, 1.0);
soundfile.amp(amplitude);
}
I should mention that other than no sound, in Android mode, the apps work fine. I've been using the Sound library for months in Android mode with no issues until my recent use of the SDK Updater in Processing for Android.
Can you help me?
The text was updated successfully, but these errors were encountered: