Re: [PD] manipulation of symbols?

2010-11-02 Thread Frank Barknecht
Hi,

On Mon, Nov 01, 2010 at 08:01:43PM +0100, João Pais wrote:
 is there any object that allows a more extended manipulation of symbols?  
 For example, I have symbols with the format 1234-56-78_12-23.aaa, and I  
 wanted to get only the floats inside, and use them on mathematics. For  
 now, the only way I see to do that is to use several [splitfilename -],  
 until all the individual elements are separated. Or is it possible to do  
 that with sprintf?

It probably is possible, but as bigger text manipulations IMO are better dealt
with outside of the Pd language, why not learn Lua now and use the
pdlua external to write your own powerful text manipulation objectsr? Or Python,
but pdlua is much easier to install.

Ciao
-- 
 Frank BarknechtDo You RjDj.me?  _ __footils.org__

___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] manipulation of symbols? - lua windows binaries

2010-11-02 Thread João Pais
It probably is possible, but as bigger text manipulations IMO are better  
dealt

with outside of the Pd language, why not learn Lua now and use the
pdlua external to write your own powerful text manipulation objectsr? Or  
Python,

but pdlua is much easier to install.


hmm, the problem is that I'm mainly on windows, as looking at  
https://code.goto10.org/svn/maximus/releases/pdlua-0.5, there are no  
binaries available. but yes, learning that would also save me some work on  
other projects as well.


are there any windows binaries of lua available somewhere?

João

___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] manipulation of symbols?

2010-11-02 Thread João Pais

thanks. I did it for now using splitfilename, s2l and unpack.


Here's a way using zexy/s2l and l2s (see attached).  Or you could
use some of the objects from jasch_lib + cyclone/fromsymbol.

-Jonathan

--- On Mon, 11/1/10, João Pais jmmmp...@googlemail.com wrote:


From: João Pais jmmmp...@googlemail.com
Subject: [PD] manipulation of symbols?
To: PD-List pd-list@iem.at
Date: Monday, November 1, 2010, 8:01 PM
Hi,

is there any object that allows a more extended
manipulation of symbols? For example, I have symbols with
the format 1234-56-78_12-23.aaa, and I wanted to get only
the floats inside, and use them on mathematics. For now, the
only way I see to do that is to use several [splitfilename
-], until all the individual elements are separated. Or is
it possible to do that with sprintf?

Thanks,

João


--Friedenstr. 58
10249 Berlin (Deutschland)
Tel +49 30 42020091 | Mob +49 162 6843570
Studio +49 30 69509190
jmmmp...@googlemail.com
| skype: jmmmpjmmmp

___
Pd-list@iem.at
mailing list
UNSUBSCRIBE and account-management -  
http://lists.puredata.info/listinfo/pd-list









--
Friedenstr. 58
10249 Berlin (Deutschland)
Tel +49 30 42020091 | Mob +49 162 6843570
Studio +49 30 69509190
jmmmp...@googlemail.com | skype: jmmmpjmmmp

___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


[PD] soundifle_info bug with big files?

2010-11-02 Thread João Pais

Hi,

I'm trying out soundfile_info, and with a file with 2,7Gb (~3h, 44100Hz,  
24b), I get a sample count of -7. Probably a bug, is this the exponential  
of the number?


With other files up to 1,8Gb it works well, though.

Pd-ext 0.42-5, XP. (I can try later in ubuntu, if I get the chance)

João Pais

--
Friedenstr. 58
10249 Berlin (Deutschland)
Tel +49 30 42020091 | Mob +49 162 6843570
Studio +49 30 69509190
jmmmp...@googlemail.com | skype: jmmmpjmmmp

___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] soundifle_info bug with big files?

2010-11-02 Thread Andy Farnell


Not so much a bug as a legacy of wav file format having
a header that limits the size to  2GB


 

On Tue, 02 Nov 2010 12:28:08 +0100
João Pais jmmmp...@googlemail.com wrote:

 Hi,
 
 I'm trying out soundfile_info, and with a file with 2,7Gb (~3h, 44100Hz,  
 24b), I get a sample count of -7. Probably a bug, is this the exponential  
 of the number?
 
 With other files up to 1,8Gb it works well, though.
 
 Pd-ext 0.42-5, XP. (I can try later in ubuntu, if I get the chance)
 
 João Pais
 
 -- 
 Friedenstr. 58
 10249 Berlin (Deutschland)
 Tel +49 30 42020091 | Mob +49 162 6843570
 Studio +49 30 69509190
 jmmmp...@googlemail.com | skype: jmmmpjmmmp
 
 ___
 Pd-list@iem.at mailing list
 UNSUBSCRIBE and account-management - 
 http://lists.puredata.info/listinfo/pd-list


