With help from the contributors on the libpd github page, I found out the cause(s) for the no mic input issue...
Firstly, my targetsdkversion was API 23. As pointed out:
"Requesting permissions in API 23+ is something that needs to be done in the app itself, not in the pd-for-android library."
So I changed the target sdk version to 22.
Additionally, I had not added permission to my manifest to use the microphone. So adding this line to the Androidmanifest:
<uses-permission android:name="android.permission.RECORD_AUDIO" />
Finally, I forgot to change the number of input channels from 0 when changing the source source from a osc~ to adc~. So my initPD method now looks like:
int sampleRate = AudioParameters.suggestSampleRate();
int inpch = AudioParameters.suggestInputChannels();
PdAudio.initAudio(sampleRate, inpch, 2, 8, true);
I'm trying to do a simple talk-through using libpd with android studio.
adc~ -> *~ 0.5 -> dac~
However, I do not have an android phone, so I'm using an Android Studio emulator (Nexus 4, api 23).
I can't get any input from my laptop microphone (or from my earphones built-in microphone when I try that).
Is there something I'm missing?
I know when using Record_Audio directly in Android studio, you need to add permission.
Is my issue something along these lines?
Or is it a limitation with using emulators?
I've read many questions on forums about it, but not many are recent and there seems to be many conflicting answers also.
All the best
I realise this is a very specific question which may not be of use to many others, however I am at my wits end with the issue at hand.
I am designing a parametric EQ based on the Biquad EQ equations by Robert Bristow-Johnson. The filter works perfectly and using the audio example "measurement" with PD, I have the patch plotting the mag & phase response to prove the filter is working as desired.
My issue is, the patch throws out "stack overflow" warnings when the patch loads and any time any of the freq, Q or gain parameters is changed and I can't figure out why.
I intend to use libpd to use this patch with Android, I so would like the patch to be working without fault before attempting to use it with libpd and Android studio.
The "FilterTestBench.pd" patch is top level patch.
I have tried different ways of banging in the different values in different orders in case that was the issue, but haven't found a solution yet.
Any suggestions, help or experience with similar issues would be greatly appreciated.
Thanks for your help..
I've managed to get the equation working based on when the velocity exceeds a certain value. A bang sends when the velocity goes over a certain value.
My issue now is that, it bangs multiple times when the slider (stick) is going downward as the velocity stays above the specified value for multiple metro bangs, hence banging the sound sample multiple times,
I reckon I need to find a way to obtain acceleration values as opposed to velocity, your code for triggering when going from negative to plus would work perfectly then!!
But I haven't found much nor can I get my head around differentiating the velocity value to obtain an acceleration value.
I'm attempting to build a patch which triggers a sound when a change in direction of acceleration occur. I hope to use Kinect with Synapse to track the movement of my hand (lets say just on y-axis). I want to trigger a bang when my hand changes sign of acceleration from a downward velocity to an upward velocity (mimicking a drumstick striking a drum for example).
My current thought process is to set a very quick metro (1ms) and detect change in y-axis position. for example..
y_change = y(t) - y(t+1)...
If the hand is moving downward, y_change will be a negative value.. If the hand begins to move upward y_change becomes a positive value! Essentially, I want to trigger a bang whenever the y_change value goes from negative to positive.
I am wondering if this train-of-thought is the right way to approach the task or if there are better options?
Also, the drawback with this approach is, I would like to quantify the speed at which the sign of velocity occurs, with high velocity corresponding to loud.. Low velocity corresponding to soft. Any ideas? My worry is this begins to incorporate Physical Modelling aspects which significantly increases the complexity of the project.
Thanks in advance for any suggestions/help!