Re: [PD] WG: Inverse bandpass filter
I could be wrong, but I don't think it's quite the same thing. I believe the signal would be out of phase negating many of the effects of the filter. I would recommend using [biquad~] and in pd-extended there is a [notch] object which takes care of the coefficients. This sounds much cleaner and more notch-like to my ear than subtracting the filtered output. There is an explanation in Miller's book if you like unit circle math: http://msp.ucsd.edu/techniques/latest/book-html/node144.html --- Message: 4 Date: Tue, 22 Apr 2014 01:59:07 -0300 From: Alexandre Torres Porres por...@gmail.com Subject: Re: [PD] WG: Inverse bandpass filter To: Ingo i...@miamiwave.com Cc: pd-list pd-list@iem.at Message-ID: caeasfmhd0hanlmv9vutcsqzjkzy69i7wmebqq+20s2riwya...@mail.gmail.com Content-Type: text/plain; charset=utf-8 isn't it just subtract the audio from the filtered output? I guess you can get inverse freq response just by that cheers 2014-04-18 17:21 GMT-03:00 Ingo i...@miamiwave.com: You could send the original signal in parallel and invert the phase by multiplying with -1. You might have to delay the original signal in case that the processed signal gets also delayed by one or more blocks. Ingo ___ Von: pd-list-boun...@iem.at [mailto:pd-list-boun...@iem.at] Im Auftrag von AP Vague Gesendet: Freitag, 18. April 2014 18:49 An: pd-list@iem.at Betreff: [PD] Inverse bandpass filter Is there a simple way to make [bp~] or [vcf~] have an inverse function? To filter out, rather than pass a changing frequency value. Is the easiest way to do this with a combination of [lop~] and [hip~]? ___ 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] WG: Inverse bandpass filter
Though with DC you don't have the issue of phase. I'm not an expert in filter math, but I assume that by the time your filtered audio (assuming its not DC) gets subtracted by the [-~] object it is out of phase with the original signal. Moreover, I hear a distinct difference. Maybe I'm not conceiving your statement properly and perhaps this discussion has been about DC all along Regards From: Alexandre Torres Porres por...@gmail.com Date: Tuesday, April 22, 2014 3:51 PM To: GCC rob...@urbanstew.org Cc: apva...@gmail.com, Ingo i...@miamiwave.com, pd-lista puredata pd-list@iem.at Subject: Re: [PD] WG: Inverse bandpass filter can;t remember where I saw about this, but check this link http://msp.ucsd.edu/techniques/v0.11/book-html/node141.html see the quote An easy and practical way to remove the zero-frequency component from an audio signal is to use a one-pole low-pass filter to extract it, and then subtract the result from the signal. The resulting transfer function is one minus the transfer function of the low-pass filter: doesn't it agree with what I said? cheers 2014-04-22 14:37 GMT-03:00 Robert Esler rob...@urbanstew.org: I could be wrong, but I don't think it's quite the same thing. I believe the signal would be out of phase negating many of the effects of the filter. I would recommend using [biquad~] and in pd-extended there is a [notch] object which takes care of the coefficients. This sounds much cleaner and more notch-like to my ear than subtracting the filtered output. There is an explanation in Miller's book if you like unit circle math: http://msp.ucsd.edu/techniques/latest/book-html/node144.html --- Message: 4 Date: Tue, 22 Apr 2014 01:59:07 -0300 From: Alexandre Torres Porres por...@gmail.com Subject: Re: [PD] WG: Inverse bandpass filter To: Ingo i...@miamiwave.com Cc: pd-list pd-list@iem.at Message-ID: caeasfmhd0hanlmv9vutcsqzjkzy69i7wmebqq+20s2riwya...@mail.gmail.com Content-Type: text/plain; charset=utf-8 isn't it just subtract the audio from the filtered output? I guess you can get inverse freq response just by that cheers 2014-04-18 17:21 GMT-03:00 Ingo i...@miamiwave.com: You could send the original signal in parallel and invert the phase by multiplying with -1. You might have to delay the original signal in case that the processed signal gets also delayed by one or more blocks. Ingo ___ Von: pd-list-boun...@iem.at [mailto:pd-list-boun...@iem.at] Im Auftrag von AP Vague Gesendet: Freitag, 18. April 2014 18:49 An: pd-list@iem.at Betreff: [PD] Inverse bandpass filter Is there a simple way to make [bp~] or [vcf~] have an inverse function? To filter out, rather than pass a changing frequency value. Is the easiest way to do this with a combination of [lop~] and [hip~]? ___ 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] Inverse bandpass filter
I think what you're asking is how would one create a stop-band filter, or otherwise known as a notch filter. There is no standalone notch filter in pd-vanilla that I know of, however, I usually use the [biquad~] object and look up the appropriate coefficients for the frequency I'm notching. I believe this can also be done with [cpole~] and [czero~], which is shown in the pd-help H12.peaking.pd. Otherwise, there may be a stop-band floating around in a pd-extended library somewhere. - Robert Esler ___ Pd-list@iem.at mailing list UNSUBSCRIBE and account-management - http://lists.puredata.info/listinfo/pd-list
Re: [PD] Strange behavior using custom external
Thanks for the advice on the setup function. I spent a few hours debugging and seemed to have fixed the problem. Though it is still mysterious to me why the memory corruption was happening the way it did, I traced it down to how I had declared my C++ object. Initially, I had declared my object in a single function and sent data to the Pd class struct. Such as: static myObject n; x-someInt = n.someFunction(); I moved my C++ object declaration to the Pd class struct as a pointer then allocated its memory in the _new() function and deallocating in the _free() function. This seems to have cleaned up the memory from my C++ object, since I need the initial instance of the object to last the lifetime of the Pd object. Though oddly, this didn't work the first time, I also had to do the same procedure with a std::vectordouble declaration too. Since then the error has not occurred again. Below is my class struct now. Not sure why declaring my C++ object or the vector as a pointer is necessary but clearly it worked. Thanks again for everyone's help. static t_class *rhynamo_class; typedef struct _rhynamo { t_object x_obj; t_clock *x_clock; t_outlet *l_out; std::vectordouble *delay; _attributes A; int x_hit; int x_increment; double x_delay; Rhythm *rhythm; } t_rhynamo; On Feb 28, 2014, at 8:45 AM, Charles Z Henry czhe...@gmail.com wrote: You can make these changes (one from IOhannes and two of my suggestions in-line below) and see if the error is gone. My guess is: probably not. I didn't see any glaring problems that would cause memory corruption. Could you also show us your rhynamo_set(symbol, float) function? Does the error occur *only* after the set function gets used? If for some reason, these small changes do fix your issue, just back up and make one change at a time, and check if you can reproduce the error each time. I'd be interested to know what actually causes it. On Thu, Feb 27, 2014 at 6:13 PM, GCC rob...@urbanstew.org wrote: Below is my setup method. This object generates rhythmic phrases so it accesses the time scheduler in Pd as per the code [metro] or [delay], and outputs a bang. Perhaps this could be where it goes wrong? Thanks for your time and help. -Rob --- void rhynamo_setup(void) { rhynamo_class = class_new(gensym(rhynamo), (t_newmethod)rhynamo_new, (t_method)delay_free, sizeof(t_rhynamo), CLASS_DEFAULT, A_GIMME, 0); post([rhynamo] a rhythmic generator v .02 : by Robert Esler 2014); class_addbang (rhynamo_class, rhynamo_bang); class_addfloat(rhynamo_class, (t_method)rhynamo_generate); class_addsymbol(rhynamo_class, (t_method)rhynamo_set); ^--I don't think you need the addsymbol line. The rhynamo_set function access is provided by the next addmethod line, immediately below. class_addmethod(rhynamo_class, (t_method)rhynamo_set, gensym(set), A_DEFSYMBOL, A_DEFFLOAT, 0); class_addmethod(rhynamo_class, (t_method)rhynamo_generate, gensym(generate), A_FLOAT, 0); ^--This line should have A_DEFFLOAT instead of A_FLOAT. class_sethelpsymbol(rhynamo_class, gensym(help-rhynamo)); } - Date: Thu, 27 Feb 2014 14:15:05 -0600 From: Charles Z Henry czhe...@gmail.com Subject: Re: [PD] Strange behavior using custom external To: Robert Esler rob...@urbanstew.org Cc: pd-list pd-list@iem.at Message-ID: capfmnofa_cprs4ux0yg1yy7hfsgrpt79b+felj5kzf1frd0...@mail.gmail.com Content-Type: text/plain; charset=utf-8 The difference probably indicates that something is going on in your _setup() function. Once you've loaded a class in a patch, it stays in memory. If you close the patch, and open another patch without the class, you may still see the effects---but if you close pd, and reopen without using the class, you should not see the effects at all. The backtrace shows a seg fault from calls in binbuf_eval, which is the code related to parsing and loading a patch. You might just have passed a struct as an argument, where it's expected to be an element of that struct. Although pointer type mismatches will definitely throw a compiler warning you should have seen already. Would you post the _setup() function? Chuck ___ Pd-list@iem.at mailing list UNSUBSCRIBE and account-management - http://lists.puredata.info/listinfo/pd-list
Re: [PD] Strange behavior using custom external
Hi Chuck, If I create another patch w/o the external I don't get this behavior at all. Though if I create the patch w/ the external then delete it, save it and open it, there have been times where the behavior returns w/o the external. I'll go through my pd object code again. As you mention there could be symbol pointer that is not accessed or allocated correctly. -Rob On Feb 26, 2014, at 4:09 PM, Charles Z Henry czhe...@gmail.com wrote: Hi Robert, Just to clarify--have you also observed the error in any patches where you have not loaded the external? For example, if you take your patch, remove the external and save as test.pd, will the word tempo appear correctly and without replacement? This sounds to me like a mismatched type, like a symbol pointer foo being used in place of a string like foo-s_name ... but I'm confused as to how that's occurring inside the text of a message box (not my best subject anyhow) Chuck On Wed, Feb 26, 2014 at 4:22 PM, Robert Esler rob...@urbanstew.org wrote: Hello everyone, I'm having a strange issue with a custom external built using C++. When using my external in Pd I send it set commands using a message box to change internal parameters, e.g [set tempo $1( The strange behavior is as follows: 1) Sometimes when opening the patch the word tempo as referenced above gets changed to some nonsensical characters or is missing altogether. So my message looks like [set ðLᄌ $1( or [set $1(, even though it was saved as [set tempo $1(. 2) When the behavior above does not occur (e.g #1) and the message is preserved upon opening, it only will work as written once then the second time the message is nonsense again but does not actually display as having changed. So the GUI still reads [set tempo $1( but actually prints to the Pd window as: print: set ðLᄌ 140. 3) At times when running my object, after #2 has happened, Pd crashes and leaves a trace to: Exception Type: EXC_BAD_ACCESS (SIGSEGV) Exception Codes: KERN_INVALID_ADDRESS at 0x100b1a6a VM Regions Near 0x100b1a6a: __LINKEDIT 080a4000-080a5000 [4K] r--/rwx SM=COW /Applications/Pd-extended.app/Contents/Resources/extra/pddp/pddplink.pd_darwin -- __TEXT 7000-7015f000 [ 1404K] r-x/rwx SM=COW /System/Library/Components/CoreAudio.component/Contents/MacOS/CoreAudio Thread 0 Crashed:: Dispatch queue: com.apple.main-thread 0 libsystem_c.dylib 0x903833f0 strcmp + 80 1 pdextended0x0001c493 gatom_key + 305 2 pdextended0x000386cf canvas_key + 1659 3 pdextended0x000540b0 pd_typedmess + 740 4 pdextended0x00054107 pd_typedmess + 827 5 pdextended0x00058394 binbuf_eval + 1224 6 pdextended0x0006255c socketreceiver_read + 1734 7 pdextended0x0006111c sys_domicrosleep + 381 8 pdextended0x000611a8 sys_microsleep + 19 9 pdextended0x0005e413 m_mainloop + 989 10 pdextended0x00060e4b sys_main + 2909 11 pdextended0x2172 _start + 216 12 pdextended0x2099 start + 41 --- Right now I'm using Pd-extended 42.5, Mac OS X 10.8.5 I'm happy to supply more code, examples, details, etc. if someone can help. Much appreciated, Rob ___ 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] Strange behavior using custom external
Hello everyone, I'm having a strange issue with a custom external built using C++. When using my external in Pd I send it set commands using a message box to change internal parameters, e.g [set tempo $1( The strange behavior is as follows: 1) Sometimes when opening the patch the word tempo as referenced above gets changed to some nonsensical characters or is missing altogether. So my message looks like [set ðLᄌ $1( or [set $1(, even though it was saved as [set tempo $1(. 2) When the behavior above does not occur (e.g #1) and the message is preserved upon opening, it only will work as written once then the second time the message is nonsense again but does not actually display as having changed. So the GUI still reads [set tempo $1( but actually prints to the Pd window as: print: set ðLᄌ 140. 3) At times when running my object, after #2 has happened, Pd crashes and leaves a trace to: Exception Type: EXC_BAD_ACCESS (SIGSEGV) Exception Codes: KERN_INVALID_ADDRESS at 0x100b1a6a VM Regions Near 0x100b1a6a: __LINKEDIT 080a4000-080a5000 [4K] r--/rwx SM=COW /Applications/Pd-extended.app/Contents/Resources/extra/pddp/pddplink.pd_darwin -- __TEXT 7000-7015f000 [ 1404K] r-x/rwx SM=COW /System/Library/Components/CoreAudio.component/Contents/MacOS/CoreAudio Thread 0 Crashed:: Dispatch queue: com.apple.main-thread 0 libsystem_c.dylib 0x903833f0 strcmp + 80 1 pdextended 0x0001c493 gatom_key + 305 2 pdextended 0x000386cf canvas_key + 1659 3 pdextended 0x000540b0 pd_typedmess + 740 4 pdextended 0x00054107 pd_typedmess + 827 5 pdextended 0x00058394 binbuf_eval + 1224 6 pdextended 0x0006255c socketreceiver_read + 1734 7 pdextended 0x0006111c sys_domicrosleep + 381 8 pdextended 0x000611a8 sys_microsleep + 19 9 pdextended 0x0005e413 m_mainloop + 989 10 pdextended 0x00060e4b sys_main + 2909 11 pdextended 0x2172 _start + 216 12 pdextended 0x2099 start + 41 --- Right now I'm using Pd-extended 42.5, Mac OS X 10.8.5 I'm happy to supply more code, examples, details, etc. if someone can help. Much appreciated, Rob ___ Pd-list@iem.at mailing list UNSUBSCRIBE and account-management - http://lists.puredata.info/listinfo/pd-list