MUS177/206 – seconds.c

Here is seconds.c, which uses <time.h> functions to send the day and time out as a list (out of a single list outlet).


 

/* seconds.c - 
 this object has 1 inlets and 6 outlets
 it responds the 'bang' message in the left inlet
 it responds to the 'assistance' message sent by Max when the mouse is positioned over an inlet or outlet
 (including an assistance method is optional, but strongly sugggested)
*/
#include <time.h>
#include "m_pd.h"

typedef struct _seconds // defines our object's internal variables for each instance in a patch
{
    t_object x_ob;
    t_outlet *x_outlist;
    t_atom date[6];
} t_seconds;

t_class *seconds_class; // global pointer to the object class - so max can reference the object 
// these are prototypes for the methods that are defined below
void seconds_bang(t_seconds *x);
void *seconds_new(void);
void seconds_setup(void);

//--------------------------------------------------------------------------
void seconds_setup(void)
{
    seconds_class = class_new(gensym("seconds"), (t_newmethod)seconds_new, 0, sizeof(t_seconds), 0, 0);
    class_addbang(seconds_class, seconds_bang);// the method it uses when it gets a bang in the left inlet 
}

//--------------------------------------------------------------------------
void seconds_bang(t_seconds *x) // x = reference to this instance of the object 
{
    time_t rawTime;
        float year, month, date, hour, min, sec;
        struct tm *now;

    time(&rawTime);
    now = gmtime(&rawTime);
    year = (now->tm_year + 1900);
    month = (now->tm_mon + 1);
    date = (now->tm_mday);
    hour = now->tm_hour;
    min = now->tm_min;
    sec = now->tm_sec;
    SETFLOAT(x->date+0, year);
    SETFLOAT(x->date+1, month);
    SETFLOAT(x->date+2, date);
    SETFLOAT(x->date+3, hour);
    SETFLOAT(x->date+4, min);
    SETFLOAT(x->date+5, sec);
    outlet_list(x->x_outlist, gensym("list"), 6, (x->date));
}

//--------------------------------------------------------------------------
void *seconds_new(void) // n = int argument typed into object box (A_DEFLONG) -- defaults to 0 if no args are typed
{
    t_seconds *x;// local variable (pointer to a t_seconds data structure        x = (t_seconds *)pd_new(seconds_class); // create a new instance of this object
       x->x_outlist = outlet_new(&x->x_ob, gensym("list"));
      return(x); // return a reference to the object instance 
}

MUS177/206 – window makefile changes for Pd externals

The makefile to compile the example externals from Pd 0.49 needs to be edited in order to work with Visual Studio Community 2017.

Do all of your editing and compilation on a copy of Pd in your \Users folder

The VC definition needs to be changed (as usual) to point to the 64-bit tools in VSC. Your setting will likely be different than mine.

VC="C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.15.26726"

The PDNTCFLAGS need to be changed to eliminate /WX (treat all warnings as errors, and add a definition for PD_LONGINTTYPE to give PD 64-bit pointers. Without this, the audio example (dspobj~) will crash.

PDNTCFLAGS = /W3 /DNT /DPD /DPD_LONGINTTYPE="long long" /nologo

Now, make sure PDNTLDIR points to the 64 bit library folder by appending “\x64” to the path

PDNTLDIR = $(VC)\lib\x64

Finally, remove references to old names.lib and kernel32.lib and change libc.lib to libcmt.lib

PDNTLIB = $(PDNTLDIR)\libcmt.lib \
..\..\bin\pd.lib

MUS206: Hardware Synthesis Syllabus

Hardware Synthesis Syllabus

Topics for Fall 2018

  1. A) Patching and Signals: Control Voltage, Audio, AC, DC, Gates, Triggers (Strange: Chapter 5); B) Slope, Envelope and LFO (Maths Manual – Make Noise Website)
  2. Oscillators: Sine, Square, Triangle and Ramp; Sync; Linear & Log Frequency; Vibrato & Gliss; Subharmonics; Additive; Noise; Multiple Oscillators; ASR (Strange: Chapter 3)
  3. Amplifiers: Tremolo; Envelope and LFO; Amplitude and Ring Modulation, Envelope Tracking, Types of VCAs (Strange: Chapter 4)
  4. Modulation: More Amplitude and Ring Mod, Wave Folding, Frequency Modulation, Chaotic Oscillation, Feedback Networks (Strange: Chapter 7-8)
  5. Playing 1st pieces.
  6. Sequencing and Variation, Structure, Rhythmic Patching, Clocking (Rene Manual – Make Noise Website)
  7. Holiday
  8. Musique Concrete Techniques. Computer Interface: MIDI, Control Voltage, Gates; Recording Material
  9. Reverb and Echo; External Processing; Processing Computer Signals
  10. Playing 2nd pieces

Readings from Allan Strange: Electronic Music; Make Noise Website

Listening Assignments

Pieces Presented on Week 5 and Week 10