On Thu, 9 Jun 2005 23:41 , David Cournapeau <cournape(a)gmail.com> sent:
>On 6/9/05, stefan kersten steve(a)k-hornz.de> wrote:
>> On Thu, Jun 09, 2005 at 10:31:35PM +0900, David Cournapeau wrote:
>> > _Z6vectorSt6vectorIiSaIiEE:
>> > .LFB539:
>> > .L2:
>> > .L7:
>> > pushl %ebp
>> > .LCFI0:
>> > movl %esp, %ebp
>> > .LCFI1:
>> > popl %ebp
>> > ret
>>
>
>Well, that's what happens when one post some code after some heavy
>coding all day long, and when one tries to answer two questions at the
>same time....That's why I would have prefered to find the relevant
>part instead in the C++FAQ :)
>
> Anyway, for the question "is there bound checking with operator[]",
>the answer of Bjarne Stroustrup is no :).
> The other problem "is [] as efficient for vector and plain c array
>?", well, people who know better than me asm/gcc can test and answer.
>
Yeah, it really needs to be tested to tell. I remember taking a course in
VAX Macro asm back in the days of dinosaur eggs and phonograph needles. The
book, DEC, and the teacher all said you could turn off the VAX debugging mode
when you compiled. I wrote some self-modifying code for one of the exercises (I
wouldn't do that in real life ;-) The compiler still slapped in some debugging
stuff and it wouldn't work. It was a real simple program though so the
instructor checked it and passed it anyway ;-)
Jan
N Smethurst:
> Since a vector is a wrapped C array (i.e. contigous), the [] operator
> compiles to the C equivalent when optimisation is turned on.
I was thinking of iterator operations, having vaguely recalled that the vector iterator in the gcc library had at some point changed from an actual pointer to a wrapper class. Looking at the code, though, the wrapper is so thin that it probably isn't an issue with optimization on.
Chris
>Could anyone point me toward a document explaining the
>technical/mathematical details of convolution, especially about audio?
I've used convolution/correlation/fourier analysis for school projects. The
standard text for Fourier analysis is Bracewell, "The Fourier Transform and
its Applications". Also check out "Numerical Recipes in C" (available
on-line) by Press, Teukolsky, Vetterling and Flannery, Cambridge Press, for
code on performing convolution and correlation with the fast fourier
transform.
As for audio, I've dealt mostly with images but the same principals apply.
Audio is a 1D signal and most texts spend a considerable time covering
these . Look for any book on digital signal processing and it will most
certainly contain what you need.
Kevin
> And, as I said above, it did work better with some samples than with
> others, but: it works :-)
>
> Here are three example of what it sounds like, using a modified guitar
> chord sample as response file :
>
> 1 - For this one I softly hit the edge of the pad continuously, and the
> middle of the edge harder once at the beginning of the measure :
> http://samalyse.com/labs/edrum/audio/beat.ogg
>
> 2 - Playing faster ("rolling") with this one :
> http://samalyse.com/labs/edrum/audio/roll.ogg
>
> 3 - Using a pen to hit and scratch the surface. The rubber surface, made of
> several layers of bike tube makes it possible to obtain an interesting
> sound (the input level was not high enough for this one, so I normalized it
> afterward, it could sounds much better I think) :
> http://samalyse.com/labs/edrum/audio/scratch.ogg
>
> As you may see, scratching seems to work fine in here :-)
>
This is so incredibly cool! Is this technique already in wide use somewhere
that I missed? Because if not, it should be. This means that all you need
for an electronic drum set is a multichannel sound card and some homemade
piezo-triggered pads! And I think with some further experimentation with pad
materials and response files, you can probably come up with all kinds of
permutations on the sound. I'd like to hear what this sounds like using some
traditional drum samples ( like a snare or an 808-style kick ). I'm assuming
that the current samples lack "punch" only because they are from a piano
chord response file.
> By the way, Ben, what do you think of my idea of coupling triggering with
> convolution, as stated in my previous mail (above, third paragraph) ?
> Here's a diagram to further describe this idea :
>
> pad signal ----> trigger detection ----> sample playback -----
> Â Â | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â |
> Â Â | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â |
>   ------------------------------------->  convolution  <----
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â |
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â |
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â +--> output
>
> Would this be possible ?
You essentially _have_ the drawing, above. You just can't change the sample
on every hit. I don't know what you expect to achieve. Trust me, what
you've got now is much cooler than a triggered playback (although it does not
sound the same)
It is possible that using a triggered sample or some sort of envelope follower
will be required to get the attack of a traditional drum sound. I'm sure
there are lots of ways to improve this simple system beyond jack_convolve. I
think you've stumbled across a really cool synthesis technique!
-Ben
I believe the C++ standard specifies that vector<> uses contigous memory and that &v[0] returns a valid pointer to an array.
Taybin
-----Original Message-----
From: Chris Cannam <cannam(a)all-day-breakfast.com>
Sent: Jun 8, 2005 4:41 PM
To: linux-audio-dev(a)music.columbia.edu
Cc: Jussi Laako <jussi.laako(a)pp.inet.fi>
Subject: Re: [linux-audio-dev] [ot] [rant] gcc, you let me down one time too many
On Wednesday 08 Jun 2005 21:35, Jussi Laako wrote:
> You can derive a new class from the template and overload the []
> operator to perform exactly same as in C. After compilation the
> result is the same no matter if the template or C array is used.
Are you sure this is still true in the gcc world, after they changed
vector from an array to a real class in gcc 3.3 or whenever it was?
Chris
On Wed, 08 Jun 2005 22:19 , Jussi Laako <jussi.laako(a)pp.inet.fi> sent:
>On Wed, 2005-06-08 at 05:47 -0700, eviltwin69(a)cableone.net wrote:
>
>> I'm working with multibeam sonar, airborne topographic and hydrographic
>> LIDAR, and airborne hyperspectral imagery data.
>
>Sonar and radar applications are very familiar to me. There is no reason
>why those couldn't be very efficient, yet written in C++. My opensource
>HASAS passive sonar signal analysis suite, and the libDSP signal
>processing library it uses, has been written using C++ and asm. I think
>it's still very efficient.
>
>And for example in these kinds of applications the most valuable feature
>is how well it performs it's tasks and reliability. Execution speed is
>secondary. You can buy more CPU power if required. Most large array
>beamformers are heavy SMP systems anyway.
>
We're talking apples and oranges here. You're talking about the real-time
collection of multibeam. That is a piece of cake. I don't mean in terms of the
actual beamforming but in the amount of data per second you have to deal with.
The beamforming is really complicated. I'm talking about post-processing the
data from 7 ships with dual multibeams plus 8 or so hydro survey launches running
dual head multibeams plus a significant number of high-end sidescan systems plus
a plane running hydro and topo LIDAR and hyperspectral. The ships collect data
24/7, the HSLs 10 hours per day. All of these approximately 300 days per year.
The plane collects about 150 days per year, 5 to 6 hours per day. We're
post-processing for hydrographic (and other) types of use. When you're dealing
with tens to hundreds of billions of data points execution speed makes a huge
difference.
>In C/C++ case the performance is more about how you write the code, not
>the language you use.
>
Yes, part of it is about how you write the code but if someone dumps a few
billion data points on you and says "here, check these" then processing speed
becomes extremely important. There have been some very good points made in this
discussion and I will definitely investigate some of them. My problem here is
that I've heard the same type of thing from companies and universities for way
too long. Something along the lines of - "Really, you don't need to write your
own processing code. We collected sonar data for a whole week and we didn't have
any problem processing it with (fill in your favorite GIS or sonar processing
package here)".
Although this thread has about run its course, I would like to continue the
discussion on sonar systems with you off-line if you are interested.
Jan
Greetings:
While waiting for another box I decided to pull the RAM and test each
stick (256 MB each). The problem occurred with either stick. I'm able to
log in, work for a few minutes, then the box just freezes. I can hear
the disk drive make a little activity noise first, then everything's
just gone. Btw, it'll die in X or at the console, it's not an X problem
(I think). And since the problem occurs whether I'm on /dev/hda or
/dev/hdb I doubt if both disk drives are bad.
Anyway, Ivy's bringing over the other machine in another day or so,
I'll switch drives into that machine and see what happens next.
Best,
dp
> Message: 10
> Date: Wed, 08 Jun 2005 15:57:23 +0200
> From: Olivier Guilyardi <ml(a)xung.org>
> Subject: Re: [linux-audio-dev] Re: Software controller for homemade
> Â Â Â Â Â Â Â Â edrums
> To: "The Linux Audio Developers' Mailing List"
> Â Â Â Â Â Â Â Â <linux-audio-dev(a)music.columbia.edu>
> Message-ID: <42A6F943.4080606(a)xung.org>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
> Hi Florian,
>
> Florian Schmidt wrote:
> >For quick tests without libDSP you can tweak the jack_convolve Makefile
> >a little:
> >
> >uncomment the
> >
> >#COMPILE_FLAGS += -DC_CMUL
> >
> >line and remove "-ldsp" from the LINK_FLAGS line. This will use an
> >unoptimized C complex multiplication implementation. jack_convolve will
> >use around 10-20% more cpu than with the libDSP implementation.
> >
> > Â
>
> It did compile. I also needed to remove the #include <dsp/dspop.h> in
> convolve.c
>
> Okay, so I now have an idea of what convolution is. Your little piece of
> software is very nice, very easy to understand. I used three samples : a
> bassdrum, a snare drum, and a short guitar chord. I plugged the output
> of one of my pads into jack_convolve's input and its output into the
> alsa_pcm playback.
>
> Both the bassdrum and the chord sounded quite nice. But the snare drum
> sounded like very far away. I guess this comes from the silence at the
> end of this sample.
>
> What exactly happens with these "response files" ? Should I use very
> simple samples, like a sine wave with no silence ? Shouldn't convolving
> be coupled with trigerring ? I mean : hitting the pad would start the
> sample playback, and the convolving engine would use both this sample
> playback and the pad signal to produce its output. In this case,
> jack_convolve would then need one output and two inputs :
> - one for the pad signal,
> - and one for the "response signal", that is : the sample playback that
> started right when the pad got hit
>
> Is this possible, or do I misunderstand convolution here ?
Olivier, I think the next step is to run jack_convolve, and connect the
soundcard input directly into jack_convolve's input using qjackctl. then
connect the output of jack_convovle to the soundcard's outputs.
(jack_convolve may already do this for you, I can't check just this moment)
Now when you hit a pad, it should be "convolved" with the response signal
giving you something different than the simple "click" of the input signal.
I'm very interested to see how this works out (I suggested this path to
Olivier, I hope it's not totally worthless :) ). It could be a way to build
a cheap, responsive electronic drum kit that preserves the nuances of the
input signal. I wonder if this is how the Korg Wavedrum worked?
-Ben
On Wed, 08 Jun 2005 09:50 , Simon Jenkins <sjenkins(a)blueyonder.co.uk> sent:
>On Tue, 2005-06-07 at 19:34 -0500, Jan Depner wrote:
>> On Tue, 2005-06-07 at 19:20, Dave Robillard wrote:
>> > "Premature optimization is the root of all evil". Using C arrays and
>> > strings for no reason when a much more robust higher level type would
>> > suffice is /just as stupid/ as always using slow high-level operations
>> > in time critical code.
>> >
>> > It's like arguing about, say, assembly vs. perl. Anyone who says one
>> > side is (always) "better" is automatically wrong. :)
>> >
>> True. I usually try to use the right tool for the job.
>> Unfortunately, with the data I work with, the right tool is almost
>> always the fastest tool.
>>
>You must be working with relatively large amounts of relatively simple
>data then.
>
I'm working with multibeam sonar, airborne topographic and hydrographic
LIDAR, and airborne hyperspectral imagery data.
>Suppose I sum a vector of 5 million integers and it takes 6 seconds. And
>assume - (generously![1]) - that I switch to using an array and now it
>only takes 1 second. Hmmm... a 6 * speedup! So I look to see where else
>my code could benefit from this super performance boost.
>
>Aha! Here's a vector of 5,000 oscillator structures, and it takes 5
>seconds to initialise them all. Switch to using an array and... erm...
>now it only takes 4.995 seconds to initialise them all.
>
>I'm sure my users will notice and appreciate the 5ms saving, but I
>suspect I could have served them better by looking at where my code was
>actually spending most of its time before trying to "optimise" it.
>
As far as data volumes go, for your 5 million integers, you're off by about 5
orders of magnitude ;-) So, now that 5ms just became 500 seconds. Yes, my users
do notice and appreciate that time savings ;-)
Jan
>Cheers
>
>Simon
>
>[1] It really was a generous assumption: I've assumed that arrays are
>