-- 
Andy Farnell padawa...@obiwannabe.co.uk

___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] Non-Linear Quantization / Bitcrush

2010-11-02 Thread Ludwig Maes
could you give examples of idealized input and output for cases 1-4?
im not sure I understand what exactly you want...

interested greetings!
Ludwig

On 1 November 2010 13:09, brandon zeeb zeeb.bran...@gmail.com wrote:
 Hey All,

 I've been burning my brain over this issue lately and I can't seem to come
 up with an elegant solution, and stay with me here as I attempt to explain
 it best I can.  For me and my needs, being able to quantize an arbitrary
 signal to any arbitrary series is the Holy Grail (and I'm not talking about
 simple table lookup!).

 I'm looking to quantize an incoming signal (or value) given a max and min
 quantization value and an arbitrary curve.  Think quantization of note
 events to a series of note lengths or your standard bitcrush algorithm, it's
 pretty much the same.  The arbitrary curve should influence the degree to
 which the bitcrush algorithm is applied to the signal such that one could
 have less quantization at smaller values of the input signal, and greater
 quantization and larger values (or vice versa).  Simple table-lookup is
 insufficient as it requires you to pre-define a maximum input signal
 amount.  I'm willing to waive this requirement if an implementation is not
 possible without it.

 This will be used in the following circumstances:

 To quantize envelopes signals to any arbitrary series (say !, Fibonacci,
 x^2, 2^x, etc)
 To quantize signal loop length values to an arbitrary series of note values
 (say 1/16, 1/8, 1/2, 1/1)
 To apply non-linear bitcrushing to a signal such that higher values are
 expressed with less of an effect than smaller values
 To quantize pitch events to a pre-defined series


 Is this making sense?

 My attempts thus far has extended the RjDj bitcrush abstraction with mild
 success.  I can recreate the effect but the output signal bears too many
 artifacts from the input signal (ie: the curve retains part of it's original
 slope from the input signal and is not flattened or held until the next
 value).

 Thanks,
 ~Brandon

 ___
 Pd-list@iem.at mailing list
 UNSUBSCRIBE and account-management -
 http://lists.puredata.info/listinfo/pd-list



___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] [PD-ot] RSS feeds from puredata.info

2010-11-02 Thread Jack
Hello,

I still have this problem about RSS feeds on puredata.info :
The latest new seems to be 'pcap (forPD) 0.0.5: pdpcap renamed' but i
haven't this new in my feeds.

The new on the main page of puredata.info seems to be updated, but
neither on http://puredata.info/news/RSS nor http://puredata.info/news.

Any ideas about this problem ?
++

Jack



Le mercredi 30 septembre 2009 à 03:11 +0200, Jack a écrit :
 OK, it is working now :)
 Thanx a lot.
 ++
 
 Jack
 
 
 Le lundi 28 septembre 2009 à 19:36 +0200, Jack a écrit :
  Hello,
  
  I have always a little problem about the dates.
  The latest new seems to be 'Gem 0.92.1 released!' but i haven't this
  line in my feeds.
  Why, on the puredata.info, this line is on the second page of news :
  http://puredata.info/news/folder_summary_view?b_start:int=20
  and not here :
  http://puredata.info/news
  I think the problem come from this dates classification.
  If you go on :
  http://puredata.info/news/RSS
  you can see there is no trace of 'Gem 0.92.1 released!'.
  Thanx !
  ++
  
  Jack
  
  
  Le lundi 14 septembre 2009 à 18:56 +0200, Jack a écrit :
   Ok, excellent now ! no more problem with the date order.
   ++
   
   Jack
   
   
   Le jeudi 10 septembre 2009 à 13:56 +0200, Jack a écrit :
Yep ! it works now.
Very nice job Iohannes and thanx again for your effort and for the last
release of GEM.
Just a last remark : i get the news in wrong order in Drupal because, i
think,  you touched the old feeds :) So Gem 0.92.0 released! is the
last news (you can see the last update of the news with something like
'3 hours 40 min ago'). Here is what i get :

