1
I want to program sounds on Android but I’m not getting it. I tried the java sound API but Android studio doesn’t recognize it. I want to use MIDI as well. I know you have the package android.media.midi but it only works for versions of android above 23. I want a solution for all versions. Can someone help me?
Thank you all very much for your attention. The code of what I want to do follows below:
ShortMessage myMsg = new ShortMessage();
// Play the note Middle C (60) moderately loud
// (velocity = 93)on channel 4 (zero-based).
myMsg.setMessage(ShortMessage.NOTE_ON, 4, 60, 93);
Synthesizer synth = null;
synth = MidiSystem.getSynthesizer();
Receiver synthRcvr = null;
synthRcvr = synth.getReceiver();
synthRcvr.send(myMsg, -1); // -1 means no time stamp
I mean, I want to edit MIDI messages. What I don’t understand is why Android Studio doesn’t recognize the Java Sound API (which I’m using). Does anyone know? Oi Márcio Oliveira. About the library you posted I think it is incomplete. There is, for example, the file Shortmessage.java.
See if this is what you’re looking for: How to play a sound using Mediaplayer? and How to play sound on android
– ramaral
@Hello, you can post what you’ve tried to do ?
– David
You want to play files mid or wants to use/control devices midi connected to an Android device?
– ramaral
If you specify what you need better, maybe I can help you synthetically create the audios you need without the need to use lib, but "programming sounds for android" is very vague :-(
– ederwander