Sign in to follow this  
whitesilk

era or jiayin?

Recommended Posts

Three texts to reference from the Huainanzi, then a commentary.

 

Huainanzi 3.8

 

Huainanzi 3.9

 

Huainanzi 3.26

 

Huainanzi 3.15

 

I have KDE, kStars. In the solar system viewer, there is a mode of viewing the movement of the planets. It seems that there is a mars eclipse coming on the summer solstice of 2018.

 

Any Thoughts Would Be Appreciated!

Edited by whitesilk

Share this post


Link to post
Share on other sites

IMAGES

 

 

I think I made a mistake in era_calc.

 

I just looked at snapshot2 again and Mercury obscurs Saturn, and Earth obscurs Mars, leaving no yin and no yang.

Edited by whitesilk

Share this post


Link to post
Share on other sites

Which state corresponds to the asterism dipper?

 

found my own answer:

 

https://en.wikipedia.org/wiki/Dipper_(Chinese_constellation)

 

re:

 

Huainanzi 3.9

 

On the day jiayin, in the first year of the Epoch, Saturn is in [the lunar lodge] Dipper. Each year Saturn move through one lunar lodge. If Saturn should be [in a particular lunar lodge] but is not there, the state [corresponding to that lodge] will lose its land. If Saturn ought not yet to be [in a particular lunar lodge] but [already] occupies it, the state corresponding to that lodge] will increase its land and [its] crops will ripen. The [average] daily motion [of Saturn] is one-twenty-eighth of a ]Chinese] degree. Its annual motion is 13 5/112 (degrees). In twenty-eight years it completes a circuit [of the heavens].

Edited by whitesilk

Share this post


Link to post
Share on other sites

Jiayin is part of a cycle of sixty created by the interaction of the ten  "Celestial Stems" and twleve  "Earthly Branches", of which it is the 53rd.  This cycle is used to mark out hours, days, months and years, so the jiayin day is going to happen six times a year, but what days in a year will be the jiayin days will vary from year to year.  Here is the link to the Wikipedia article on the Sexagenary Cycle as it is usually referred to in English:

 

Chinese Sexagenary Cycle

 

You might wish to read the works of Derek Walters:

 

The Complete Guide to Chinese Astrology

 

And Chinese astology software such as that provided by Delemme software:

 

Delemme's Chinese Astrology programs

 

They have been around for a long time and their free trials of their software actually give a lot of free charts before you have to buy the software.

Share this post


Link to post
Share on other sites

Thanks

Zhongyongdaoist

 

I'm a linux user, so I do not think that I will be able to use the software, although I am interested in the book!

 

I'm also a computer developer, I have an app on the play store... check out my research:

 

facebook dot com forward slash tabscribe

 

 

Zhongyongdaoist:

 

Would you provide me with a reference date? For example, October 9th, 2016 is jiazi?

Share this post


Link to post
Share on other sites

Here is a complete printout of a Bazi chart for Southern California:
 

FOUR PILLARS ANALYSIS

CHART
  Name: TRANSITS OCT 9 2016
  Date/Time: 9 Oct 2016, 6:19 pm (PDT +7:00)
  Adjusted: 9 Oct 2016, 5:30 pm (LMT +7:48:44)

THE CHINESE CALENDAR
  Solar Period (Fortnightly Festival Period): 17 Cold Dew (N); Clear and Bright (S)
  Solar Year: 2016
  Solar Month: 9
  Lunar Year: 2016
  Lunar Chinese Month Number: 9
  Ordinal Month: 9
  Day of Lunar Month: 9 of 30
  Hour of Day (Chinese Double Hour): 10
  Lunar New Year: 8 Feb 2016 10:38 pm (CCT -8:00)
  Li Ch'un (Start of the Chinese Solar Year): 4 Feb 2016 5:45 pm (CCT -8:00)