pdcon09 papers 
3 hours 26 min ago 
papers presented at the pdcon09 available for download! 
Categories: PureData/GEM 
Pd-extended 0.41.4 released! 
3 hours 26 min ago 
Categories: PureData/GEM 
new Pd book:loadbang - Programming Electronic Music in Pd 
3 hours 26 min ago 
Johannes Kreidler released his Pd-tutorial. He wrote the tutorial in the
last years with the help of a grant by the Music University of
Freiburg / Germany, is now online, in english and in german. It is also
available as a book (paperback) at Wolke Publishing House. 
Categories: PureData/GEM 
Pd 0.42-5 released 
3 hours 27 min ago 
Pd version 0.42-5 is ready 
Categories: PureData/GEM 
Gem 0.92.0 released! 
3 hours 40 min ago 
Gem 0.92.0 has been released 
Categories: PureData/GEM 

++

Jack


Le jeudi 10 septembre 2009 à 10:35 +0200, IOhannes m zmoelnig a écrit :
 IOhannes m zmoelnig wrote:
  
  my guess is, that feeds works correctly, but drupal uses some 
  timeout 
  mechanism in order to discard old items.
  since the news feed on puredata is not very heavily used, most 
  items are 
  already too old to be included in the drupal aggregator.
 
 and with this in mind i checked the settings of the drupal feed 
 aggregator and indeed it does say discard items older than: '16 
 weeks'
 
 seems to be a debatable feature of drupal; see 
 http://drupal.org/node/60468
 
 
 fgadmr
 IOhannes


___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list
   
   
   ___
   Pd-list@iem.at mailing list
   UNSUBSCRIBE and account-management - 
   http://lists.puredata.info/listinfo/pd-list
  
  
  ___
  Pd-list@iem.at mailing list
  UNSUBSCRIBE and account-management - 
  http://lists.puredata.info/listinfo/pd-list
 
 
 ___
 Pd-list@iem.at mailing list
 UNSUBSCRIBE and account-management - 
 http://lists.puredata.info/listinfo/pd-list



___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] Non-Linear Quantization / Bitcrush

2010-11-02 Thread brandon zeeb
I've attached my best attempt at recreating this effect, the attached PNG
will be used as a reference.

Given the distance d1 and d2, these distances are usually identical in a
traditional bitcrush or simple quantization.  I would like to be able to
vary the distance between points of an incoming signal such that the
distance between points is a function of a given quantization value, the
current Y value, AND a given quantization curve.

As a first step (and illustrated in the attached PNG), smaller values of Y
will produce a more pronounced quantization given a x^2 quantization curve
while larger values of Y will produce a smaller distance between steps.

Ideas?

~Brandon

On Tue, Nov 2, 2010 at 10:47 AM, Ludwig Maes ludwig.m...@gmail.com wrote:

 could you give examples of idealized input and output for cases 1-4?
 im not sure I understand what exactly you want...

 interested greetings!
 Ludwig

 On 1 November 2010 13:09, brandon zeeb zeeb.bran...@gmail.com wrote:
  Hey All,
 
  I've been burning my brain over this issue lately and I can't seem to
 come
  up with an elegant solution, and stay with me here as I attempt to
 explain
  it best I can.  For me and my needs, being able to quantize an arbitrary
  signal to any arbitrary series is the Holy Grail (and I'm not talking
 about
  simple table lookup!).
 
  I'm looking to quantize an incoming signal (or value) given a max and min
  quantization value and an arbitrary curve.  Think quantization of note
  events to a series of note lengths or your standard bitcrush algorithm,
 it's
  pretty much the same.  The arbitrary curve should influence the degree to
  which the bitcrush algorithm is applied to the signal such that one could
  have less quantization at smaller values of the input signal, and greater
  quantization and larger values (or vice versa).  Simple table-lookup is
  insufficient as it requires you to pre-define a maximum input signal
  amount.  I'm willing to waive this requirement if an implementation is
 not
  possible without it.
 
  This will be used in the following circumstances:
 
  To quantize envelopes signals to any arbitrary series (say !, Fibonacci,
  x^2, 2^x, etc)
  To quantize signal loop length values to an arbitrary series of note
 values
  (say 1/16, 1/8, 1/2, 1/1)
  To apply non-linear bitcrushing to a signal such that higher values are
  expressed with less of an effect than smaller values
  To quantize pitch events to a pre-defined series
 
 
  Is this making sense?
 
  My attempts thus far has extended the RjDj bitcrush abstraction with mild
  success.  I can recreate the effect but the output signal bears too many
  artifacts from the input signal (ie: the curve retains part of it's
 original
  slope from the input signal and is not flattened or held until the next
  value).
 
  Thanks,
  ~Brandon
 
  ___
  Pd-list@iem.at mailing list
  UNSUBSCRIBE and account-management -
  http://lists.puredata.info/listinfo/pd-list
 
 




