C cmartins Member Licensed User Longtime User Jan 25, 2012 #1 Hi All How can I run 2 different audios at the same time. I tried it but all the time when I load the last file or a beep the first file loaded stop. Last edited: Jan 25, 2012
Hi All How can I run 2 different audios at the same time. I tried it but all the time when I load the last file or a beep the first file loaded stop.
stevel05 Expert Licensed User Longtime User Jan 26, 2012 #2 What exactly have you tried, can you post some code so we don't have to start from scratch and know which libraries you are looking at. Upvote 0
What exactly have you tried, can you post some code so we don't have to start from scratch and know which libraries you are looking at.
C cmartins Member Licensed User Longtime User Jan 26, 2012 #3 steve, thank you for your attention Work fine using this post http://www.b4x.com/forum/additional-libraries-official-updates/7624-audio-library-v0-9-a.html Upvote 0
steve, thank you for your attention Work fine using this post http://www.b4x.com/forum/additional-libraries-official-updates/7624-audio-library-v0-9-a.html
C cmartins Member Licensed User Longtime User Jan 26, 2012 #4 My application use around 100 litte wave file to inform the speed that vehicle should run (1 km/h to 85km/h) and other advises. can I load all WAV files in soundspool and play when the application ask or load and play the WAV file and after use unload? Upvote 0
My application use around 100 litte wave file to inform the speed that vehicle should run (1 km/h to 85km/h) and other advises. can I load all WAV files in soundspool and play when the application ask or load and play the WAV file and after use unload?
joseluis Active Member Licensed User Longtime User Jan 26, 2012 #5 I've succesfully loaded 250 ogg files (3 MB total) into memory, and play several of them at the same time using soundpool, unloading them, playing another bunch, etc. Upvote 0
I've succesfully loaded 250 ogg files (3 MB total) into memory, and play several of them at the same time using soundpool, unloading them, playing another bunch, etc.
joseluis Active Member Licensed User Longtime User Jan 26, 2012 #6 This is an example. If you have 100 sounds under ./Files/snd/ named sound1.wav, sound2,wav ... sound99.wav, then: Code: Copy Dim soundsLoaded(100) As Int ' IDs of loaded sounds Dim SP As SoundPool ' SoundPool Object SP.Initialize(16) ' Max number of sounds in soundpool playing sametime soundsPlaying(16) As Int ' Here are stored the IDs of the sounds playing, so we can stop them Do While (i < 100) filename = "sound" & i & ".wav" soundsLoaded(i) = SP.Load(File.DirAssets, "subfolder/" & soundname ) i = i + 1 Loop And: Code: Copy ' To play a sound soundsPlaying(0) = SP.Play(soundsLoaded(x), 1, 1, 1, 0, 1) ' To stop a sound SP.Stop(soundsPlaying(X)) ' X should be a number from 0 to 15, in this case ' To stop all sounds For n = 0 To 16 SP.Stop(soundsPlaying(X)) Next Upvote 0
This is an example. If you have 100 sounds under ./Files/snd/ named sound1.wav, sound2,wav ... sound99.wav, then: Code: Copy Dim soundsLoaded(100) As Int ' IDs of loaded sounds Dim SP As SoundPool ' SoundPool Object SP.Initialize(16) ' Max number of sounds in soundpool playing sametime soundsPlaying(16) As Int ' Here are stored the IDs of the sounds playing, so we can stop them Do While (i < 100) filename = "sound" & i & ".wav" soundsLoaded(i) = SP.Load(File.DirAssets, "subfolder/" & soundname ) i = i + 1 Loop And: Code: Copy ' To play a sound soundsPlaying(0) = SP.Play(soundsLoaded(x), 1, 1, 1, 0, 1) ' To stop a sound SP.Stop(soundsPlaying(X)) ' X should be a number from 0 to 15, in this case ' To stop all sounds For n = 0 To 16 SP.Stop(soundsPlaying(X)) Next
C cmartins Member Licensed User Longtime User Jan 27, 2012 #7 all that I need thank you very much! Upvote 0
C cmartins Member Licensed User Longtime User Jan 27, 2012 #8 joseluis said: I've succesfully loaded 250 ogg files (3 MB total) into memory, and play several of them at the same time using soundpool, unloading them, playing another bunch, etc. Click to expand... Joseluis what kind of files can we use with soundpool? I tried open ogg files but it doesnt work Upvote 0
joseluis said: I've succesfully loaded 250 ogg files (3 MB total) into memory, and play several of them at the same time using soundpool, unloading them, playing another bunch, etc. Click to expand... Joseluis what kind of files can we use with soundpool? I tried open ogg files but it doesnt work
joseluis Active Member Licensed User Longtime User Jan 27, 2012 #9 In theory: Android Supported Media Formats | Android Developers But there are some complains by people who find it too 'picky' with certain files or compression settings. FWIW, I created the ogg files with sox in linux, they don't occupy more than 30kbs, lasting a few seconds each. Upvote 0
In theory: Android Supported Media Formats | Android Developers But there are some complains by people who find it too 'picky' with certain files or compression settings. FWIW, I created the ogg files with sox in linux, they don't occupy more than 30kbs, lasting a few seconds each.
C cmartins Member Licensed User Longtime User Jan 28, 2012 #10 joseluis forgot my mystake. I tried to open before initialize thank you again Upvote 0