THE YEAR PILLAR
  Relates to:
     Ancestors/ Social Groups/Extended Family
  Stem: 3 - Yang Fire
     Outgoing, vigorous, defined, warm; Lively, educated, agile, inspiring
  Branch: IX - Metal Monkey
     Inventive and agile mind, insatiable curiosity, quick-witted schemer (Mountain Monkey) - It is time to address more serious concerns. Play is good, but only in its proper context.
  Combined: Fire (Foothill Fire)
     Final acclaim comes only after renewed effort

THE MONTH PILLAR
  Relates to:
     Birth Family/Parents/Aunts and Uncles
  Stem: 5 - Yang Earth
     Outgoing, vigorous, defined, warm; Stable, intellectual, circumspect, centered
  Branch: XI - Earth Dog
     Fidelity, honesty, humuor, lifelong friends, steady worker (Mountain Dog) - Building strongholds also keeps out friends. Learn to be less defensive. Life will bring many battles before victory is achieved, but success ultimately comes.
  Combined: Wood (Scrubland Twigs)
     Great changes are made through gathering small things

THE DAY PILLAR
  Relates to:
     The Self/The Partner (Branch)
  Stem: 1 - Yang Wood
     Outgoing, vigorous, defined, warm; Rustic, casual, imaginative, creative
  Branch: I - Water Rat
     Charm, adaptability, creativity, inventiveness (Rat on the Roof) - You are a born leader with a strong streak of originality. Your mind is very active and you may have many hidden artistic talents. You are a self-starter, but you may find that you have to hold yourself back in order that people do not feel threatened. This is a life of many beginnings for you.
  Combined: Metal (Gold from the Sea)
     Unexpected wealth and riches

THE HOUR PILLAR
  Relates to:
     Children/Friends/Creative Output
  Stem: 10 - yin water
     Inward, passive, nebulous, cool; Attentive, communicative, contemplative, psychic
  Branch: X - Metal Rooster
     Determination, pride, confidence (Barnyard Rooster) - You seem to have a knack for sensing the next steps ahead.  You have many inner qualities about which people know very little.  There is a superficial side to you that you need to watch out for.  You do have a lot to offer when all is said and done.
  Combined: Metal (Sharp Sword)
     The need for determined and ruthless action

THE MINUTE PILLAR
  Relates to:
     Grandchildren/Legacy to the Future/Friends of Friends
  Stem: 6 - yin earth
     Inward, passive, nebulous, cool; Stable, intellectual, circumspect, centered
  Branch: X - Metal Rooster
     Determination, pride, confidence (Cock Pecking for Food) - It is best to put things away for leaner times. Storms can come at the worst of times. Present expenditures should be curtailed.
  Combined: Earth (Roadworks Earth)
     Adaptability and a joyful heart bring rewards along the way

PILLAR & ELEMENT RELATIONSHIPS
  Strong Stem Pairs:
       Hour/Month:  Mutual need
  Stem Element Relationships:
     Hour Pillar (water) generates Day Pillar (Wood)
     Hour Pillar (water) controls Year Pillar (Fire)
     Day Pillar (Wood) controls Month Pillar (Earth)
     Day Pillar (Wood) generates Year Pillar (Fire)
     Month Pillar (Earth) controls Hour Pillar (water)
     Year Pillar (Fire) generates Month Pillar (Earth)
  Element Counts:
     Wood: 2 - Creative, literary, compassionate
     Fire: 2 - Active, stimulating
     Earth: 2 - Reliable, practical
     Metal: 4 - Business-like, aggressive, competitive
     Water: 2 - Talkative, clear, bright
  Birth Phase:
     Fullness - Blooming, flowering of abilities, greatest expression
  Day Pillar Element Analysis:
     Kin: (Wood) - Factors that are of the same Element  as the Day Pillar and are thus supportive
     0 Strong; 1 Weaker; Overall Score = 0.6
     Benefactor/Grantor: (Water) - Factors that have the Element that generates the Day Pillar Element
     2 Strong; 2 Weaker; Overall Score = 3.6
     Offspring: (Fire) - Factors having the Element generated by the Day Pillar Element
     3 Total
     Ruler/Driving Force: (Metal) - Factors that have the Element that controls the Day Pillar Element
     1 Strong; 6 Weaker; Overall Score = 4.8
     Money: (Earth) - Factors that have the Element that the Day Pillar Element controls
     4 Total
     Dominant: Score = 0.0 - Not applicable
     Overly Strong: Score = 0.1 - Strongly dominates the immediate environment
     Overly Weak: Score = 0.0 - Not applicable
     Weak: Score = 0.0 - Not applicable
     Helpless: Score = 0.0 - Not applicable
     Competitive: Score = 0.0 - Not applicable
  Pillar Branch Animal Analysis:
     Hour Pillar (Rooster)  / Day Pillar (Rat): Disinterest
     Hour Pillar (Rooster)  / Month Pillar (Dog): Neutral (Proverbially discordant)
     Hour Pillar (Rooster)  / Year Pillar (Monkey): Disinterest
     Day Pillar (Rat)  / Month Pillar (Dog): Neutral
     Day Pillar (Rat)  / Year Pillar (Monkey): Excellent relationship
     Month Pillar (Dog)  / Year Pillar (Monkey): Disinterest