-- 
Brandon Zeeb
Columbus, Ohio
attachment: my-crush-ex.png

my-crush.pd
Description: Binary data
___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] Non-Linear Quantization / Bitcrush

2010-11-02 Thread brandon zeeb
This is even better.  If I could minimize the jumps around Y = 0.5 to -0.5
It'll be exactly what I'm looking for... or a start at least.

Do you see what I mean now?  See how the amount of quantization changes with
Y and a minimum quantization value?

I think I'm getting towards the answer now...

-- 
Brandon Zeeb
Columbus, Ohio
attachment: my-crush2-ex.png

my-crush2.pd
Description: Binary data
___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


[PD] [PD-announce] Linux Audio Conference - Call for Participation - website

2010-11-02 Thread Robin Gareus
[Apologies for cross-postings] [Please distribute]

Paper-submission, call-for-music and registration are now open
for the Linux Audio Conference 2011 - May 6-8 2011, Maynooth, Ireland

More information: http://lac.linuxaudio.org/2011/

As in previous years, we will have a full program of talks, workshops
and music.

The Linux Audio Conference 2011 will include several concerts. We are
looking for music that has been produced or composed entirely or mostly
using GNU/Linux or other Open Source music software for:
* The Electroacoustic Music Concerts
* The Linux Sound Night
* Sound installations

___
Pd-announce mailing list
pd-annou...@iem.at
http://lists.puredata.info/listinfo/pd-announce

___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] Non-Linear Quantization / Bitcrush

2010-11-02 Thread Ludwig Maes
So you want amplitude 'a' dependant quantization size 'q' ? take your
chosen q(a); in your example it seems you want a simple line:
q=q(0)-k*a;
define f(a) as integral of 1/q from a=0 to a; also calculate the
inverse of f(a) i.e. a(f);

now for each sample do: out=a(round(f(in))) where round is any floor
or the like...

have fun!

ps:

in your example: q=q0-k*a with for example q(0)=0.001 and
q(0.8)=0.0001: q:=0.001-0.0009/0.8*a
then f=2558.427881-.11*ln(10.-9.*a)
and inverse=easy


On 2 November 2010 19:20, Ludwig Maes ludwig.m...@gmail.com wrote:
 This is pretty easy actually, I use such things mostly to guide my
 rhythmical quantization...

 On 2 November 2010 19:19, brandon zeeb zeeb.bran...@gmail.com wrote:
 This is even better.  If I could minimize the jumps around Y = 0.5 to -0.5
 It'll be exactly what I'm looking for... or a start at least.

 Do you see what I mean now?  See how the amount of quantization changes with
 Y and a minimum quantization value?

 I think I'm getting towards the answer now...

 --
 Brandon Zeeb
 Columbus, Ohio




___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] Non-Linear Quantization / Bitcrush

2010-11-02 Thread Ludwig Maes
The reason you use the inverse is so that the amplitude remains the
same albeit quantized. The reason we use another function before
flooring is to distritube the floor levels.But afterwards we need to
bring the values back to their original place

On 2 November 2010 19:37, Ludwig Maes ludwig.m...@gmail.com wrote:
 So you want amplitude 'a' dependant quantization size 'q' ? take your
 chosen q(a); in your example it seems you want a simple line:
 q=q(0)-k*a;
 define f(a) as integral of 1/q from a=0 to a; also calculate the
 inverse of f(a) i.e. a(f);

 now for each sample do: out=a(round(f(in))) where round is any floor
 or the like...

 have fun!

 ps:

 in your example: q=q0-k*a with for example q(0)=0.001 and
 q(0.8)=0.0001: q:=0.001-0.0009/0.8*a
 then f=2558.427881-.11*ln(10.-9.*a)
 and inverse=easy


 On 2 November 2010 19:20, Ludwig Maes ludwig.m...@gmail.com wrote:
 This is pretty easy actually, I use such things mostly to guide my
 rhythmical quantization...

 On 2 November 2010 19:19, brandon zeeb zeeb.bran...@gmail.com wrote:
 This is even better.  If I could minimize the jumps around Y = 0.5 to -0.5
 It'll be exactly what I'm looking for... or a start at least.

 Do you see what I mean now?  See how the amount of quantization changes with
 Y and a minimum quantization value?

 I think I'm getting towards the answer now...

 --
 Brandon Zeeb
 Columbus, Ohio





