Midimaster Active Member Licensed User Jun 23, 2020 #1 I'm experimenting with AUDIO on Android, but I'm new with B4A. I fould a Recording and Playback example from Erel, which uses the AudioStreamer. It works perfect, but I have a question. The AudioStreamer is initalized with 16bit-Resolution... B4X: streamer.Initialize("streamer", 44100, True, 16, streamer.VOLUME_MUSIC) ... Sub streamer_RecordBuffer (Buffer() As Byte) 'collect the recording data buffers.Add(Buffer) End Sub ...but it looks like the Event function will return BYTEs instead of SHORTs. This is not important as long as you only send the byte untouched to the next stream, but.... If I want to manipulate the audio datas I have to know which byte is the low and which is the high. For manipulation I would need SIGNED SHORTs values from -32767 to+32767. Does anybody have experiences with this? Where can I find more informations? Thanks
I'm experimenting with AUDIO on Android, but I'm new with B4A. I fould a Recording and Playback example from Erel, which uses the AudioStreamer. It works perfect, but I have a question. The AudioStreamer is initalized with 16bit-Resolution... B4X: streamer.Initialize("streamer", 44100, True, 16, streamer.VOLUME_MUSIC) ... Sub streamer_RecordBuffer (Buffer() As Byte) 'collect the recording data buffers.Add(Buffer) End Sub ...but it looks like the Event function will return BYTEs instead of SHORTs. This is not important as long as you only send the byte untouched to the next stream, but.... If I want to manipulate the audio datas I have to know which byte is the low and which is the high. For manipulation I would need SIGNED SHORTs values from -32767 to+32767. Does anybody have experiences with this? Where can I find more informations? Thanks
Erel B4X founder Staff member Licensed User Longtime User Jun 23, 2020 #2 Check this example: https://www.b4x.com/android/forum/threads/audio-library-beeper-duration.78712/post-498840 AudioStreamer works with bytes. Each two bytes represent a short value. Upvote 0
Check this example: https://www.b4x.com/android/forum/threads/audio-library-beeper-duration.78712/post-498840 AudioStreamer works with bytes. Each two bytes represent a short value.
Midimaster Active Member Licensed User Jun 23, 2020 #3 Thank you. This clarifies everything. First low byte followed by high byte. Last question: Is the AudioStreamer a ANDROID function or made by B4X-Team? Is the sourece code avaiable? Upvote 0
Thank you. This clarifies everything. First low byte followed by high byte. Last question: Is the AudioStreamer a ANDROID function or made by B4X-Team? Is the sourece code avaiable?
Erel B4X founder Staff member Licensed User Longtime User Jun 23, 2020 #4 All the libraries are "B4X" libraries. All the libraries call Android APIs. You can find the source code of most libraries here: https://github.com/AnywhereSoftware Upvote 0
All the libraries are "B4X" libraries. All the libraries call Android APIs. You can find the source code of most libraries here: https://github.com/AnywhereSoftware
Midimaster Active Member Licensed User Jun 25, 2020 #5 additional newbie question: Erel gave me that code snipplet above, but inside there is a line i do not understand: B4X: Sub Process_Globals Private streamer As AudioStreamer End Sub Sub Service_Create streamer.Initialize("streamer", 8000, True, 16, streamer.VOLUME_MUSIC) streamer.StartPlaying End Sub .... What is this "Service_Create"? And what do I need to prepare? Is it a library? Is there a tutorial about "Service" ? Upvote 0
additional newbie question: Erel gave me that code snipplet above, but inside there is a line i do not understand: B4X: Sub Process_Globals Private streamer As AudioStreamer End Sub Sub Service_Create streamer.Initialize("streamer", 8000, True, 16, streamer.VOLUME_MUSIC) streamer.StartPlaying End Sub .... What is this "Service_Create"? And what do I need to prepare? Is it a library? Is there a tutorial about "Service" ?
JordiCP Expert Licensed User Longtime User Jun 25, 2020 #6 Service_Create is one of the Android service's lifecycle events, that will be automatically called when the service is first created (or has been killed). This service can be manually started from an activity or another service, or automatically launched upon some event: for instance, Starter service is automatically invoqed when the App starts. Worth getting familiar with Android lifecycle, processes and events : https://www.b4x.com/android/forum/threads/android-process-and-activities-life-cycle.6487/ Upvote 0
Service_Create is one of the Android service's lifecycle events, that will be automatically called when the service is first created (or has been killed). This service can be manually started from an activity or another service, or automatically launched upon some event: for instance, Starter service is automatically invoqed when the App starts. Worth getting familiar with Android lifecycle, processes and events : https://www.b4x.com/android/forum/threads/android-process-and-activities-life-cycle.6487/
Midimaster Active Member Licensed User Jun 25, 2020 #7 Thank you. I understand. Now I moved the code from the MAIN-Editor-window to a new Service-window called STARTER and it works now . Everything is very new for me, but it is amazing. Upvote 0
Thank you. I understand. Now I moved the code from the MAIN-Editor-window to a new Service-window called STARTER and it works now . Everything is very new for me, but it is amazing.