Designing Audio Objects – updates

I will post updates here documenting any reported changes to IDEs, code, or other matters which might be helpful for readers of “Designing Audio Objects.” I’m currently writing a new book on sound design, so I don’t have time to keep up with all the different environmental changes affecting the compilation of externals for Max and Pd.



Topic: “Bed” method declarations

The original bed_setup() function described in Chapter 7, “Buffer Operations” was reported to no longer work on recent versions of Pd. The fix is to remove A_CANT arguments. For example, the new class_addmethod() call for the “normalize” method is shown below.

class_addmethod(c, (t_method)bed_normalize, gensym(“normalize”), 0);

Thanks to Richard Graham for the bug report.

Also, at present Bed will only work on 32-bit versions of Pd. This will be dealt with in the next CDROM update.



Topic: updating Pd code for the 64-bit build of Pd

The use of t_int in the following perform routine code may not work in the 64-bit build of Pd:

t_int *vdelay_perform(t_int *w)
t_vdelay *x = (t_vdelay *) (w[1]);
t_float *input = (t_float *) (w[2]);
t_float *delaytime = (t_float *) (w[3]);
t_float *feedback = (t_float *) (w[4]);
t_float *output = (t_float *) (w[5]);
t_int n = w[6];

Recommended fix: update all Pd perform routines with the following typecast of the signal vector size element, as follows:

t_vdelay *x = (t_vdelay *) (w[1]);
t_float *input = (t_float *) (w[2]);
t_float *delaytime = (t_float *) (w[3]);
t_float *feedback = (t_float *) (w[4]);
t_float *output = (t_float *) (w[5]);
int n = (int) w[6];



Topic: Compiling Pd externals on Windows, using Visual Studio 2105.

David Kettle reports:

I googled the error message and found a post from Miller himself, back in 2002, about exactly the same error. Maybe it’s the MSVS compiler that’s changed, and the header really should be updated. Here’s the post (you have to scroll down a little to see his response to someone else who was getting the same error):

Anyway, it compiled after I commented out that code in the header and replaced it with this line:
#define EXTERN_STRUCT struct

However, I then got some link errors, so I had to make some changes to your makefile. It seems the directory structure in MSVS has changed, and the file ‘kernel32.dll’ is in a different location, relative to the MSVS installation directory. I also updated some lines to reflect the change in MSVS version number. Here are the lines for Windows, after my changes:

pd_nt: $(NAME).dll


# VC=”C:\Program Files\Microsoft Visual Studio\Vc98″
#VC = “C:\Program Files\Microsoft Visual Studio 10.0\VC”
VC = “C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC”
#VSTK = “C:\Program Files\Microsoft SDKs\Windows\v7.0A”

PDNTINCLUDE = /I. /I..\..\src /I$(VC)\include

PDNTLDIR = $(VC)\lib
$(PDNTLDIR)\libcmt.lib $(PDNTLDIR)\oldnames.lib \
“C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10586.0\um\x86\kernel32.lib” \
“C:\Program Files (x86)\pd-0.46-7.msw\pd\bin\pd.lib”

link /nologo /dll /export:$(CSYM)_setup $*.obj $(PDNTLIB)