___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] Non-Linear Quantization / Bitcrush

2010-11-02 Thread Ludwig Maes
And we want f' to be 1 (integer step) / (per) quantization size (for
that amplitude)


On 2 November 2010 19:41, Ludwig Maes ludwig.m...@gmail.com wrote:
 The reason you use the inverse is so that the amplitude remains the
 same albeit quantized. The reason we use another function before
 flooring is to distritube the floor levels.But afterwards we need to
 bring the values back to their original place

 On 2 November 2010 19:37, Ludwig Maes ludwig.m...@gmail.com wrote:
 So you want amplitude 'a' dependant quantization size 'q' ? take your
 chosen q(a); in your example it seems you want a simple line:
 q=q(0)-k*a;
 define f(a) as integral of 1/q from a=0 to a; also calculate the
 inverse of f(a) i.e. a(f);

 now for each sample do: out=a(round(f(in))) where round is any floor
 or the like...

 have fun!

 ps:

 in your example: q=q0-k*a with for example q(0)=0.001 and
 q(0.8)=0.0001: q:=0.001-0.0009/0.8*a
 then f=2558.427881-.11*ln(10.-9.*a)
 and inverse=easy


 On 2 November 2010 19:20, Ludwig Maes ludwig.m...@gmail.com wrote:
 This is pretty easy actually, I use such things mostly to guide my
 rhythmical quantization...

 On 2 November 2010 19:19, brandon zeeb zeeb.bran...@gmail.com wrote:
 This is even better.  If I could minimize the jumps around Y = 0.5 to -0.5
 It'll be exactly what I'm looking for... or a start at least.

 Do you see what I mean now?  See how the amount of quantization changes 
 with
 Y and a minimum quantization value?

 I think I'm getting towards the answer now...

 --
 Brandon Zeeb
 Columbus, Ohio






___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] Non-Linear Quantization / Bitcrush

2010-11-02 Thread Ludwig Maes
Watch out in my numeric example, I was a bit careless and the q I
chose continues to increase for more and more negative amplitudes!

On 2 November 2010 19:44, Ludwig Maes ludwig.m...@gmail.com wrote:
 And we want f' to be 1 (integer step) / (per) quantization size (for
 that amplitude)


 On 2 November 2010 19:41, Ludwig Maes ludwig.m...@gmail.com wrote:
 The reason you use the inverse is so that the amplitude remains the
 same albeit quantized. The reason we use another function before
 flooring is to distritube the floor levels.But afterwards we need to
 bring the values back to their original place

 On 2 November 2010 19:37, Ludwig Maes ludwig.m...@gmail.com wrote:
 So you want amplitude 'a' dependant quantization size 'q' ? take your
 chosen q(a); in your example it seems you want a simple line:
 q=q(0)-k*a;
 define f(a) as integral of 1/q from a=0 to a; also calculate the
 inverse of f(a) i.e. a(f);

 now for each sample do: out=a(round(f(in))) where round is any floor
 or the like...

 have fun!

 ps:

 in your example: q=q0-k*a with for example q(0)=0.001 and
 q(0.8)=0.0001: q:=0.001-0.0009/0.8*a
 then f=2558.427881-.11*ln(10.-9.*a)
 and inverse=easy


 On 2 November 2010 19:20, Ludwig Maes ludwig.m...@gmail.com wrote:
 This is pretty easy actually, I use such things mostly to guide my
 rhythmical quantization...

 On 2 November 2010 19:19, brandon zeeb zeeb.bran...@gmail.com wrote:
 This is even better.  If I could minimize the jumps around Y = 0.5 to -0.5
 It'll be exactly what I'm looking for... or a start at least.

 Do you see what I mean now?  See how the amount of quantization changes 
 with
 Y and a minimum quantization value?

 I think I'm getting towards the answer now...

 --
 Brandon Zeeb
 Columbus, Ohio







___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] Non-Linear Quantization / Bitcrush

