Can Gideros use a microphone plugin and record a sound then detect it's volume and use it? I know there is a plugin for the microphone, but I don't really know how to use it yet, and I want to know first what it can do before diving into it.
and from there is seem yes, you create Microphone instance, and listen to event and event shows amplitude, if microphone hears anything and then you can start to record sounds.
@ar2rsawseen I can't figure this out :-(( Is it even possible to constantly record while the app is running and print the volume every couple of milliseconds? If so, can you give an example? [-O< [-O< [-O<
well, you can try, it would look something like this:
require("microphone")--create microphone instance with default valueslocal mic = Microphone.new(nil, 4000, 1, 8)--set where the file will be stored
mic:setOutputFile("|D|test.wav")--set up and event and print out the values
mic:addEventListener(Event.DATA_AVAILABLE, function(e)print(e.peakAmplitute, e.averageAmplitute)end)--start recording
mic:start()--yell in the mic and see if there is anything printing out--and after some time or on some event, drop the mic <img class="emoji" src="https://forum.gideros.rocks/resources/emoji/smile.png" title=":)" alt=":)" height="20" />
Timer.delayedCall(1000, function()
mic:stop()end)
main.lua:2: attempt to index global 'Microphone'(a nil value)
The same error I got yesterday when I tried to play with this plugin... I checked the plugin folder, everything is there and I'm running the latest gideros version on Windows... Please tell me I am doing something wrong...
@ar2rsawseen It works on PC but I get this error when I try to run the app on the phone:
Uploading finished.
main.lua:2: module 'microphone'not found:
no field package.preload['microphone']
no file './microphone.lua'
no file '/usr/local/share/lua/5.1/microphone.lua'
no file '/usr/local/share/lua/5.1/microphone/init.lua'
no file '/usr/local/lib/lua/5.1/microphone.lua'
no file '/usr/local/lib/lua/5.1/microphone/init.lua'
no file './microphone.so'
no file '/usr/local/lib/lua/5.1/microphone.so'
no file '/usr/local/lib/lua/5.1/loadall.so'
stack traceback:
main.lua:2: in main chunk
Yes, as per docs you need to add microphone plugin. Plugin files should be in Gideros installation/All Plugins/Microphone/Android So export your app and modify Android project:
Copy bin/Android/* to libs directory. Copy source/com/* to your project. Add System.loadLibrary("microphone"); to your main Activity. Add "com.giderosmobile.android.plugins.GMicrophone" to externalClasses array. Add android.permission.RECORD_AUDIO permission to your AndroidManifest.
So I went back to work on this project and I did everything as instructed, but it does not work. And also I do not get any errors. I'm pretty sure I mess something up with the folders. Here is where I get confused at. I go to Gideros installation/All Plugins/Microphone/ but there is no Android folder in there, just bin and source. The bin folder contains an "Android" folder which then contains a "libs" and a "src" folder... Do I copy both to libs directory in my project overlapping the existing ones? :-/
@ar2rsawseen Can you give me some step by step instructions on which folders to copy and where to paste them more exactly? (because I get confused at the first 2 instructions you gave me, but did everything else right,I suppose). I apologize because this is such a dumb question on my side, but after I get this answer I wont bother anyone a while ) Please answer as soon as possible, I really need to fix this issue asap. Thank you!
@misterhup did you manage to get microphone plugin working on Android? I did as @ar2rsawseen said, and even if I don't get any error from eclipse, my device is not able to use its microphone.
Comments
But microphone plugin should be available out of the box with Gideros desktop player (plugin already installed with latest release)
and docs are here:
http://docs.giderosmobile.com/reference/plugin/Microphone#Microphone
and from there is seem yes, you create Microphone instance, and listen to event and event shows amplitude, if microphone hears anything and then you can start to record sounds.
Likes: misterhup
Likes: rolfpancake
Plugin files should be in Gideros installation/All Plugins/Microphone/Android
So export your app and modify Android project:
Copy bin/Android/* to libs directory.
Copy source/com/* to your project.
Add System.loadLibrary("microphone"); to your main Activity.
Add "com.giderosmobile.android.plugins.GMicrophone" to externalClasses array.
Add android.permission.RECORD_AUDIO permission to your AndroidManifest.
Likes: rolfpancake
Please answer as soon as possible, I really need to fix this issue asap. Thank you!
Copy bin/Android/libs/* to libs directory.
Copy bin/Android/src/* to src directory.
That is for eclipse though. I always forget about Android Studio, as I'm not using it
http://giderosmobile.com/forum/discussion/comment/43090#Comment_43090
Copy bin/Android/libs/* to app\src\main\jniLibs directory.
Copy bin/Android/src/* to app\src\main\java directory.
I did as @ar2rsawseen said, and even if I don't get any error from eclipse, my device is not able to use its microphone.
thank you
android.permission.RECORD_AUDIO
thank you