Can Basic4Android be used to create music-related apps?

karmacomposer

Member
Licensed User
Longtime 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).

Mike
 

karmacomposer

Member
Licensed User
Longtime 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.

Mike
 
Upvote 0

James Moxham

Member
Licensed User
Longtime User
Hi Erel,

I've done some research on audio and found a very good summary here Wiseandroid.com | 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
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Thank you for pointing this.
Is this API something that would be hard to port to Basic4Android?
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.
 
Upvote 0

Bob Katayama

Member
Licensed User
Longtime User
I plan to add support for the JetPlayer features:

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.

Bob
 
Upvote 0

Bob Katayama

Member
Licensed User
Longtime User
So for the audio-challenged people, what are the differences between JetPlayer and AudioTrack?

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.

Bob
 
Last edited:
Upvote 0

karmacomposer

Member
Licensed User
Longtime 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.

Bob

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).

Mike
 
Upvote 0

ZJP

Active Member
Licensed User
Longtime User
With AudioTrack
* Decoding audio from any format that is not supported by the platform
* Modifying or enhancing audio on the fly (such as applying distortion, vocoder, reverb effects – but you have to code them yourself!)
* Loading audio from custom sources to play it on the fly (but you have to deal with buffering and stability yourself – be sure not to develop another MediaPlayer!)
 
Upvote 0

Jim Brown

Active Member
Licensed User
Longtime 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
 
Upvote 0

karmacomposer

Member
Licensed User
Longtime 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

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

Mike
 
Upvote 0

Bob Katayama

Member
Licensed User
Longtime 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.
 
Upvote 0

James Moxham

Member
Licensed User
Longtime 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? :)
 
Upvote 0

etLux

Member
Licensed User
Longtime 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.

Best,


David
-----
David Sosnowski
The Music of David Sosnowski
 
Upvote 0

karmacomposer

Member
Licensed User
Longtime 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.

Best,


David
-----
David Sosnowski
The Music of David Sosnowski

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.

Mike
 
Upvote 0

James Moxham

Member
Licensed User
Longtime 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.
 
Upvote 0
Top