CONSTELLATION OF DAY
  Animal: Rat
     This is not a good day for digging, construction or marriages
  Day Indicator: I - Completion
     All things are favored on this day, especially long journeys.

9 STAR KI (JAPANESE)
  Year Number: 2 Yang Earth
  Month Number: 3 Yin Wood
  House Number: 6 Yin Metal
  Trigram: Chien

9 STAR KI (CHINESE)
  Year Number: 2 Yang Earth
  Month Number: 3 Yin Wood
  House Number: 4 Yang Wood
  Trigram: Sun

TETRAGRAM
===   ===   ===
=====    =====
============
=====    =====

  Tetragram 65:
     Inner: Yin, leaving Yang's embrace, becomes like Yang. Yang becomes like Yin. The myriad things are finished.
  9 Oct (Nighttime):
     Yang and Yin, man and woman, each in their place. Ignorance of the Tao brings disaster.


This is actually a report from Imperial Astrologer, which is published by Esoteric Techologies.  I use their Solar Fire product for Western Astrology.  The Delemme printouts are very interesting and useful for health, but their interface is a little clunky, so it is easier to use Imperial Astrologer if all one wants is quick look.

 

Most of the things here are advanced, but to summarize:

 

THE YEAR PILLAR
  Relates to:
     Ancestors/ Social Groups/Extended Family
  Stem: 3 - Yang Fire
     Outgoing, vigorous, defined, warm; Lively, educated, agile, inspiring
  Branch: IX - Metal Monkey

 

you combine the Element of the Stem, Fire, with the Animal of the Branch, Monkey, thus the year is the Fire Monkey and the same with the others giving:

 

Month = Earth Dog

Day = Wood Rat

Hour = Water Rooster

 

I hope this is helpful.

Share this post


Link to post
Share on other sites

I'm glad it was helpful.  If after you develop your programs, you need more information on specific dates to test your accuracy, let me know, either here or by private message.

 

I don't "do FaceBook", so unfortunately I cannot see your research, but just what you have been posting here sounds interesting.

 

Since you said that you are a programmer, you might find Astrolog interesting:

 

Astrolog Homepage

 

While this is a Western oriented program, it is open source and the source code can be downloaded in C++ and compiled in Unix.  I don't know how difficult it would be to port to Linux, even "out of the box" it is an amazingly powerful program for a free one, with some astronomical and very strong macro features, so if you are clever, even as it is, with a little thought a lot can be done with it.  Also the author of this has started supporting it again, for about 20 years there were only versions like 5.4 available, now it is at 6.10.

 

Good luck with your programming and research.

 

ZYD

Share this post


Link to post
Share on other sites

Zhongyongdaoist

 

I just bought an american bass guitar.

 

I wrote this to try to help me write some songs.

 

code for code

 

