Reputation: 107
I want to convert matlab code to C code using MATLAB coder, but is doesn't work well.
I tried to below matlab code .. and build using MATLAB coder
function example()
recObj = audiorecorder(44100,16,1);
disp('Start speaking.');
recordblocking(recObj, 5);
disp('End of Recording.');
play(recObj);
But there are some errors. like..
coder -build ex1.prj ??? The 'audiorecorder' class does not support code generation.
Error in ==> example Line: 2 Column: 10
Code generation failed: Open error report.
so, I tried to delete audiorecorder function, but it didn't work also.
I don't know What problem in these code. How do I do? Please help.
Upvotes: 0
Views: 618
Reputation: 1928
It may not be helpful for deploying to Android, but there is the dsp.AudioRecorder System Object that supports C code generation and allows for some audio recording. The resulting code can be run on systems where MATLAB is installed.
Another option is to write your computational algorithm in MATLAB Coder compliant code and do the audio capture, user interaction and the like using Android APIs. You could then just pass the captured audio data to the generated native code for processing. I've seen a similar approach taken with image processing where the Android API was used to capture images which were then sent to C code generated with MATLAB Coder for processing.
Upvotes: 1