Lazarus
Free Pascal => Beginners => Topic started by: bob67 on July 12, 2019, 04:05:24 pm
-
I am new to Lazarus programming.
I would like write code to generate sound or tones Can anyone guide me on where to start please.
Many thanks
Bob
-
Can you describe some more?
E.g. Do you know about sample rate and sine waves?
I can give many examples, but the above is - by far - the easiest.
If you know that relationship I have lots of code to help you.
-
Thanks Thaddy for your response.
My knowledge of sine waves is more from mathematics. I know what a sine wave is and what shape it takes. I just don;t have the programming knowledge to product sound. For example I know that if I insert the line " beep " in my code I can hear the standard beep. How can I produce different sounds.
Most of my programming experience has been number crunching ( applied to engineering and mathematical applications). I am trying to learn new areas of programing and being a musician as well, producing sounds seems an obvious diversion.
Many thanks
Bob
-
You can try to look into source of this Delphi application:
https://web.archive.org/web/20150829211417/http://delphiforfun.org/Programs/soundgen.htm
-
Thanks Avra
-
You can use PortAudio.
https://wiki.lazarus.freepascal.org/Multimedia_Programming#PortAudio
It's a very basic sound library, where you provide the sound data repeatedly via a callback function. Because you provide the data yourself, you have full control and you can experiment around (Like creating sine waves, manipulate given sounds etc). For reading soundfiles you have to use other libraries, the audio data then can be processed and played with portaudio.
-
https://torry.net/quicksearchd.php?String=mixer&%3BTitle=Yes
Go there, there is a complete set of code that will do something for you, it is a Delphi set of
files but Lazarus converts them so you should be able to get it working..
It goes up to D7 so there shouldn't be anything current in Delphi that is being used to get in your
way..
-
You can try to look into source of this Delphi application:
https://web.archive.org/web/20150829211417/http://delphiforfun.org/Programs/soundgen.htm
Yes, old but good as a minimal explanation! And works for Windows only, note that.
There are more cross platform solutions available, though.
-
I have a complete set of digital files that will compile for both Linux and windows . Both include the
methods of accessing the sound system in the PC so what isn't an issue if the material is asked for..
I forgot where I got it from but It also has DSP stuff in it, FFT, DFT , IDFT etc...