https://en.wikipedia.org/wiki/Huygens%E2%80%93Fresnel_principle

 

 

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <unistd.h>
#include <math.h>
#include <fcntl.h>
#include <cairo/cairo.h>

#define WAV_HEADER_OFFSET (44 * 4)

#define CHANNEL_INP_REAL 0
#define CHANNEL_INP_IMAG 1
#define NCHANNELS 2

#define SAMPLE_RATE 48000
#define FRAME_RATE 6
#define FRAME_SIZE 8192
#define OCTAVE_SHIFT 32
#define FREQ_IND(q) (int)(((float)(q) * (float)FRAME_SIZE) / ((float)SAMPLE_RATE / (float)OCTAVE_SHIFT))
#define IND_FREQ(ind) (float)(((float)(ind) / (float)FRAME_SIZE) * ((float)SAMPLE_RATE / (float)OCTAVE_SHIFT))

#define STRING_LENGTH 8192

#define HALFTONE (float)pow(2.0,1.0/12.0)
#define NTONES 40
#define FREQ_LO 30.86770632850774f


#define THETADELTA 100

#define DIST 0.329631f

#define RMAGN 1000

#define IMG_WIDTH 1280
#define IMG_HEIGHT 720

#define Y_DELTA pow(2,27)

#define BKG_R 0.45f
#define BKG_G 0.45f
#define BKG_B 0.45f

typedef enum {
    COMPLEX_REAL,
    COMPLEX_IMAG,
    COMPLEX_TOTAL
} COMPLEX;

char outimgdir[sTRING_LENGTH];
char inwavpath[sTRING_LENGTH];

float sig[COMPLEX_TOTAL][FRAME_SIZE];
float emp[2][COMPLEX_TOTAL][FRAME_SIZE];
float fft[COMPLEX_TOTAL][FRAME_SIZE];
float magn[FRAME_SIZE];

int inwavfd;

float mmagn[NTONES];
int mnd[NTONES];

float Up[COMPLEX_TOTAL][RMAGN];

void sample_wav(int frameitr) {
    int itr;
    short buf[NCHANNELS * FRAME_SIZE * OCTAVE_SHIFT];
    
    lseek(inwavfd, (44 * 4) + (4 * FRAME_SIZE) * frameitr, 0);
    read(inwavfd, buf, NCHANNELS * FRAME_SIZE * OCTAVE_SHIFT * sizeof(short));
    
    for (itr = 0; itr < FRAME_SIZE; itr += 1) {
        sig[COMPLEX_REAL][itr] = (float)buf[NCHANNELS * itr * OCTAVE_SHIFT + CHANNEL_INP_REAL];
        sig[COMPLEX_IMAG][itr] = (float)buf[NCHANNELS * itr * OCTAVE_SHIFT + CHANNEL_INP_IMAG];
    }
    
    return;
}

int bit_reversal(int m, int n) {
    int itr;
    
    int ret = 0;
    for (itr = 0; itr < m; itr += 1) {
        ret <<= 1;
        if ((n >> itr) & 0x1) ret |= 1;
    }
    
    return ret;
}

