[CM] cm3/sndlib with audio and midi file generation

Fernando Lopez-Lezcano nando at ccrma.Stanford.EDU
Thu Nov 27 13:53:33 PST 2008

On Tue, 2008-11-18 at 06:13 -0600, Heinrich Taube wrote:
> the new cm3 tarball has sndlib audio file and midi file output working  
> for processes. you need the lastest sndlib for this.
> http://camil.music.uiuc.edu/Software/grace/downloads/cm3.tar.gz

Trying to build (on Linux)...

Needs premake, so got it and compiled it, needs juce, got a newer
package going and installed it. 

Got the current sndlib: 
./configure --prefix=/usr --with-alsa --with-jack --with-s7

(configure is not entirely happy:
./configure: line 14998: jack: command not found
./configure: line 15003: jack: command not found
./configure: line 15004: jack: command not found
but it finishes and the result can be "made")

then cd ../cm3

./premake --verbose --target gnu  --sndlib ../sndlib
--juce /usr/share/juce

then a make which finishes with:

g++: ../sndlib/sndlib.a: No such file or directory

and of course there is no sndlib static library available. Nor
(apparently) a way to enable it in sndlib's configure or make (AFAICT -
--enable-static did not get recognized). How was this tested?? So, try
to hand compile a sndlib.a in the sndlib dir:

gcc  headers.o audio.o io.o sound.o xen.o vct.o clm.o sndlib2xen.o
clm2xen.o midi.o run.o s7.o -o sndlib.a -shared -lsamplerate -lgsl
-lgslcblas -lm -ljack

probably not the right invocation but what do I know (NOTE: I had to add
the -ljack by hand, it is not added by sndlib and you get undefined
references if it is not there). 

So then go back and try again:

$ make
==== Building cm ====
mkdir -p bin
mkdir -p .
mkdir -p bin
g++ -o bin/cm obj/Release/Scanner.o obj/Release/Syntax.o
obj/Release/CmSupport.o obj/Release/Console.o obj/Release/Scheme.o
obj/Release/SchemeSources.o obj/Release/Midi.o obj/Release/Main.o
obj/Release/SndLib.o obj/Release/SndLibBridge.o  -Lbin -L. -s
-L"/usr/share/juce/bin" -L"/usr/X11R6/lib/" -ljuce -l freetype -l
pthread -l rt -l X11 -l GL -l GLU -l Xinerama -l
asound ../sndlib/sndlib.a  
obj/Release/SndLib.o: In function `g_random_w(s7_scheme*, s7_cell*)':
SndLib.cpp:(.text+0x325): undefined reference to
obj/Release/SndLib.o: In function `g_delete_file_w(s7_scheme*,
SndLib.cpp:(.text+0x425): undefined reference to
obj/Release/SndLib.o: In function `g_file_exists_p_w(s7_scheme*,
SndLib.cpp:(.text+0x525): undefined reference to
collect2: ld returned 1 exit status
make[1]: *** [bin/cm] Error 1
make: *** [cm] Error 2

ARGH... appears to be internal to sndlib?


_And_, what is the problem with having VERSIONS???

Why is it that, cm3 is just "cm3.tar.gz"? And there is no way to know if
it is newer, has been updated and has changed save for looking at the
date of the file in the filesystem, provided you kept the date of the
old one handy. I'll probably roll out a package if it ever builds, what
is it going to be the version?

If you don't like version numbers 'cause of a "rolling release" thing,
just use a date as part of the tarball (say, "cm3-2008.11.26.tar.gz")
and then keep it consistent from release to release, please. 

Thanks for listening...
-- Fernando

> to generate a file just pass the file name to (sprout ...) See cm3/scm/ 
> examples.scm for some examples of realtime and the new file based,  
> faster-than-real time generation.  ive also added a simple SNDLIB  
> instrument  called 'wave'  to the runtime sources (sine with amp and  
> gliss control)  so no need to  load anything,  you can generate audio  
> immediately:
> $ bin/cm3
> cm> (with-sound() (wave 0 1 440 .1))
> "test.aiff"
> cm> (define (simpwav n r d lb ub)
>    (process repeat n
> 	   for k = (between lb ub)
> 	   for t = (elapsed #t)
> 	   do
> 	   (wave t d (hz k) .1)
> 	   (wait r)))
> simpwav
> cm> (sprout (simpwav 10 .2 .1 60 80) "test.aiff")
> Output: "test.aiff"
> Channels: 1
> Srate: 44100.0
> cm>
> note that, since sprout returns immediatly, you will know that the  
> sound file computation is done when the file info is printed to the  
> screen. also you can use (elapsed #t) to get the true score time of  
> the process to pass to a clm insrument (calling just (elapsed)  
> continues to return the relative run time since the process started)
> right now the :play option to with-sound or sprout doesnt work. still  
> alot to do, but its basically working. way cool! 

More information about the Cmdist mailing list