Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
Microphone plugin doesn't record or play? — Gideros Forum

Microphone plugin doesn't record or play?

saeyssaeys Member
edited June 2016 in General questions
Hi all,
I'm kinda lost trying to iron out what's not working with the microphone plugin in my project.
The same behavior occurs on the microphone example project. It runs well in the windows Gideros player as well as when exported to an Android device via Android Studio. It SEEMS to record something (stop button replaces the record button), but when the play button is pressed it seems to playback an empty file, because the play button changes to 'stop' in an instance before changing back to 'play'. This happens in the exported app on an device.

No app crashes and no errors in the logcat. I think the plugin files are in place as well as the lines in the manifest and activity file. The thing is that the exact same project worked with no errors in previous exports before, but now all I can get is the above described behavior. Something must have changed in my environment, but I can't really figure out what it could be. Suggestions anyone?

Comments

  • saeyssaeys Member
    While searching for clues I'm also searching for the recorded .wav file on my device(s). Can't find it anywere, not even the specific app directory... :-(
  • saeyssaeys Member
    edited June 2016
    Just installed an old but working .apk on a device, so the problem isn't with the device. New, fresh exports still doesn't work.

    It is as if the output file
    microphone:setOutputFile("|D|record.wav")
    is only created, but I think no sound data is stored in it, since only an instant of a sound (e.g. nothing) is played at the lines
    recordSound = Sound.new("|D|record.wav")
    recordChannel = recordSound:play()
    I can't verify the sound file, since I can't find it in any directory in the device. But it's there, otherwise I guess the app would crash at play instead.

    Anyone?
  • piepie Member
    Hi @saeys I don't know if it's allowed to do that, I am wild guessing: to verify the file can you write it to "/sdcard/record.wav" ?
  • saeyssaeys Member
    edited June 2016
    Any wild guesses is highly appreciated! :)

    I can't find record.wav anywhere, especially not in sdcard root. Evidently, the app knows where it is, otherwise I guess the app would crash when it doesn't find what it's looking for, right?

    I put an empty record.wav in /sdcard/, no change.

    Does the |D| (or |T|) point to the sdcard root? Or to the app folder, which I also cannot find anywhere.
  • piepie Member
    Did you try
    recordSound = Sound.new("/sdcard/record.wav")
    ?
    As far as I know |D| |R| |T| point to the app folder, which I don't know how to locate on the device (on windows is somewhere inside AppData/Local...).

    I can tell you that using lfs module I can access /sdcard/ on android and C:\ on laptop: still keeping me in the wild guess side :) maybe you need to require lfs to use /sdcard/, but there is still the possibility that microphone plugin can't write to it.. %%-
  • saeyssaeys Member
    edited June 2016
    The app folders is located under /Android/data/ on sdcard and in internal storage, respectively. No sign of my app anywere there among all the other app folders, although it runs normally. Quite strange, in its own way.

    So if I want to be able to save a file on /sdcard/ i need the LFS module? I replaced the |D| with /sdcard/ in both setOutputFile() and sound.new(), same results. (No crash, just no recorded audio to play.)

    @pie, maybe your suggestion required the LFS module... Digging some on how to install that it seems a bit over my head just to test a workaround. :-< Especially as it worked well a couple of days ago, and I I'm having a hard time understanding what has happened to the code that could have affected the microphone behavior, specifically. I've reverted back to the microphone example and did the plugin installation from scratch (several times), same results.

    Thanks anyway for the suggestion, @pie. Do you or anyone else have any other ideas?
  • saeyssaeys Member
    Hey @pie, I noticed that you had some issues with the mic plugin in this thread: http://giderosmobile.com/forum/discussion/5803/microphone-plugin/p1

    Did you get it to work? If so, how?

    I had some problems putting the right plugin files in the right folder, but evidently got it to work eventually. Are there plugin files that has to go in any other places than mentioned in my final comment? (actually I don't think so, but I'm clutching for straws here... :-?? )
  • saeyssaeys Member
    Really sorry for bombing this thread like this, but I really need to get this plugin working again.

    I don't think anything is recorded at all. This is why:
    1. The mic example is exported and imported to Android studio.
    2. Compiled and run on my sony xperia z5 compact (or tablet z) with no errors.
    3. When hitting the record button, the level meter isn't indicating any incoming sound. (as it was before)
    4. Thus, when hitting play button there is no sound to play. Maybe it's playing a empty sound file, because it doesn't crash either.

    (when running mic example on the gideros player on windows record and playback is working fine)
  • piepie Member
    @saeys to load lfs you just need to
    require "lfs"
    Unfortunately I have no clue on what could have caused your issue, it seems like my issue with this plugin.. :D
    You were the lucky one who managed to use microphone on Android, I was waiting for the next release to try again :)
  • saeyssaeys Member
    edited June 2016
    Ah, I thought I needed to install other stuff (luarocks etc) to be able to use lfs. Ok thanks, I'll try that tomorrow, but I'm pessimistic because I think there is some change in configuration somewhere that causes the problem. Let's put our hopes in the next release... ;)
  • saeyssaeys Member
    edited July 2016
    Yeah, I was the lucky one, now I'm just as unlucky as you @pie, since it just stopped working. lfs didn't change anything, neither did this next gideros release. :((

    I think the problem is the microphone plugin, not the device's file system. There is no data recorded to put in the .wav that is saved. And I think it has to do with the libmicrophone.so, because there are two "missing JNI functions" at the end of GMicrophone.java. (onDataAvailableByte() and onDataAvailableShort() ). But that is as far as my skills goes...

    Help, anyone? :-<
  • saeyssaeys Member
    Back from my vacation...

    I cracked my nuckles, did an gideros export from scratch, copied the necessary mic plugin into the project, did some Android Studio updates, imported the project there, did the usual java and manifest modifications for the plugin, test run... And the microphone's in working order! >:D<

    I still have no idea why it wasn't working before, but it could of course have been the Android Studio updates. Still, the onDataAvailableByte() and onDataAvailableShort() mentioned before in GMicrophone.java is marked red ('Missing JNI functions'). I wonder if that will cause the same (or new) problems ahead...

    Are there any plans on microphone plugin updates, or, for that matter, an integrated plugin feature in gideros in the future?
  • ar2rsawseenar2rsawseen Maintainer
    I actually just commited microphon plugin installer for Android along with bunch of other installers

    and on preliminery run, did not see any issues, and functions are defined as always:
    https://github.com/gideros/gideros/blob/master/plugins/microphone/source/Android/jni/gmicrophone-android.cpp#L319-L334

  • saeyssaeys Member
    edited July 2016
    I'm very unfamiliar with github and how it works, but I'm glad you're working on plugin installers. Thank you @ar2rsawseen!

    Maybe the 'missing JNI functions' thing is an Android Studio issue. I haven't tried eclipse.

    Likes: antix

    +1 -1 (+1 / -0 )Share on Facebook
Sign In or Register to comment.