Feb 1, 2011 Replies: 17 Edit: V0.91 is available with support for SoundPool. SoundPool allows you to load many short sounds and then play those files with low latency. A short example is also attached. The first version of the Audio library is available. This is a beta version and it includes support for JetPlayer. See this link for more information about JetPlayer: SONiVOX JETCreator User Manual | Android Developers A short example which plays the JET file that is included in the Android SDK is available here: http://www.b4x.com/android/files/AudioExample.zip Installation instructions: Unzip the attach file and copy both files to the Additional Libraries path or the internal libraries path: C:\Program Files\Anywhere Software\Basic4android\Libraries. Attachments Audio.zip Audio.zip 6.9 KB · Views: 1,459 SoundPoolExample.zip SoundPoolExample.zip 52.6 KB · Views: 1,985 Click to expand...
Edit: V0.91 is available with support for SoundPool. SoundPool allows you to load many short sounds and then play those files with low latency. A short example is also attached. The first version of the Audio library is available. This is a beta version and it includes support for JetPlayer. See this link for more information about JetPlayer: SONiVOX JETCreator User Manual | Android Developers A short example which plays the JET file that is included in the Android SDK is available here: http://www.b4x.com/android/files/AudioExample.zip Installation instructions: Unzip the attach file and copy both files to the Additional Libraries path or the internal libraries path: C:\Program Files\Anywhere Software\Basic4android\Libraries.
J James Moxham Member Licensed User Longtime User Feb 1, 2011 #2 This is very good. Compiled and playing some sounds while I type this. A few questions: 1) I had to change one line to Code: JP.LoadFile("/sdcard", "level1.jet") and manually copy the file to the sd card. Is there a way of including "level1.jet" as part of the compilation process and sending it over at the same time? Or is it indeed better to put these large files on an sd card to save filling up the memory of the Android? 2) My display is blank. But touching various parts of the display plays different sounds. I gather the graphics parts of programs are separate. Maybe I didn't install that bit? 3) Is it possible to edit an instrument from within code? Specifically, to create an array of 16 bit integer data as in the raw data used in a .wav file, and then to play this as an instrument without saving the data to disk? I'm thinking of playing 2400 baud data files. Also, I'm thinking of doing some direct digital synthesis by adding sine waves and it would be cool to play the sounds and then tweak the harmonic weights. Or is the jet player more a midi player than a synth? I think you said there was another audio device on the way soon. It sure is great to be able to play sounds this easily. This really will add to any games one might want to write! Thanks Erel.
This is very good. Compiled and playing some sounds while I type this. A few questions: 1) I had to change one line to Code: JP.LoadFile("/sdcard", "level1.jet") and manually copy the file to the sd card. Is there a way of including "level1.jet" as part of the compilation process and sending it over at the same time? Or is it indeed better to put these large files on an sd card to save filling up the memory of the Android? 2) My display is blank. But touching various parts of the display plays different sounds. I gather the graphics parts of programs are separate. Maybe I didn't install that bit? 3) Is it possible to edit an instrument from within code? Specifically, to create an array of 16 bit integer data as in the raw data used in a .wav file, and then to play this as an instrument without saving the data to disk? I'm thinking of playing 2400 baud data files. Also, I'm thinking of doing some direct digital synthesis by adding sine waves and it would be cool to play the sounds and then tweak the harmonic weights. Or is the jet player more a midi player than a synth? I think you said there was another audio device on the way soon. It sure is great to be able to play sounds this easily. This really will add to any games one might want to write! Thanks Erel.
Erel B4X founder Staff member Licensed User Longtime User Feb 2, 2011 #3 1. You can include your file (assuming it is not more than a few mb) in the Files tab in the right pane. Then you can access it an in my code: JP.LoadFile(File.DirAssets, "level1.jet") 2. There is no display for this demo. I used the Activity_Click event to change the segment: Code: Sub Activity_Click JP.ClearQueue JP.QueueSegment(1, 0, 0, Rnd(-12, 13), mute, SegmentId) SegmentId = SegmentId + 1 JP.Play End Sub 3) This is not supported by JetPlayer.
1. You can include your file (assuming it is not more than a few mb) in the Files tab in the right pane. Then you can access it an in my code: JP.LoadFile(File.DirAssets, "level1.jet") 2. There is no display for this demo. I used the Activity_Click event to change the segment: Code: Sub Activity_Click JP.ClearQueue JP.QueueSegment(1, 0, 0, Rnd(-12, 13), mute, SegmentId) SegmentId = SegmentId + 1 JP.Play End Sub 3) This is not supported by JetPlayer.
C Cor Active Member Licensed User Longtime User Feb 2, 2011 #4 Where can I download the SONiVOX JET Creator? See only python download on the android info site
Erel B4X founder Staff member Licensed User Longtime User Feb 2, 2011 #5 It is included in the Android SDK: C:\Program Files (x86)\Android\android-sdk-windows\tools\Jet\JetCreator
It is included in the Android SDK: C:\Program Files (x86)\Android\android-sdk-windows\tools\Jet\JetCreator
Erel B4X founder Staff member Licensed User Longtime User Feb 2, 2011 #6 V0.91 is available in the first post with support for SoundPool.
J James Moxham Member Licensed User Longtime User Feb 2, 2011 #7 Very nice! The Soundpool description is here SoundPool | Android Developers Is there any chance (please!) of doing audiotrack as well? http://developer.android.com/reference/android/media/AudioTrack.html Last edited: Feb 2, 2011
Very nice! The Soundpool description is here SoundPool | Android Developers Is there any chance (please!) of doing audiotrack as well? http://developer.android.com/reference/android/media/AudioTrack.html
Erel B4X founder Staff member Licensed User Longtime User Feb 3, 2011 #8 I actually started working on AudioTrack. However I found too many evidence of it being too buggy to be used. Here is one: Android Audio: Problems, Hidden Limitations and OpenSL ES Mind The Robot I may add it in the future.
I actually started working on AudioTrack. However I found too many evidence of it being too buggy to be used. Here is one: Android Audio: Problems, Hidden Limitations and OpenSL ES Mind The Robot I may add it in the future.
J James Moxham Member Licensed User Longtime User Feb 3, 2011 #9 Interesting reading. I agree it would not be good to include code that has bugs otherwise Basic4Android would get blamed for those bugs.
Interesting reading. I agree it would not be good to include code that has bugs otherwise Basic4Android would get blamed for those bugs.
Highwinder Active Member Licensed User Longtime User Sep 4, 2012 #10 SoundPool Limitations Erel, What is the maximum length (time? size?) that a sound file can be that SoundPool will play? Thanks
SoundPool Limitations Erel, What is the maximum length (time? size?) that a sound file can be that SoundPool will play? Thanks
Erel B4X founder Staff member Licensed User Longtime User Sep 4, 2012 #11 The documentation of the native SoundPool does not mention any limits. According to some sites the limit size is 1mb: Android Audio: Problems, Hidden Limitations and OpenSL ES « Mind The Robot Some older devices had issues with formats other than OGG.
The documentation of the native SoundPool does not mention any limits. According to some sites the limit size is 1mb: Android Audio: Problems, Hidden Limitations and OpenSL ES « Mind The Robot Some older devices had issues with formats other than OGG.
Rusty Well-Known Member Licensed User Longtime User Jan 18, 2013 #12 Does this allow one to play a sound track and during its play, to be able to insert or play another track and then resume. Example: Sound track one, speaking: "Hello, my name is " Sound track two, speaking: "Rusty. " Sound track one (continuing or sound track three): "What is your name?" Thanks, Rusty
Does this allow one to play a sound track and during its play, to be able to insert or play another track and then resume. Example: Sound track one, speaking: "Hello, my name is " Sound track two, speaking: "Rusty. " Sound track one (continuing or sound track three): "What is your name?" Thanks, Rusty
Erel B4X founder Staff member Licensed User Longtime User Jan 18, 2013 #13 Yes. SoundPool allows you to play multiple tracks at once. You can also use multiple MediaPlayer objects.
Yes. SoundPool allows you to play multiple tracks at once. You can also use multiple MediaPlayer objects.
Rusty Well-Known Member Licensed User Longtime User Apr 19, 2013 #14 Thanks Erel, How can one load three (for example) sound tracks, play the first and then immediately play the second and then immediately play the third, without any latency? Rusty
Thanks Erel, How can one load three (for example) sound tracks, play the first and then immediately play the second and then immediately play the third, without any latency? Rusty
Erel B4X founder Staff member Licensed User Longtime User Apr 19, 2013 #15 Note that it is better to start a new thread for new questions. You will need to use a timer to start the next sound track each time.
Note that it is better to start a new thread for new questions. You will need to use a timer to start the next sound track each time.
Rusty Well-Known Member Licensed User Longtime User Apr 19, 2013 #16 Sorry Erel. I thought I was continuing exactly the same question. Regards, Rusty
Fusseldieb Active Member Licensed User Longtime User Dec 6, 2014 #17 I have put the "Rate" to 0.05 on Erels example with "bounce.wav"... It sound like a horror movie xD Btw, "Rate" goes from "0" to "2", but I have tested with "10", "40", "50", etc. and it plays just fine. I'm using Android 5.0, but is there any compatibilty issue when I use eg. "30" with older devices?
I have put the "Rate" to 0.05 on Erels example with "bounce.wav"... It sound like a horror movie xD Btw, "Rate" goes from "0" to "2", but I have tested with "10", "40", "50", etc. and it plays just fine. I'm using Android 5.0, but is there any compatibilty issue when I use eg. "30" with older devices?
Erel B4X founder Staff member Licensed User Longtime User Dec 7, 2014 #18 Android documentation says that the value should be between 0.5 to 2.0. This is all we know...