void dif_fft() {
    float f, o, i, l, theta;
    int itr, aitr, litr, lit, ind, e;
    
    memset(emp[0][COMPLEX_REAL], 0, FRAME_SIZE * sizeof(float));
    memset(emp[0][COMPLEX_IMAG], 0, FRAME_SIZE * sizeof(float));
    for (itr = 0; itr < FRAME_SIZE; itr += 1) {
        emp[0][COMPLEX_REAL][itr] = sig[COMPLEX_REAL][itr];
        emp[0][COMPLEX_IMAG][itr] = sig[COMPLEX_IMAG][itr];
    }
    
    e = (int)(log(FRAME_SIZE) / log(2));
    for (lit = e - 1; lit >= 0; lit -= 1) {
        litr = (int)pow(2,lit);
        
        for (aitr = 0; aitr < FRAME_SIZE; aitr += 2 * litr) {
            for (itr = aitr; itr < aitr + litr; itr += 1) {
                emp[1][COMPLEX_REAL][itr] = emp[0][COMPLEX_REAL][itr] + emp[0][COMPLEX_REAL][itr + litr];
                emp[1][COMPLEX_IMAG][itr] = emp[0][COMPLEX_IMAG][itr] + emp[0][COMPLEX_IMAG][itr + litr];
                
                theta = (M_PI * (float)itr) / (float)litr;
                
                f = 1.0f * (emp[0][COMPLEX_REAL][itr] - emp[0][COMPLEX_REAL][itr + litr]) * cos(theta);
                o = 1.0f * (emp[0][COMPLEX_REAL][itr] - emp[0][COMPLEX_REAL][itr + litr]) * sin(theta);
                i = 1.0f * (emp[0][COMPLEX_IMAG][itr] - emp[0][COMPLEX_IMAG][itr + litr]) * cos(theta);
                l = -1.0f * (emp[0][COMPLEX_IMAG][itr] - emp[0][COMPLEX_IMAG][itr + litr]) * sin(theta);
                
                
                emp[1][COMPLEX_REAL][itr + litr] = f + l;
                emp[1][COMPLEX_IMAG][itr + litr] = o + i;
            }
        }
        for (itr = 0; itr < FRAME_SIZE; itr += 1) {
            if (isnan(emp[1][COMPLEX_REAL][itr])) emp[1][COMPLEX_REAL][itr] = 0.0f;
            if (isinf(emp[1][COMPLEX_IMAG][itr])) emp[1][COMPLEX_IMAG][itr] = 0.0f;
        }
        memcpy(emp[0][COMPLEX_REAL], emp[1][COMPLEX_REAL], FRAME_SIZE * sizeof(float));
        memcpy(emp[0][COMPLEX_IMAG], emp[1][COMPLEX_IMAG], FRAME_SIZE * sizeof(float));
    }
    
    for (itr = 0; itr < FRAME_SIZE; itr += 1) {
        ind = bit_reversal(e, itr);

        fft[COMPLEX_REAL][itr] = emp[0][COMPLEX_REAL][ind];
        fft[COMPLEX_IMAG][itr] = emp[0][COMPLEX_IMAG][ind];
        
        magn[itr] = sqrt(fft[COMPLEX_REAL][itr] * fft[COMPLEX_REAL][itr] + fft[COMPLEX_IMAG][itr] * fft[COMPLEX_IMAG][itr]);
    }
    
    return;
}



void find_levels(void) {
    float q, m;
    int ind_lo, ind_hi, itr, aitr, mind, titr;
    
    
    
    q = FREQ_LO;
    for (itr = 0; itr < NTONES; itr += 1) {
        ind_lo = FREQ_IND(q - (q - q / HALFTONE) / 2.0f);
        ind_hi = FREQ_IND(q + (q * HALFTONE - q) / 2.0f);
        
        
        if (ind_hi >= FRAME_SIZE / 2) {
            printf("OVERFLOW\n");
            break;
        }
        
        m = 0.0f;
        mind = -1;
        for (aitr = ind_lo; aitr < ind_hi; aitr += 1) {
            if (m < magn[aitr]) {
                m = magn[aitr];
                mind = aitr;
            }
        }
        
        if (mind > - 1) {
            mmagn[itr] = m;
            mnd[itr] = mind;
        }
        
        titr += 1;
        q *= HALFTONE;
    }
    
    return;
}

