My first post on this forum, hello to everybody here.
It has been a while I did some programming, but I have an idea for a project and I need to do some coding. For this, I'm considering PureBasic. It involves audio synthesis, for now not in realtime. I also looked at things like SuperCollider, but I think writing it in a language like PureBasic makes it easier for other people who might be interested to use my software. Correct me if I'm wrong, but I'm especially drawn to PureBasic because I've read it produces small executables with little to no dependencies, with good execution speeds. So it should work on almost all computers?
Basically what I want to do: reading WAV-files, perform a whole lot of calculations on the data, writing the results as a WAV-file. I hope it's not too complicated to read and write WAV-files? Another question, if it's possible to say anything about it in general, is PureBasic faster with calculations on integers or floats?
Of course I've looked at some topics here on the forum and examples of code, to be honest it all looks a bit overwhelming. I do have some experience with programming, but that's a long time ago. Examples are: GWBasic, TurboBasic and TurboPascal. All of them in the DOS-era. So it has been ages. I just hope the learning curve is not too steep for an old dinosaur like me...
Considering to start programming with PureBasic
Re: Considering to start programming with PureBasic
Since PB is not a interpreted language and even allows inline ASM - speed wont be a problem.
Re: Considering to start programming with PureBasic
PureBasic is a really nice language.Rudy wrote:Basically what I want to do: reading WAV-files, perform a whole lot of calculations on the data, writing the results as a WAV-file. I hope it's not too complicated to read and write WAV-files? Another question, if it's possible to say anything about it in general, is PureBasic faster with calculations on integers or floats?
The wav format is not that difficult to handle but you will have to parse the files yourself if you want to access the sample data.
Myself together with J. Baker created an application with PureBasic called Macrotune which can output the audio it generates to a wav file.
http://www.posemotion.com/macrotune/
There are other examples on the forum as well of users who created an application using PureBasic which works with audio samples.
When it comes to floats vs integers, both are pretty fast and you can speed up time critical parts with ASM when needed.
Windows (x64)
Raspberry Pi OS (Arm64)
Raspberry Pi OS (Arm64)
Re: Considering to start programming with PureBasic
If you used TurboBasic (PowerBasic) then you will be fine picking up PureBasic. Instead of CALL and SUB, you can write a Procedure() in PureBasic and call it by its procedural name that you have given it. This, of course, can be used multiple times throughout your code. Everything else is kind of similar, basic-wise, and shouldn't be hard to pick up on.
www.posemotion.com
PureBasic Tools for OS X: PureMonitor, plist Tool, Data Maker & App Chef
Mac: 10.13.6 / 1.4GHz Core 2 Duo / 2GB DDR3 / Nvidia 320M
PC: Win 7 / AMD 64 4000+ / 3GB DDR / Nvidia 720GT
Even the vine knows it surroundings but the man with eyes does not.
PureBasic Tools for OS X: PureMonitor, plist Tool, Data Maker & App Chef
Mac: 10.13.6 / 1.4GHz Core 2 Duo / 2GB DDR3 / Nvidia 320M
PC: Win 7 / AMD 64 4000+ / 3GB DDR / Nvidia 720GT
Even the vine knows it surroundings but the man with eyes does not.
Re: Considering to start programming with PureBasic
Thank you all for your reply. Right now I'm going through the documentation, there are a lot of commands in PureBasic, some 1400 or so? On one hand, that's good, on the other hand, maybe there a risk you code something and many lines later you discover there is a simple command for that?
I'm seriously considering to give it a shot, so in that case, expect a lot more questions from me in the near-future.
Yes, although it has been a while. But if it's all somewhat similar, that helps.J. Baker wrote:If you used TurboBasic ...
I'm seriously considering to give it a shot, so in that case, expect a lot more questions from me in the near-future.
Re: Considering to start programming with PureBasic
There's a demo version that you can try. Since you came from GWBasic, you'll find PureBasic easy enough to pick up. And we're all here to help if you need it.Rudy wrote:I'm seriously considering to give it a shot
Re: Considering to start programming with PureBasic
Welcome to PureBasic. I guess you already noiced two major important points by your posting.
Let me maybe add another crucial point: compatibility / extensibility
When i try to work with audio data like wav for a free project, i include the latest BASS library first. A few lines later, your project has always the same kind of audio buffer you work with and its suddenly able to process lots of audio formats with plenty of options and check the licensing in case your software goes commercial. Its quite fair IMHO.
I rarely work with audio files, so these lines are from an old tool done 2008, so i am hesitating to post the include files it uses, but if you have any problems, just send me a private message. You should get more current ones from the web though at the BASS website or forum. Welcome to PureBasic again
A tiny snippet how (stone old) software works with BASS and PureBasic
pretty easy imho.
ps: you can clearly see how old and unprofessional this snippet is - i even used GOTO
- the community exists and is active
the community is helpful
Let me maybe add another crucial point: compatibility / extensibility
When i try to work with audio data like wav for a free project, i include the latest BASS library first. A few lines later, your project has always the same kind of audio buffer you work with and its suddenly able to process lots of audio formats with plenty of options and check the licensing in case your software goes commercial. Its quite fair IMHO.
Code: Select all
XIncludeFile "DShowMedia.pbi"
XIncludeFile "Bass/PB/bass.pbi"
If (BASS_Init(0, 128000, 0, 0, 0) <> 1)
MessageRequester("Error", "BASS initialisation failed", #PB_MessageRequester_Ok)
End 999
EndIf
A tiny snippet how (stone old) software works with BASS and PureBasic
Code: Select all
BassHSTREAM = BASS_StreamCreateFile(#False, @DataName$, 0, 0, #BASS_STREAM_DECODE)
If (BassHSTREAM = 0)
; BassErrorCode = BASS_ErrorGetCode()
Result = -3
Goto GetAudioFileInfo_CleanUp
EndIf
ChannelLength.q = BASS_ChannelGetLength(BassHSTREAM, #BASS_POS_BYTE)
BTime.f = BASS_ChannelBytes2Seconds(BassHSTREAM, ChannelLength)
ps: you can clearly see how old and unprofessional this snippet is - i even used GOTO
Re: Considering to start programming with PureBasic
Thanks to everybody for your comments and suggestions. It felt like a very warm welcome to this forum, and an invitation to join the PB club!