Can Basic4Android be used to create music-related apps?

Discussion in 'Android Questions' started by karmacomposer, Jan 24, 2011.

  1. karmacomposer

    karmacomposer Member Licensed User

    Is there a way to create music/audio apps using Basic4Android?

    I create virtual instruments for windows (synthedit) and would LOVE to create some music/instrument apps using this software for Android (especially for tablets).

    I have tons of samples I created. I wonder if you could use soundfont format? If not, I wonder how to map samples? Anyway, if someone could let me know if it's possible to create audio apps.

    I assume sliders, buttons and knobs can be used from Knobman (which I do use).

  2. Erel

    Erel Administrator Staff Member Licensed User

    I plan to add support for the JetPlayer features: JetPlayer | Android Developers
    You will then be able to use the Jet Creator tool that comes with the Android SDK to create the content.
  3. karmacomposer

    karmacomposer Member Licensed User

    Great! Any idea on the ETA?

  4. Erel

    Erel Administrator Staff Member Licensed User

    Several weeks I believe...
  5. karmacomposer

    karmacomposer Member Licensed User

    Thank you very much.

    As long as I can get my hands on the jet player and virtual instrument, it will be exactly what I need to create music apps.

    My 1st app (once I have the swing of things) will be more of a multi-channel acid-pro like program where you can combine loops to make tunes.

    My second one will revolve around synthesis/rompler instruments and allow you to play it with an on-screen keyboard.

    Eventually, I want to create something similar to Nanostudio (on the iphone) for Android.

  6. James Moxham

    James Moxham Member Licensed User

    Hi Erel,

    I've done some research on audio and found a very good summary here | Intro to the three Android Audio APIs

    The API that does all the raw audio is "audiotrack". The description of the API is here AudioTrack | Android Developers and it looks perfect for things like games where you want to play short audio files with the minimum latency, and also build up an audio file in an array using math to create sine/square/triangle/sawtooth and even fancy things like additive synthesis using sine waves.

    Is this API something that would be hard to port to Basic4Android?

    And just a general question - that Java code looks almost identical to the code you would use in Basic. Rather than wait until you port an API into Basic, is it possible to talk to the Java code directly using this method Basic4android - Reflection
  7. ZJP

    ZJP Active Member Licensed User

    +1 for AudioTrack. Powerfull :sign0060:

  8. Erel

    Erel Administrator Staff Member Licensed User

    Thank you for pointing this.
    It shouldn't be difficult to port it to Basic4android.

    Basic4android v1.2 which will include support for services and static code modules will probably be released next week (at least a beta version). Afterward I will look into this library.

    The Reflection library is perfect for accessing some missing methods. It will not be simple to use it instead of a library. It will be easier to write the library.
  9. Bob Katayama

    Bob Katayama Member Licensed User

    This is great news. JetPlayer supports MIDI files thus in combination with the existing serial support, MIDI control and sequencer type apps should be possible via Basic4Android down the road.

    I am also looking forward to anyone that has suggestions or useful code snippets to help create a virtual synth type of application. In the end though, a virtual synth or sampled synth module that can be used to create various applications would be the way to go.

  10. Erel

    Erel Administrator Staff Member Licensed User

    So for the audio-challenged people, what are the differences between JetPlayer and AudioTrack?
  11. Bob Katayama

    Bob Katayama Member Licensed User

    My understanding is that the AudioTrack provides basic audio playback support of actual sound files only. JetPlayer supports MIDI files which is not an actual audio file but a reference file that instructs the software how to play the sound and what sound processes to use. No encoded sound in the MIDI file itself.

    By utilizing typical MIDI file support, you can load and access 16 or more MIDI tracks which references individual sound files for playback in each track. Audiotrack handles only one audio source.

    Also, JetPlayer itself has more flexibility on how the output is manipulated. For example, selecting a section of the sound as a clip allows you to play the clip once or looped.

    Last edited: Jan 26, 2011
  12. karmacomposer

    karmacomposer Member Licensed User

    Jetplayer also includes a virtual instrument, so sound-design developers like myself can use it to create a sound library for Android. Known as a rompler, the Jetplayer will allow you to load in samples and then convert that to a Android-readable file, complete with definitions of how and when to use the sounds.

    I have a large library of sounds that I have created over the years and I would love to port them and new sounds to a sound app for Android to compete with iPhone apps with similar functionality.

    I do plan to also create some virtual instruments/apps that will allow for sound and perhaps even image synthesis.

    This is all very exciting.

    My take is that the more audio possibilities you build into basic4android, the better. In the end, the most important thing is latency and memory management - the least amount of latency possible so sounds play immediately and memory management so you can add more sounds and play them simultaneously without causing distortion due to buffer errors (or the buffer being to small/large).

    Audiotrack sounds perfect for building an app like Acid where you playback multiple tracks of audio.

    JetPlayer sounds perfect for creating virtual instruments and sample playback apps (that I would also add synthesis to).

  13. ZJP

    ZJP Active Member Licensed User

    With AudioTrack
  14. Jim Brown

    Jim Brown Active Member Licensed User

    I look forward to the JetPlayer implementation
    Some time ago I created a fun little "Tracker" for my old LG (written in J2ME)
    It allowed users to tap on a grid to set/clear notes, similar to how a midi-tracker works. All good fun at the time

    Has anyone played with an app called Robotic Guitarist? The electric guitar sound in that app is really sweet but I cannot determine whether the the author uses MIDI
  15. karmacomposer

    karmacomposer Member Licensed User

    From what I read and based on complaints, it is more than likely sample-based.

  16. Bob Katayama

    Bob Katayama Member Licensed User

    I am looking forward to seeing some cool Basic4Android apps created with the JetPlayer implimentaton. This will certainly inspire me to create my own sound related application.
  17. James Moxham

    James Moxham Member Licensed User

    Audiotrack vs Jetplayer? I think a good synth needs both.

    You need midi if you want to play midi files, and there are libraries of these that have been around for years. So if you have a favourite piece of music and it is in midi and you want to change the instrument that will be easy to do.

    Audiotrack will be useful for editing the sound of the instruments and creating new instruments.

    Is it much work porting an existing API into Basic4Android? Is there anything we can do to help? :)
  18. etLux

    etLux Member Licensed User

    As a complete novice with Android but one with a good
    deal of experience in audio engineering... may I ask
    what we might have to work with in the way of effects?

    Reverb particularly is crucially important to anything
    involving sound production.


    David Sosnowski
    The Music of David Sosnowski
  19. karmacomposer

    karmacomposer Member Licensed User

    More than likely, you will have to write the effects yourself. However, the math already exists. I would Google for visual basic code for effects.

  20. James Moxham

    James Moxham Member Licensed User

    It looks like reverb has been done. PresetReverb | Android Developers

    Not sure about other effects.

    I was very pleased when I found a simple loop in Android4Basic executes nearly a million instructions a second. That might be fast enough for real time audio processing. Reverb would be a virtual delay line in a circular buffer with some values being added to other values. Then output via audiotrack?

    It would be fun to do some other mathematical transforms as well, eg a ring modulator, phasing, waa waa, digital filters.