void huygens_fresnel_transform(int titr) {
    float Ur0[COMPLEX_TOTAL];
    float s[COMPLEX_TOTAL];
    float q, p, f, o, i, l, k, smagn, theta, P0a, aP, aQ, is, b, c, r;
    int r0, thetaitr;
    
    q = IND_FREQ(mnd[titr]);
    p = 1.0 / q;
    k = (2.0f * M_PI) / p;
    
    
    
    for (r0 = 1; r0 < RMAGN; r0 += 1) {
        r = ((float)r0 / (float)RMAGN)* (float)DIST;
        f = 1.0f * fft[COMPLEX_REAL][mnd[titr]] * cos(k * (float)r);
        o = 1.0f * fft[COMPLEX_REAL][mnd[titr]] * sin(k * (float)r);
        i = 1.0f * fft[COMPLEX_IMAG][mnd[titr]] * cos(k * (float)r);
        l = -1.0f * fft[COMPLEX_IMAG][mnd[titr]] * sin(k * (float)r);
        
        Ur0[COMPLEX_IMAG] = (f + l) / ((float)r * p);
        Ur0[COMPLEX_REAL] = -1.0f * (o + i) / ((float)r * p);
        
        memset(s, 0, COMPLEX_TOTAL * sizeof(float));
        
        for (thetaitr = 0; thetaitr < THETADELTA; thetaitr += 1) {
            theta = ((float)thetaitr / (float)THETADELTA) * (2.0f * M_PI);
            
            P0a = (float)r0 * sin(theta);
            aP = DIST - P0a;
            aQ = (P0a * sin(theta)) / sin((M_PI / 2.0f) - theta);
            
            smagn = sqrt(aQ * aQ + aP * aP);
        
            b = asin(P0a / (float)r0);
            c = asin(aP / (float)smagn);
        
            is = (1.0 / 2.0) * (sqrt(1.0f + cos(M_PI - (b + c))) / (float)THETADELTA);
        
            
            s[COMPLEX_IMAG] += (is * cos(k * smagn)) / smagn;
            s[COMPLEX_REAL] += -1.0f * (is * sin(k * smagn)) / smagn;
            
        }
        
        
        f = 1.0f * Ur0[COMPLEX_REAL] * s[COMPLEX_REAL];
        o = 1.0f * Ur0[COMPLEX_REAL] * s[COMPLEX_IMAG];
        i = 1.0f * Ur0[COMPLEX_IMAG] * s[COMPLEX_REAL];
        l = -1.0f * Ur0[COMPLEX_IMAG] * s[COMPLEX_IMAG];
        
        Up[COMPLEX_REAL][r0] = f + l;
        Up[COMPLEX_IMAG][r0] = o + i;
        //printf("%f %f\n", s[0], s[1]);
    }
    
    
    
    return;
}


void cairo_box(cairo_t *cr, double x1, double y1, double x2, double y2) {
    cairo_move_to(cr,x1,y1);
    cairo_line_to(cr,x1,y2);
    cairo_line_to(cr,x2,y2);
    cairo_line_to(cr,x2,y1);
    cairo_fill(cr);
    
    return;
}

