[Csnd-dev] Csound Plugin Example
Date | 2017-09-13 00:38 |
From | Joe Mantegna |
Subject | [Csnd-dev] Csound Plugin Example |
Attachments | newopc.c newopc-test.csd |
Hello folks, got some problem, can anyone help?
I´ve compiled the plugin example by Victor Lazzarini that i found in the FLOSS Manual of Csound under Windows 10 using MinGW+MSYS and following the given compilation command (which is also a part of the example): gcc -O2 -shared -o myopc.dll opsrc.c -DUSE_DOUBLE -I<path to Csound headers> The compilation was absolutely smooth, but after that i copied the newopc.dll in the plugin6 folder of Csound, I've tried to run the csd example use and it did not work. Here is the output after running the csd code: virtual_keyboard real time MIDI plugin for Csound 0dBFS level = 32768.0 --Csound version 6.09.1 (double samples) Jul 10 2017 [commit: 8e8f7a02dc8f0677d10224f7ab18b63f63c80728] libsndfile-1.0.27 WARNING: could not open library 'C:\Program Files\Csound6_x64\plugins64\\newopc.dll' (-1) WARNING: could not open library 'C:\Program Files\Csound6_x64\plugins64\\py.dll' (-1) UnifiedCSD: E:\csound-develop\newopc.csd STARTING FILE Creating options Creating orchestra scoreless operation Loading command-line libraries: rtaudio: PortAudio module enabled ... using callback interface error: syntax error, unexpected T_IDENT (token "newopc") from file E:\csound-develop\newopc.csd (1) line 11: >>>asig newopc <<< Unexpected untyped word asig when expecting a variable Parsing failed due to invalid input! Stopping on parser failure cannot compile orchestra end of score. overall amps: 0.0 1 errors in performance Elapsed time at end of performance: real: 0.004s, CPU: 0.000sIt seems that Csound doesn't load the compiled library, but i can't figure out what i am doing wrong. Code is attached. Thank you in advance. JoM |
Date | 2017-09-13 00:55 |
From | Michael Gogins |
Subject | Re: [Csnd-dev] Csound Plugin Example |
Probably Csound for Windows is compiled for 64 bit CPU architecture and your plugin is complied for 32 bit CPU architecture. They both have to be the same. On Sep 12, 2017 7:49 PM, "Joe Mantegna" <joemantegna2006@gmail.com> wrote:
|
Date | 2017-09-13 04:15 |
From | Joe Mantegna |
Subject | Re: [Csnd-dev] Csound Plugin Example |
Ahhh...that could be the reason, but i compiled also using gcc in Ubuntu 16.04 64 bits version the same code with the same result. Anyway, i will give a try installing MinGW64 and compiling, thanks. On Tue, Sep 12, 2017 at 8:55 PM, Michael Gogins <michael.gogins@gmail.com> wrote:
|
Date | 2017-09-14 02:30 |
From | Joe Mantegna |
Subject | Re: [Csnd-dev] Csound Plugin Example |
Actually, I got installed both cygwin64 and mingw-w64 and it compiled like a charm, but with the same results. That is: the dll generated is not loaded by Csound. Any other suggestion? JoM On Wed, Sep 13, 2017 at 12:15 AM, Joe Mantegna <joemantegna2006@gmail.com> wrote:
|
Date | 2017-09-14 02:44 |
From | Steven Yi |
Subject | Re: [Csnd-dev] Csound Plugin Example |
I just compiled the .c file here (had to comment out the first line which had csound style ; comment instead of //) using mingw64 and command: gcc -O2 -shared -o newopc.dll newopc.c -DUSE_DOUBLE -I ../work/csound/csound/include then was able to run the newopc-test.csd here. I'm using MSYS2, gcc 7.2.0, Windows 10. $ gcc -v Using built-in specs. COLLECT_GCC=C:\msys64\mingw64\bin\gcc.exe COLLECT_LTO_WRAPPER=C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/lto-wrapper.exe Target: x86_64-w64-mingw32 Configured with: ../gcc-7.2.0/configure --prefix=/mingw64 --with-local-prefix=/mingw64/local --build=x86_64-w64-mingw32 --host=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --with-native-system-header-dir=/mingw64/x86_64-w64-mingw32/include --libexecdir=/mingw64/lib --enable-bootstrap --with-arch=x86-64 --with-tune=generic --enable-languages=c,lto,c++,objc,obj-c++,fortran,ada --enable-shared --enable-static --enable-libatomic --enable-threads=posix --enable-graphite --enable-fully-dynamic-string --enable-libstdcxx-time=yes --disable-libstdcxx-pch --disable-libstdcxx-debug --disable-isl-version-check --enable-lto --enable-libgomp --disable-multilib --enable-checking=release --disable-rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers --with-libiconv --with-system-zlib --with-gmp=/mingw64 --with-mpfr=/mingw64 --with-mpc=/mingw64 --with-isl=/mingw64 --with-pkgversion='Rev1, Built by MSYS2 project' --with-bugurl=https://sourceforge.net/projects/msys2 --with-gnu-as --with-gnu-ld Thread model: posix gcc version 7.2.0 (Rev1, Built by MSYS2 project) On Wed, Sep 13, 2017 at 9:30 PM, Joe Mantegna |
Date | 2017-09-14 15:37 |
From | Joe Mantegna |
Subject | Re: [Csnd-dev] Csound Plugin Example |
Well... I am compiling using this version, i don´t see significant changes: C:\>gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=C:/Program\ Files\ (x86)/mingw-w64/i686-7.1.0-posix-dwarf-rt_v5-rev2/mingw32/bin/../libexec/gcc/i686-w64-mingw32/7.1.0/lto-wrapper.exe Target: i686-w64-mingw32 Configured with: ../../../src/gcc-7.1.0/configure --host=i686-w64-mingw32 --build=i686-w64-mingw32 --target=i686-w64-mingw32 --prefix=/mingw32 --with-sysroot=/c/mingw710/i686-710-posix-dwarf-rt_v5-rev2/mingw32 --enable-shared --enable-static --disable-multilib --enable-languages=c,c++,fortran,lto --enable-libstdcxx-time=yes --enable-threads=posix --enable-libgomp --enable-libatomic --enable-lto --enable-graphite --enable-checking=release --enable-fully-dynamic-string --enable-version-specific-runtime-libs --enable-libstdcxx-filesystem-ts=yes --disable-sjlj-exceptions --with-dwarf2 --disable-libstdcxx-pch --disable-libstdcxx-debug --enable-bootstrap --disable-rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers --with-gnu-as --with-gnu-ld --with-arch=i686 --with-tune=generic --with-libiconv --with-system-zlib --with-gmp=/c/mingw710/prerequisites/i686-w64-mingw32-static --with-mpfr=/c/mingw710/prerequisites/i686-w64-mingw32-static --with-mpc=/c/mingw710/prerequisites/i686-w64-mingw32-static --with-isl=/c/mingw710/prerequisites/i686-w64-mingw32-static --with-pkgversion='i686-posix-dwarf-rev2, Built by MinGW-W64 project' --with-bugurl=https://sourceforge.net/projects/mingw-w64 CFLAGS='-O2 -pipe -fno-ident -I/c/mingw710/i686-710-posix-dwarf-rt_v5-rev2/mingw32/opt/include -I/c/mingw710/prerequisites/i686-zlib-static/include -I/c/mingw710/prerequisites/i686-w64-mingw32-static/include' CXXFLAGS='-O2 -pipe -fno-ident -I/c/mingw710/i686-710-posix-dwarf-rt_v5-rev2/mingw32/opt/include -I/c/mingw710/prerequisites/i686-zlib-static/include -I/c/mingw710/prerequisites/i686-w64-mingw32-static/include' CPPFLAGS=' -I/c/mingw710/i686-710-posix-dwarf-rt_v5-rev2/mingw32/opt/include -I/c/mingw710/prerequisites/i686-zlib-static/include -I/c/mingw710/prerequisites/i686-w64-mingw32-static/include' LDFLAGS='-pipe -fno-ident -L/c/mingw710/i686-710-posix-dwarf-rt_v5-rev2/mingw32/opt/lib -L/c/mingw710/prerequisites/i686-zlib-static/lib -L/c/mingw710/prerequisites/i686-w64-mingw32-static/lib -Wl,--large-address-aware' Thread model: posix gcc version 7.1.0 (i686-posix-dwarf-rev2, Built by MinGW-W64 project) However, the dll is not loaded by csound. Would you mind to put the binary generated in some place at which i can download it to find out whether it is a compilation or a csound issue? My best. JoM On Wed, Sep 13, 2017 at 10:44 PM, Steven Yi <stevenyi@gmail.com> wrote: I just compiled the .c file here (had to comment out the first line |
Date | 2017-09-14 15:51 |
From | Steven Yi |
Subject | Re: [Csnd-dev] Csound Plugin Example |
Try the file at: http://www.kunstmusik.com/newopc.dll On Thu, Sep 14, 2017 at 10:37 AM, Joe Mantegna |
Date | 2017-09-14 17:46 |
From | Michael Gogins |
Subject | Re: [Csnd-dev] Csound Plugin Example |
Attachments | newopc.c newopc-test-mkg.csd |
I have compiled and run your sample on Linux. It would neither compile, nor load, nor run properly, until I made some changes. I had to change the source code to remove the ";" comment and to use more correct syntax for #including csdl.h. My file is attached. I had to change the build command to use correct input and output names and to add the required "-fPIC" compiler option: gcc -O2 -g -shared -fPIC -DUSE_DOUBLE newopc.c -o newopc.so NOTE: On Linux, all Csound headers are installed to /usr/local/include/csound so "#include |
Date | 2017-09-14 20:52 |
From | Joe Mantegna |
Subject | Re: [Csnd-dev] Csound Plugin Example |
Thank you very much!
Yes, the csound style comment was a typo (also mentioned by Steven Yi), but i added it after compiling the file and before sending the example to the list, just to mention the origin of the code. Of course, when building under Linux I've used the compiling instructions given in the example, which are different than the ones for Windows. The same stands for the header files location. I forgot to mention it, my fault, sorry. As for the missing <CsScore><CsScore/> tags, these are missing in the original example csd file as well. Actually, i've found that the problem under Linux is not a compiling issue, but of a Csound version incompatibility. Here is the output of my linux console when attempting to run the example: JoM@lap1:~$ csound -d -f -W ./Documents/sources/newopc/newopc.csd -o test.wav WARNING: not loading 'newopc.so' (incompatible with this version of Csound (4.0/3.0) virtual_keyboard real time MIDI plugin for Csound 0dBFS level = 32768.0 Csound version 6.04 (double samples) 2016-02-21 libsndfile-1.0.25 UnifiedCSD: ./Documents/sources/newopc/newopc.csd STARTING FILE Creating options Creating orchestra Loading command-line libraries: rtaudio: ALSA module enabled rtmidi: ALSA Raw MIDI module enabled error: syntax error, unexpected T_IDENT (token "newopc") from file ./Documents/sources/newopc/newopc.csd (1) line 13: >>>asig newopc <<< Unexpected untyped word asig when expecting a variable Parsing failed due to invalid input! Stopping on parser failure cannot compile orchestra end of score. overall amps: 0.0 1 errors in performance Elapsed time at end of performance: real: 0.018s, CPU: 0.006s So...got to update my Csound version and see what's up. JoM On Thu, Sep 14, 2017 at 1:46 PM, Michael Gogins <michael.gogins@gmail.com> wrote: I have compiled and run your sample on Linux. It would neither |
Date | 2017-09-14 20:56 |
From | Joe Mantegna |
Subject | Re: [Csnd-dev] Csound Plugin Example |
Many thanks, the library is loaded and the example runs. So, it is a building issue. I will try to build with the same compiler you used.On Thu, Sep 14, 2017 at 11:51 AM, Steven Yi <stevenyi@gmail.com> wrote: Try the file at: |
Date | 2017-09-14 22:31 |
From | Joe Mantegna |
Subject | Re: [Csnd-dev] Csound Plugin Example |
Sorry, my last message was confusing. Under Windows 10 the binary compiled by Steven Yi loaded and run,loaded by Csound. Under Linux Ubuntu 16.04 LTS the library compiles but it is not loaded by Csound, apparentlyJoM On Thu, Sep 14, 2017 at 4:56 PM, Joe Mantegna <joemantegna2006@gmail.com> wrote:
|
Date | 2017-09-14 22:54 |
From | Michael Gogins |
Subject | Re: [Csnd-dev] Csound Plugin Example |
I have the same version of Linux as you and it compiles, loads, and runs for me AS I CORRECTED YOUR FILES. ----------------------------------------------------- Michael Gogins Irreducible Productions http://michaelgogins.tumblr.com Michael dot Gogins at gmail dot com On Thu, Sep 14, 2017 at 5:31 PM, Joe Mantegna |
Date | 2017-09-15 02:49 |
From | Oscar Pablo Di Liscia |
Subject | Re: [Csnd-dev] Csound Plugin Example |
thanks AGAIN El jueves, 14 de septiembre de 2017, Michael Gogins <michael.gogins@gmail.com> escribió: I have the same version of Linux as you and it compiles, loads, and -- Dr. Oscar Pablo Di Liscia Profesor Titular Director Programa de Investigación "Sistemas Temporales y Síntesis Espacial de Sonido en el Arte Sonoro"Escuela Universitaria de Artes Universidad Nacional de Quilmes |