2010-11-02 Thread brandon zeeb
Great!  Unfortunately, I'm not entirely sure how to realize this in Pd.  Can
you help me out with a little example?

Thanks

On Tue, Nov 2, 2010 at 2:37 PM, Ludwig Maes ludwig.m...@gmail.com wrote:

 So you want amplitude 'a' dependant quantization size 'q' ? take your
 chosen q(a); in your example it seems you want a simple line:
 q=q(0)-k*a;
 define f(a) as integral of 1/q from a=0 to a; also calculate the
 inverse of f(a) i.e. a(f);

 now for each sample do: out=a(round(f(in))) where round is any floor
 or the like...

 have fun!

 ps:

 in your example: q=q0-k*a with for example q(0)=0.001 and
 q(0.8)=0.0001: q:=0.001-0.0009/0.8*a
 then f=2558.427881-.11*ln(10.-9.*a)
 and inverse=easy


 On 2 November 2010 19:20, Ludwig Maes ludwig.m...@gmail.com wrote:
  This is pretty easy actually, I use such things mostly to guide my
  rhythmical quantization...
 
  On 2 November 2010 19:19, brandon zeeb zeeb.bran...@gmail.com wrote:
  This is even better.  If I could minimize the jumps around Y = 0.5 to
 -0.5
  It'll be exactly what I'm looking for... or a start at least.
 
  Do you see what I mean now?  See how the amount of quantization changes
 with
  Y and a minimum quantization value?
 
  I think I'm getting towards the answer now...
 
  --
  Brandon Zeeb
  Columbus, Ohio
 
 
 




-- 
Brandon Zeeb
Columbus, Ohio
___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


[PD] -lib segfault : tool to help reporting crashes (linux only)

2010-11-02 Thread Mathieu Bouchard


I don't remember whether I posted this before. It's an external that 
doesn't define any classes, but installs a crash report handler that 
prints to the terminal. It requires execinfo.h which is linux-specific. 
It decodes C++ symbols using cxxabi.h (provided by glibc). This means 
you don't need to run gdb to get a basic listing of what happens. However 
you will still need gdb if you need to know what the function arguments 
were.


If you run an older version of GridFlow (9.11 or earlier) you will need to 
ensure segfault appears after gridflow in the Startup menu. If not, 
the order does not matter (unless you need to trap a crash at load-time).


--8cut-here8--

// segfault.cxx 1.0 by Mathieu Bouchard, 2010
// compile with : g++ segfault.cxx -shared -o segfault.pd_linux

#include stdio.h
#include string.h
#include unistd.h
#include execinfo.h
#include signal.h
#include cxxabi.h

static void fault (int sig) {
  const char *s;
  if (sig==SIGSEGV) s=Segmentation Fault;
  if (sig==SIGABRT) s=Abort;
  if (sig==SIGILL)  s=Invalid Instruction;
  if (sig==SIGBUS)  s=Bus Error;
  fprintf(stderr,\n-- caught %s\n,s);
#if defined(MACOSX) || defined(__WIN32__)
  fprintf(stderr,unhandled exception\n);
#else
  void *array[100]; char demangled[1024]; size_t length=1024; int status;
  int nSize = backtrace(array,100);
  char **symbols = backtrace_symbols(array, nSize);
//  for (int i=0; inSize; i++) fprintf(stderr,%d: %s\n,i,symbols[i]);
  for (int i=1; inSize; i++) {
char *a = strchr(symbols[i],'(');
char *b = strchr(symbols[i],'+');
if (ab) {
char mangled[1024]; 
sprintf(mangled,%.*s,int(b-a-1),a+1);
if 
(abi::__cxa_demangle(mangled,demangled,length,status))
fprintf(stderr,%3d: 
%.*s\n,i,int(length),demangled);

else
fprintf(stderr,%3d: %s\n,i,symbols[i]);
}
elsefprintf(stderr,%3d: %s\n,i,symbols[i]);
  }
#endif
  fprintf(stderr, crash report displayed by segfault.pd_linux 1.0 
(by matju)\n\n);

  signal(sig,SIG_DFL);
  _exit(128+sig);
}

extern C void segfault_setup (void) {
  signal(SIGSEGV,fault);
  signal(SIGABRT,fault);
  signal(SIGILL, fault);
  signal(SIGBUS, fault);
}

 ___
| Mathieu Bouchard -- Villeray, Montréal, QC___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list