void write_img(int frameitr, int titr) {
    cairo_surface_t *img;
    cairo_t *cr;
    double x1,y1,x2,y2,d,c;
    float xp, t, ht, et;
    int itr, ind, oitr, tind, aitr, sitr, fitr;
    char text[sTRING_LENGTH];
    char imgname[sTRING_LENGTH];
    char indetect;

    img = cairo_image_surface_create(CAIRO_FORMAT_RGB24, IMG_WIDTH, IMG_HEIGHT);
    cr = cairo_create(img);

    cairo_set_line_width(cr, 4.0);
                                    
    cairo_set_source_rgb(cr,BKG_R,BKG_G,BKG_B);
    x1 = 0.0;
    y1 = 0.0;
    x2 = (double)IMG_WIDTH;
    y2 = (double)IMG_HEIGHT;
    cairo_box(cr,x1,y1,x2,y2);
    
    d = ((double)IMG_WIDTH / (double)RMAGN) * (double)OCTAVE_SHIFT;
    for (itr = 1; itr < FRAME_SIZE; itr += 1) {
        cairo_set_source_rgb(cr,1.0,0.0,0.0);
        x1 = (double)(itr - 1) * d;
        y1 = (double)(IMG_HEIGHT / 4) + (double)(IMG_HEIGHT / 8) * sig[COMPLEX_REAL][itr - 1] / pow(2,15);
        x2 = (double)itr * d;
        y2 = (double)(IMG_HEIGHT / 4) + (double)(IMG_HEIGHT / 8) * sig[COMPLEX_REAL][itr] / pow(2,15);
        cairo_move_to(cr,x1,y1);
        cairo_line_to(cr,x2,y2);
        cairo_stroke(cr);
        
        cairo_set_source_rgb(cr,0.0,1.0,0.0);
        x1 = (double)(itr - 1) * d;
        y1 = (double)(IMG_HEIGHT / 4) + (double)(IMG_HEIGHT / 8) * sig[COMPLEX_IMAG][itr - 1] / pow(2,15);
        x2 = (double)itr * d;
        y2 = (double)(IMG_HEIGHT / 4) + (double)(IMG_HEIGHT / 8) * sig[COMPLEX_IMAG][itr] / pow(2,15);
        cairo_move_to(cr,x1,y1);
        cairo_line_to(cr,x2,y2);
        cairo_stroke(cr);
    }
            
    
    for (itr = 1; itr < RMAGN; itr += 1) {
        cairo_set_source_rgb(cr,1.0,0.0,0.0);
        x1 = (double)(itr - 1) * d;
        y1 = (double)(IMG_HEIGHT * (3.0 / 4.0)) + (double)(IMG_HEIGHT / 8) * Up[COMPLEX_REAL][itr - 1] / Y_DELTA;
        x2 = (double)itr * d;
        y2 = (double)(IMG_HEIGHT * (3.0 / 4.0)) + (double)(IMG_HEIGHT / 8) * Up[COMPLEX_REAL][itr] / Y_DELTA;
        cairo_move_to(cr,x1,y1);
        cairo_line_to(cr,x2,y2);
        cairo_stroke(cr);
        
        cairo_set_source_rgb(cr,0.0,1.0,0.0);
        x1 = (double)(itr - 1) * d;
        y1 = (double)(IMG_HEIGHT * (3.0 / 4.0)) + (double)(IMG_HEIGHT / 8) * Up[COMPLEX_IMAG][itr - 1] / Y_DELTA;
        x2 = (double)itr * d;
        y2 = (double)(IMG_HEIGHT * (3.0 / 4.0)) + (double)(IMG_HEIGHT / 8) * Up[COMPLEX_IMAG][itr] / Y_DELTA;
        cairo_move_to(cr,x1,y1);
        cairo_line_to(cr,x2,y2);
        cairo_stroke(cr);
    }
    memset(imgname, 0, STRING_LENGTH);
    sprintf(imgname, "%s/%08d_%04d.png", outimgdir, frameitr, titr);
    cairo_surface_write_to_png(img, imgname);
    cairo_destroy(cr);
    cairo_surface_destroy(img);

            
    return;
}

int main(int argc, char *argv[]) {
    if (argc != 3) {
        printf("USAGE:./test <inwavpath> <outimgdir>\n");
        return 0;
    }

    long e, b, s;
    int nframes, itr, aitr;

    memset(inwavpath, 0, STRING_LENGTH);
    strcpy(inwavpath, argv[1]);

    memset(outimgdir, 0, STRING_LENGTH);
    strcpy(outimgdir, argv[2]);

    inwavfd = open(inwavpath, O_RDONLY, 0600);

    e = lseek(inwavfd, 0, 2);
    b = lseek(inwavfd, 44 * 4, 0);

    s = e - b;
    nframes = (s / 4) / FRAME_SIZE;

    for (itr = 0; itr < nframes; itr += 1) {
        sample_wav(itr);

        dif_fft();

        find_levels();

        for (aitr = 0; aitr < NTONES; aitr += 1) {
            huygens_fresnel_transform(aitr);
            write_img(itr,aitr);    
        }
        
        printf("%d\n", itr);
    }
    
    close(inwavfd);
    
    return 0;
}

 

Edited by whitesilk

Share this post


Link to post
Share on other sites
Sign in to follow this