# Sound Library not funtioning in Android mode

**URL:** <https://discourse.processing.org/t/sound-library-not-funtioning-in-android-mode/11984>\
**Category:** Processing for Android\
**Created:** [June 11, 2019, 1:11am UTC](https://discourse.processing.org/t/sound-library-not-funtioning-in-android-mode/11984 "2019-06-11T01:11:50Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![markcosmic](https://avatars.discourse-cdn.com/v4/letter/m/ecc23a/32.png) [@markcosmic](https://discourse.processing.org/u/markcosmic)\
**Post date:** [June 11, 2019, 1:11am UTC](https://discourse.processing.org/t/sound-library-not-funtioning-in-android-mode/11984/1 "2019-06-11T01:11:50Z")

</div>

Since doing the recent SDK update in Processing for Android:

| google usb\_driver | 11.0.0 | |
| --- | --- | --- |
| Android SDK Build-Tools | 26.0.2 | |
| Google APIs Intel x86 Atom System Image | 14 | |
| Android SDK Platform 26 | 2 | |
| Android SDK Build-Tools | 26.0.3 | |
| Android SDK Tools | 26.1.1 | |
| Android SDK Platform-Tools | 29.0.0 | |

The Sound Library is no longer functioning. 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 a new PC and received the same error.  
Anyone have any ideas

---

<div class="post-metadata">

**Author:** ![akenaton](https://avatars.discourse-cdn.com/v4/letter/a/a88e4f/32.png) [@akenaton](https://discourse.processing.org/u/akenaton)\
**Post date:** [June 11, 2019, 5:27pm UTC](https://discourse.processing.org/t/sound-library-not-funtioning-in-android-mode/11984/2 "2019-06-11T17:27:06Z")

</div>

@markcosmic === are permissions ok (runtime) ???

---

<div class="post-metadata">

**Author:** ![kfrajer](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kfrajer/32/196_2.png) [@kfrajer](https://discourse.processing.org/u/kfrajer)\
**Post date:** [June 11, 2019, 7:04pm UTC](https://discourse.processing.org/t/sound-library-not-funtioning-in-android-mode/11984/3 "2019-06-11T19:04:18Z")

</div>

Please provide a code snippet or any links that you are following. I am interested to know if you are referring to the Sound Library offered in Java or are you using any other resource.

Kf

---

<div class="post-metadata">

**Author:** ![markcosmic](https://avatars.discourse-cdn.com/v4/letter/m/ecc23a/32.png) [@markcosmic](https://discourse.processing.org/u/markcosmic)\
**Post date:** [June 11, 2019, 7:04pm UTC](https://discourse.processing.org/t/sound-library-not-funtioning-in-android-mode/11984/4 "2019-06-11T19:04:22Z")

</div>

I have set the audio record permissions, but my app doesn’t record. It only plays a couple of .wav files. The app was working. The audio play back was working for the several months I’d been coding and testing it. Since the update I mentioned, using processing.sound.\*, does not seem to be functioning in Android mode. I tried it on 2 different windows 10 PCs

---

<div class="post-metadata">

**Author:** ![kfrajer](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kfrajer/32/196_2.png) [@kfrajer](https://discourse.processing.org/u/kfrajer)\
**Post date:** [June 11, 2019, 7:06pm UTC](https://discourse.processing.org/t/sound-library-not-funtioning-in-android-mode/11984/5 "2019-06-11T19:06:50Z")

</div>

Ok, please provide snippet including the recording part and I could try to repro as I have a Win 10 machine as well.

Kf

---

<div class="post-metadata">

**Author:** ![markcosmic](https://avatars.discourse-cdn.com/v4/letter/m/ecc23a/32.png) [@markcosmic](https://discourse.processing.org/u/markcosmic)\
**Post date:** [June 11, 2019, 7:44pm UTC](https://discourse.processing.org/t/sound-library-not-funtioning-in-android-mode/11984/6 "2019-06-11T19:44:56Z")

</div>

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

But in Android mode gave the error I mentioned at the beginning of this topic.

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

---

<div class="post-metadata">

**Author:** ![markcosmic](https://avatars.discourse-cdn.com/v4/letter/m/ecc23a/32.png) [@markcosmic](https://discourse.processing.org/u/markcosmic)\
**Post date:** [June 11, 2019, 7:49pm UTC](https://discourse.processing.org/t/sound-library-not-funtioning-in-android-mode/11984/7 "2019-06-11T19:49:36Z")

</div>

I for got to add, that I get no sound from the emulator or the 2 devices I tried it on

---

<div class="post-metadata">

**Author:** ![markcosmic](https://avatars.discourse-cdn.com/v4/letter/m/ecc23a/32.png) [@markcosmic](https://discourse.processing.org/u/markcosmic)\
**Post date:** [June 11, 2019, 8:38pm UTC](https://discourse.processing.org/t/sound-library-not-funtioning-in-android-mode/11984/8 "2019-06-11T20:38:01Z")

</div>

My app does not record audio. Only playback sounds. Not coded to record.  
It’s quite odd the error refers to audio recording

---

<div class="post-metadata">

**Author:** ![TonyC](https://avatars.discourse-cdn.com/v4/letter/t/cdc98d/32.png) [@TonyC](https://discourse.processing.org/u/TonyC)\
**Post date:** [July 16, 2019, 6:10pm UTC](https://discourse.processing.org/t/sound-library-not-funtioning-in-android-mode/11984/9 "2019-07-16T18:10:39Z")

</div>

Hello, I discovered the library Cassette which works very well to play sound file. It can be downloaded in the processing editor.
