-----Original Message-----
> From: Likai Liu
> To: linux-audio-dev(a)music.columbia.edu
> Sent: 10/19/02 1:42 PM
> Subject: Re: [linux-audio-dev] soft synth as a plugin
>
> STEFFL, ERIK (SBCSI) wrote:
>
> >>erm, sorry, but why not use pointers
> >>
> > it's dangerous... null pointers, memory leaks etc. tendency is not to
> use
> >pointers unless absolutely neccessary...
> >
> References in C++ are just pointers in a sugared form. Actually they are
EVERYTHING in ALL computer languages is just sugar, all these languages
(the turing complete ones) are same, apart from syntactic sugar. so your
statement doesn't really say anything.
> the same thing in a slightly different syntax. There is no memory safety
>
> in C/C++, so you end up having the same risks no matter you use pointers
no you don't. just because it's still risky doesn't mean it is the SAME.
C++ is quite unsafe as far as memory management goes but certain practices
can lead to memory mismanagement much easier - one of the practices that can
help is using references instead of pointers.
when using references it's quite hard (=harder then when using pointers)
to:
free already free-ed memory
create NULL reference
have a memory leak
> or references. The difference of the performance probably lies in the
> fact that the compiler understands your code better with references,
> hence it can do better optimizations. My guess is that references are
> easier to optimize against because you don't do pointer arithmetics and
> pointer type-casting on references.
I don't believe there is performance difference. is there anything that
suggests there is?
erik
Hi,
I just heard that there's an alpha version of SuperCollider for Linux. Since I
haven't seen this news on this list it might be either because it hasn't been
on the list or that I overlooked it :)
You can download it here:
http://swiki.hfbk-hamburg.de:8888/MusicTechnology/422
(and with .tgz it seems a gzipped file, but it's just a tar!)
(Too bad I still can't test it myself because of lack of jack, or to be
precisely, ALSA...)
bye,
Kasper
>>indeed, for a plugin soft-synth, it would only ever make sense to write
>>it in c/c++ or assembler really, a question of speed. Are there really
>>people who seriously want to write a synth in aynthing else?
> OTOH, CLM is written in Lisp, (hence the name), and some modern Lisps
> (i.e. CMUCL) claim to be as fast as C for floats. So I suppose you could write DSP
> code in Lisp if you really wanted to.
I did some timing tests in cmucl and was amazed at the performance
it was getting -- it is close to C, but (sigh... there's always
a catch), you have to be extremely explicit about types, so
all that beautiful lisp code gets buried under type declarations.
At least the cmucl guys are making progress in this area.
In normal use, CLM "instruments" are translated into C and
run as foreign functions (so all the DSP stuff is happening
at C speeds), and lisp provides an interactive environment
to work in (the "listener").
So, yes it is perfectly possible to do real-time synthesis
while writing the DSP-related code in Lisp/Scheme; there are
examples in both CLM and Snd.
>
>It builds fine with gcc3 after a bit of auto* hackery (ran ./ltconfig
>ltmain.sh, automake -a), but there is no UI yet, so you can't see what
>you're doing.
>
I am not so lucky yet... anyway i saw that SC does use both C++ and ObjC.
I thought its not possible to mix them with gcc. Would be realy cool if
that has been fixed with gcc3.
- Stefan
_________________________________________________________________
Broadband? Dial-up? Get reliable MSN Internet Access.
http://resourcecenter.msn.com/access/plans/default.asp
> > >The occasionaly discussed jack session
> > > saving gizmo would be a knock dead feature.
> >
> > And any offering to the general public that doesn't contain this feature
> > will probably end up just plain dead. Be patient.
>
>
> I'm not a patient man ;)
I didn't mean you. I meant that anyone interested in announcing linux
audio to the world should wait until this level of functionality is
present. I'm not suggesting that anyone delay development of the gizmo.
The closest thing that I have used is OMS on the mac. It's quite
different than a jack environment but it does allow me to save synth
midi routings and send/receive channels, and provides synth names to
midi apps so I can refer to them directly in my sequencer app.
Tom
>
>are different versions of gcc3 ABI - compatible?
>
AFAIK all versions of gcc3 except version 3.0 which had a bug are
compatible.
- Stefan
_________________________________________________________________
Surf the Web without missing calls! Get MSN Broadband.
http://resourcecenter.msn.com/access/plans/freeactivation.asp
>On Fri, Oct 18, 2002 at 06:47:15 +0000, Stefan Nitschke wrote:
> > -O3 with C is broken, i got an endless loop!
>
>What gcc version? What flags did you use with C?
>
I used gcc 3.2 that comes with SuSE 8.1.
Today i changed the initial values to a=0.5; b=0.0000001; x=0.1; and now
-O3 works!?? Here are the results:
C: -O3 -march=pentium
user 0m11.380s
C++: -O3 -march=pentium
user 0m11.960s
BTW to my surprise today i was able to use ardour without freezing my
machine
as it always did last week. I didnt changed the system and used the same
binaries.
I never saw such a random problem on a linux box before.
>The test I did had the C code using a struct, and I used the . syntax for
>c++ method calls FWIW. I'l dig out the code in a min.
>
>I think it was loop unrolling that was crappy in c++.
>
That would be a bad thing.
- Stefan
_________________________________________________________________
Broadband? Dial-up? Get reliable MSN Internet Access.
http://resourcecenter.msn.com/access/plans/default.asp
> Things like jack have to be graphically wrappered or hidden too, no
> scrolling text windows of xruns. The occasionaly discussed jack session
> saving gizmo would be a knock dead feature.
And any offering to the general public that doesn't contain this feature
will probably end up just plain dead. Be patient.
Tom
>
>erm, sorry, but why not use pointers?
>
Just out of couriosity i made a benchmark test between C and C++ with
gcc3. I dont have a clue abour x86 assembler so i made a measurement.
Here is the C code (not realy useful as real code would have a need for a
struct and a pointer operation to call the filter() function) and the
C++ code.
Both "simulate" a low pass filter and are compiled with:
gcc -O2 -march=pentium -o filter filter.xx
-O3 with C is broken, i got an endless loop!
---------
double x1,y1,a,b;
const double filter(const double x)
{
register double y;
y = a*(x + x1) - b*y1;
x1 = x;
y1 = y;
return y;
}
int main()
{
double x=1;
int i;
x1 = y1 = 0;
a = b = 0.5;
for (i=0; i<1000000000; ++i) {
x = filter(x);
}
}
---------
class LowPass {
public:
LowPass() { x1 = y1 = 0; a = b = 0.5; };
~LowPass() {};
const double filter(const double x);
private:
double x1,y1,a,b;
};
inline const double LowPass::filter(const double x)
{
register double y;
y = a*(x + x1) - b*y1;
x1 = x;
y1 = y;
return y;
}
int main()
{
//LowPass* LP = new LowPass();
LowPass LP;
double x=1;
for (int i=0; i<1000000000; ++i) {
//x = LP->filter(x);
x = LP.filter(x);
}
}
---------
The results on my AthlonXP machine are:
C++ with member:
real 0m11.847s
user 0m11.850s
sys 0m0.000s
C++ with new() and pointer:
real 0m12.337s
user 0m12.330s
sys 0m0.000s
C:
real 0m16.673s
user 0m16.670s
sys 0m0.000s
Well, i will stay with pointer less C++ :-)
- Stefan
_________________________________________________________________
Surf the Web without missing calls! Get MSN Broadband.
http://resourcecenter.msn.com/access/plans/freeactivation.asp
On Friday 18 October 2002 04:25, Patrick Shirkey wrote:
> My opinion is that there is not enough people working on the
> promotional side of ALSA and Linux Audio.
ALSA/LAD is too geeky and too die-hard techno hardcore to appeal to
anyone but geeks. IMHO music geeks are the worst type of geeks and
Linux geeks are the worst type of computer geeks. This isn't a
ALSA/LAD problem - it's a general Linux image problem. Out with the
beards and fusty academia, kernel hacking and tweakery and in with the
primary colours and the big square buttons to get The Kids into it all.
The Linux desktop is now sufficiently advanced that this should all be
possible.
I argued all this with a guy from Newsforge when we showed at Linux Expo
last week. The article has typos all over it (including my name of
course) and it's a little quote light but:
http://newsforge.com/newsforge/02/10/14/196240.shtml?tid=23
The point is that selling Linux Audio isn't just about Linux Audio -
it's about selling the whole desktop. It's about letting people know
that if they want to make music they can just get on and make music.
People shouldn't have to have a degree to install music software and to
start using it. This problem is bigger that LAD/ALSA or even AGNULA
and it crosses that distasteful line between hobbyists twiddling and
research and big business. It treads on a lot of toes.
Yes, this is a troll and not a very original one at that, but it's time
that there was a clear distinction between Linux Sound/Audio and Linux
for Music. The latter has a clearly defined marketplace, the former
doesn't.
B