Soft Synthesizer lazarus / 8-Other ---------------------------------------------------------------------- Blaazen · 2013-01-28 12:42 I attached a little demo (250 lines) of software synthesizer. It requires PortAudio library to run. You can get it here http://www.portaudio.com/ or in repositories of your Linux distro. The demo stores wave in a lookup table. It opens PortAudio stream and callback function feeds the audio data periodically. You can modify frequency (4 octaves in halftones), volume, balance, amount and layout of higher harmonics. Also there's a simple stereo effect based on 1% difference in frequency of left and right channel. PortAudio bindings are bundled. I hope it will work for you ---------------------------------------------------------------------- Fred vS · 2013-01-28 13:06 Nice, wanna try it but : Quote/usr/bin/ld: cannot find -lportaudio   EDIT : Ooops,QuoteIt requires PortAudio library to run: Ok, i have to copy it in /usr/lib ? (you are welcome to use Lazdyn_portaudio.pas from UOS for dynamic loading) ---------------------------------------------------------------------- Blaazen · 2013-01-28 13:39 I have PortAudio in /usr/lib64. If you install it from Repo (better) it should be done automatically. If you download it yourself, you should copy it there (as a "sudo") and then run "sudo ldconfig" in console - system will rescan dyn. libraries. ---------------------------------------------------------------------- wjackson153 · 2013-01-28 16:18 I guess it can only be made to work on x64 cause I could not get it to work on my 32 bit Linux ---------------------------------------------------------------------- Blaazen · 2013-01-28 16:32 No idea, I have no 32-bit system. The code is very short and there is nothing special. It uses CTypes. I have PA bindings from here, IRC: http://sourceforge.net/projects/humus/files/external/portmedia/ There is a demo: "testpasine.pas" which you can test to see where is problem. My demo is in fact only an extension of this bundled demo. ---------------------------------------------------------------------- wjackson153 · 2013-01-28 16:47 Ok thanks Blaazen. I will check it owt ---------------------------------------------------------------------- Fred vS · 2013-01-28 17:00 QuoteI have PA bindings from here, IRC: http://sourceforge.net/projects/humus/files/external/portmedia/ There is a demo: "testpasine.pas" which you can test to see where is And here one testpasine.pas working for Lazarus : http://www.lazarus.freepascal.org/index.php/topic,17521.msg96750.html# msg96750 And i would say : QuoteThanks to the c2delphi.exe portaudio.c portaudio.pas Team for PortAudio bindings (I have got the same result.) @Blaazen : Are you angry with me ? ---------------------------------------------------------------------- Blaazen · 2013-01-28 19:27 Quote@Blaazen : Are you angry with me ?No. You mean that I didn't use your version of bindings ? I downloaded the other version some time ago. I'm more interested in old-fashioned synthesizers than ogg and mp3 players so simple audio output is enough for me. ---------------------------------------------------------------------- Fred vS · 2013-01-28 19:54 QuoteNo.    QuoteYou mean that I didn't use your version of bindings ? More or less, have you seen all the prob for users to install static libraries to test your program ? QuoteI'm more interested in old-fashioned synthesizers than ogg and mp3 players so simple audio output is enough for me. It would be so great if you can add your synthesizers part in UOS  EDIT: Code: [Select] function AddFromSynth(Frequency:cint; Duration:CDouble; Output:integer;...;...) ---------------------------------------------------------------------- Fred vS · 2013-01-28 21:43 Ok, it is working. Whaouw, superb and the stereo effect, brilliant.  PS1: Stop does not work on my 32 bit linux PS2: For those who do not have the static libraries, here the dynamic loading version of Blaazen's synth:https://sites.google.com/site/fiens prototyping/DynSynthDemo.tar.gz ---------------------------------------------------------------------- wjackson153 · 2013-01-28 22:43 Confirmed working on my Linux Mint 14 x86 Good job blaazen Im not sure if it has something to do with portaudio but it does it on every wav file gitters at the begining, also when i try to load a .mid file it freezes up.  Should it also play mid files ? The freeze does not give an error btw, but just the app freezes not my destop enviroment ---------------------------------------------------------------------- Blaazen · 2013-01-28 22:56 @ PS1: Stop does not work on my 32 bit linux You can try "Pa_AbortStream" instead. Pa_CloseStream may cause the problem: http://portaudio.com/docs/v19-doxydocs/start_stop_abort.html @ wjackson153 What do you mean "... it does it on every wav file gitters at the begining ..."? ---------------------------------------------------------------------- Fred vS · 2013-01-28 23:18 Ooops, i get it, in main form, stop button cover the trackbar and when i click on it, in fact i click on trackbar. Ok, Stop works (but the layout of main form is strange, the buttons are on same top than last trackbar and also for checkboxes). But that is a detail. Congratulation and i see that you perfectly know and understand digital audio. ---------------------------------------------------------------------- Blaazen · 2013-01-28 23:29 Oh, I see now with GTK2. I designed it in Qt and did not test elsewhere. ---------------------------------------------------------------------- Fred vS · 2013-01-28 23:41 QuoteI designed it in Qt and did not test elsewhere. Yep, i just try it with Qt and layout is perfect. Humm, is that normal ?( im not talking about your beautiful synth but about Qt <> GTK2 conversion  ) ---------------------------------------------------------------------- Blaazen · 2013-01-28 23:46 Yes. Lazarus tries to behave native as much as possible. Heights of TEdit and TTrackbars may differ on each platform. My demo is badly anchored. At least the checkboxes and the spinedit should be anchored under the lowest trackbar. ---------------------------------------------------------------------- Fred vS · 2013-01-28 23:51 Quoteshould be anchored I never trusted anchor ---------------------------------------------------------------------- wjackson153 · 2013-01-29 00:03 Never mind its working,  the problem was low resources After i restarted all is well.