Changeset 29

Show
Ignore:
Timestamp:
05/07/07 23:57:30 (2 years ago)
Author:
gordonjcp
Message:

fixed phasing bug, see wiki for details in a day or two

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • nekostring/trunk/gui/Makefile

    r19 r29  
    7272CTAGS = ctags 
    7373DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) 
    74 ACLOCAL = ${SHELL} /home/gordonjcp/devel/nekostring/trunk/missing --run aclocal-1.9 
     74ACLOCAL = ${SHELL} /home/gordonjcp/devel/nekostring/missing --run aclocal-1.9 
    7575AMDEP_FALSE = # 
    7676AMDEP_TRUE =  
    77 AMTAR = ${SHELL} /home/gordonjcp/devel/nekostring/trunk/missing --run tar 
     77AMTAR = ${SHELL} /home/gordonjcp/devel/nekostring/missing --run tar 
    7878AR = ar 
    79 AUTOCONF = ${SHELL} /home/gordonjcp/devel/nekostring/trunk/missing --run autoconf 
    80 AUTOHEADER = ${SHELL} /home/gordonjcp/devel/nekostring/trunk/missing --run autoheader 
    81 AUTOMAKE = ${SHELL} /home/gordonjcp/devel/nekostring/trunk/missing --run automake-1.9 
    82 AWK = mawk 
     79AUTOCONF = ${SHELL} /home/gordonjcp/devel/nekostring/missing --run autoconf 
     80AUTOHEADER = ${SHELL} /home/gordonjcp/devel/nekostring/missing --run autoheader 
     81AUTOMAKE = ${SHELL} /home/gordonjcp/devel/nekostring/missing --run automake-1.9 
     82AWK = gawk 
    8383BUILD_GUI_FALSE = # 
    8484BUILD_GUI_TRUE =  
    8585CC = gcc 
    8686CCDEPMODE = depmode=gcc3 
    87 CFLAGS = -g -O2 
     87CFLAGS = -Werror -Wall 
    8888CPP = gcc -E 
    8989CPPFLAGS =  
     
    104104FFLAGS =  
    105105GREP = /bin/grep 
    106 GTK_CFLAGS = -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include  
     106GTK_CFLAGS = -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/freetype2 -I/usr/include/libpng12  
    107107GTK_LIBS = -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgdk_pixbuf-2.0 -lm -lpangocairo-1.0 -lfontconfig -lXext -lXrender -lXinerama -lXi -lXrandr -lXcursor -lXfixes -lpango-1.0 -lcairo -lX11 -lgobject-2.0 -lgmodule-2.0 -ldl -lglib-2.0   
    108108INSTALL_DATA = ${INSTALL} -m 644 
     
    116116LN_S = ln -s 
    117117LTLIBOBJS =  
    118 MAKEINFO = ${SHELL} /home/gordonjcp/devel/nekostring/trunk/missing --run makeinfo 
     118MAKEINFO = ${SHELL} /home/gordonjcp/devel/nekostring/missing --run makeinfo 
    119119OBJEXT = o 
    120120PACKAGE = nekostring 
    121121PACKAGE_BUGREPORT =  
    122 PACKAGE_CFLAGS = -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include  
     122PACKAGE_CFLAGS = -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/freetype2 -I/usr/include/libpng12  
    123123PACKAGE_LIBS = -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgdk_pixbuf-2.0 -lm -lpangocairo-1.0 -lfontconfig -lXext -lXrender -lXinerama -lXi -lXrandr -lXcursor -lXfixes -lpango-1.0 -lcairo -lX11 -lgobject-2.0 -lgmodule-2.0 -ldl -lglib-2.0   
    124124PACKAGE_NAME =  
     
    164164includedir = ${prefix}/include 
    165165infodir = ${datarootdir}/info 
    166 install_sh = /home/gordonjcp/devel/nekostring/trunk/install-sh 
     166install_sh = /home/gordonjcp/devel/nekostring/install-sh 
    167167libdir = ${exec_prefix}/lib 
    168168libexecdir = ${exec_prefix}/libexec 
     
    183183        -DPACKAGE_DATA_DIR=\""$(datadir)"\"  
    184184 
    185 #       -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include  
    186 nekostring_gtk_CFLAGS = -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include   $(AM_CFLAGS) 
     185#       -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/freetype2 -I/usr/include/libpng12  
     186nekostring_gtk_CFLAGS = -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/freetype2 -I/usr/include/libpng12   $(AM_CFLAGS) 
    187187nekostring_gtk_SOURCES = \ 
    188188        main.c \ 
  • nekostring/trunk/gui/callbacks.c

    r9 r29  
    3232    float value; 
    3333 
     34        index=0; 
     35        value=0; 
    3436        printf("from slider: %f\n",cval); 
    3537         
  • nekostring/trunk/gui/interface.c

    r9 r29  
    296296 
    297297  image1 = gtk_image_new_from_icon_name ("gtk-dialog-warning", GTK_ICON_SIZE_BUTTON); 
    298   gtk_image_set_pixel_size (image1, 57); 
     298  gtk_image_set_pixel_size (GTK_IMAGE(image1), 57); 
    299299  gtk_widget_show (image1); 
    300300  gtk_box_pack_start (GTK_BOX (hbox5), image1, TRUE, TRUE, 0); 
     
    408408 
    409409  image2 = gtk_image_new_from_icon_name ("gtk-bold", GTK_ICON_SIZE_BUTTON); 
    410   gtk_image_set_pixel_size (image2, 209); 
     410  gtk_image_set_pixel_size (GTK_IMAGE(image2), 209); 
    411411  gtk_widget_show (image2); 
    412412  gtk_container_add (GTK_CONTAINER (notebook1), image2); 
  • nekostring/trunk/src/Makefile

    r19 r29  
    7676CTAGS = ctags 
    7777DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) 
    78 ACLOCAL = ${SHELL} /home/gordonjcp/devel/nekostring/trunk/missing --run aclocal-1.9 
     78ACLOCAL = ${SHELL} /home/gordonjcp/devel/nekostring/missing --run aclocal-1.9 
    7979AMDEP_FALSE = # 
    8080AMDEP_TRUE =  
    81 AMTAR = ${SHELL} /home/gordonjcp/devel/nekostring/trunk/missing --run tar 
     81AMTAR = ${SHELL} /home/gordonjcp/devel/nekostring/missing --run tar 
    8282AR = ar 
    83 AUTOCONF = ${SHELL} /home/gordonjcp/devel/nekostring/trunk/missing --run autoconf 
    84 AUTOHEADER = ${SHELL} /home/gordonjcp/devel/nekostring/trunk/missing --run autoheader 
    85 AUTOMAKE = ${SHELL} /home/gordonjcp/devel/nekostring/trunk/missing --run automake-1.9 
    86 AWK = mawk 
     83AUTOCONF = ${SHELL} /home/gordonjcp/devel/nekostring/missing --run autoconf 
     84AUTOHEADER = ${SHELL} /home/gordonjcp/devel/nekostring/missing --run autoheader 
     85AUTOMAKE = ${SHELL} /home/gordonjcp/devel/nekostring/missing --run automake-1.9 
     86AWK = gawk 
    8787BUILD_GUI_FALSE = # 
    8888BUILD_GUI_TRUE =  
    8989CC = gcc 
    9090CCDEPMODE = depmode=gcc3 
    91 CFLAGS = -g -O2 
     91CFLAGS = -Werror -Wall 
    9292CPP = gcc -E 
    9393CPPFLAGS =  
     
    108108FFLAGS =  
    109109GREP = /bin/grep 
    110 GTK_CFLAGS = -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include  
     110GTK_CFLAGS = -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/freetype2 -I/usr/include/libpng12  
    111111GTK_LIBS = -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgdk_pixbuf-2.0 -lm -lpangocairo-1.0 -lfontconfig -lXext -lXrender -lXinerama -lXi -lXrandr -lXcursor -lXfixes -lpango-1.0 -lcairo -lX11 -lgobject-2.0 -lgmodule-2.0 -ldl -lglib-2.0   
    112112INSTALL_DATA = ${INSTALL} -m 644 
     
    120120LN_S = ln -s 
    121121LTLIBOBJS =  
    122 MAKEINFO = ${SHELL} /home/gordonjcp/devel/nekostring/trunk/missing --run makeinfo 
     122MAKEINFO = ${SHELL} /home/gordonjcp/devel/nekostring/missing --run makeinfo 
    123123OBJEXT = o 
    124124PACKAGE = nekostring 
    125125PACKAGE_BUGREPORT =  
    126 PACKAGE_CFLAGS = -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include  
     126PACKAGE_CFLAGS = -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/freetype2 -I/usr/include/libpng12  
    127127PACKAGE_LIBS = -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgdk_pixbuf-2.0 -lm -lpangocairo-1.0 -lfontconfig -lXext -lXrender -lXinerama -lXi -lXrandr -lXcursor -lXfixes -lpango-1.0 -lcairo -lX11 -lgobject-2.0 -lgmodule-2.0 -ldl -lglib-2.0   
    128128PACKAGE_NAME =  
     
    168168includedir = ${prefix}/include 
    169169infodir = ${datarootdir}/info 
    170 install_sh = /home/gordonjcp/devel/nekostring/trunk/install-sh 
     170install_sh = /home/gordonjcp/devel/nekostring/install-sh 
    171171libdir = ${exec_prefix}/lib 
    172172libexecdir = ${exec_prefix}/libexec 
  • nekostring/trunk/src/neko-dssi.c

    r6 r29  
    450450        } 
    451451 
     452                run_bog(synth, burst_size); 
    452453        /* render the burst */ 
    453454        neko_synth_render_voices(synth, synth->left + samples_done, burst_size, 
     
    458459        // gjcp - this looks like where "global" effects should be! 
    459460        ensemble (synth->left, synth->right, sample_count, synth); 
     461 
     462 
    460463         
    461464#if defined(NEKO_DEBUG) && (NEKO_DEBUG & XDB_AUDIO) 
  • nekostring/trunk/src/neko_data.c

    r9 r29  
    3434                .7 // volume 
    3535         
    36         }; 
    37  
     36         
     37}; 
     38 
     39/* 
    3840static int 
    39 is_comment(char *buf)  /* line is blank, whitespace, or first non-whitespace character is '#' */ 
     41is_comment(char *buf)  // line is blank, whitespace, or first non-whitespace character is  
    4042{ 
    4143    int i = 0; 
     
    4951    return 1; 
    5052} 
    51  
     53*/ 
     54/* 
    5255static void 
    5356parse_name(const char *buf, char *name, int *inlen) 
     
    7073        } 
    7174    } 
    72     /* trim trailing spaces */ 
     75    // trim trailing spaces  
    7376    while (o && name[o - 1] == ' ') o--; 
    7477    name[o] = '\0'; 
     
    7679    if (inlen) *inlen = i; 
    7780} 
    78  
     81*/ 
    7982int 
    8083neko_data_read_patch(FILE *file, neko_patch_t *patch) 
  • nekostring/trunk/src/neko_ensemble.c

    r6 r29  
    1111 
    1212#include  
     13#include  
    1314#include "neko_synth.h" 
    1415 
     
    3435  float s1, s2;                 // samples from the buffer 
    3536 
    36   float s_mix_1, s_mix_2, s_mix_3;                    // mix for antialiasing 
     37  float s_mix_1; //, s_mix_2, s_mix_3;                        // mix for antialiasing 
    3738        float so1,so2,so3; 
    3839        float d1,d2; 
  • nekostring/trunk/src/neko_synth.c

    r6 r29  
    637637    } 
    638638} 
     639 
     640void run_bog(neko_synth_t *synth, unsigned long sample_count) 
     641{ 
     642  unsigned int i; 
     643  float p; 
     644 
     645  for(i = 0; i<12; i++) { 
     646          p= synth->bog_pos[i]; 
     647          p += ((float)sample_count*neko_pitch[24+i] *440 * synth->deltat); 
     648          if (p>1.0f) p -= 1.0f; 
     649          synth->bog_pos[i]=p; 
     650          //printf("%d:%f\t", i, synth->bog_pos[i]); 
     651  } 
     652 // printf("\n"); 
     653} 
  • nekostring/trunk/src/neko_synth.h

    r6 r29  
    4343    unsigned long   nugget_remains; 
    4444 
     45    /* bottom octave generator */ 
     46 
     47    float                       bog_pos[12]; 
    4548    /* voice tracking and data */ 
    4649    unsigned int    note_id;           /* incremented for every new note, used for voice-stealing prioritization */ 
     
    133136char *dssi_configure_message(const char *fmt, ...); 
    134137 
     138void run_bog(neko_synth_t *synth, unsigned long sample_count); 
     139 
    135140/* these come right out of alsa/asoundef.h */ 
    136141#define MIDI_CTL_MSB_MODWHEEL           0x01    /**< Modulation */ 
  • nekostring/trunk/src/neko_voice.c

    r6 r29  
    4444                     unsigned char key, unsigned char velocity) 
    4545{ 
    46     int i,f_key,oldest_voice
     46    int i
    4747        float oct_mult,osc_pos; 
    4848 
    49         voice->key=255; // impossible 
    50          
    5149    if (!synth->monophonic || !(_ON(voice) || _SUSTAINED(voice))) { 
    5250 
     
    10098            voice->c5     = 0.0f; 
    10199            voice->osc_index = 0; 
     100 
     101                        oct_mult=pow(2,(key/12)-2); 
    102102                         
    103                         // scan for octaves, try and start new oscillator in phase 
    104                         // this would stop notes an octave apart cancelling 
    105                         printf("in note_on\n"); 
    106  
    107                         // loop through all voices 
    108                     for(i = 0;i < (synth->voices);i++) 
    109                         { 
    110                                 f_key=synth->voice[i]->key; 
    111                                  
    112                                 // redundant, 'cos we never complete the loop really 
    113                                  
    114                                 if (synth->voice[i]->key==255) { printf("This is voice %d\n",i); } 
    115                                 if (f_key==255) { printf("This is voice %d\n",i); } 
    116                                  
    117  
    118                                 // is our new note an octave away from something already here? 
    119                                 if (f_key%12==key%12) { 
    120                                 oct_mult=pow(2,(key/12-f_key/12));                                       
    121                                          
    122                                         voice->osc_bass.pos = synth->voice[i]->osc_bass.pos*oct_mult; 
    123                         voice->osc_cello.pos = synth->voice[i]->osc_cello.pos*oct_mult; 
    124                                         voice->osc_viola.pos = synth->voice[i]->osc_viola.pos*oct_mult; 
    125                                         voice->osc_violin.pos = synth->voice[i]->osc_violin.pos*oct_mult*2; 
    126         ;                                        
    127                                         printf("resetting voice phase from voice[%d], %f\n",i,synth->voice[i]->osc_viola.pos); 
    128                                         i=synth->voices+1; 
    129                                         f_key=1000; 
    130  
    131                                 } 
    132                                  
    133                         } 
    134                         if(f_key!=1000){ 
    135                         voice->osc_bass.pos = 0.0f; 
    136             voice->osc_cello.pos = 0.0f; 
    137                         voice->osc_viola.pos = 0.0f; 
    138                         voice->osc_violin.pos = 0.0f; 
    139                                 printf("zeroed voice phase\n"); 
    140                         } 
    141         } 
     103                        voice->osc_bass.pos = 0;//synth->voice[i]->osc_bass.pos*oct_mult; 
     104                        osc_pos=synth->bog_pos[key%12] *oct_mult /2; 
     105                        osc_pos=osc_pos-(float)trunc(osc_pos); 
     106                        voice->osc_cello.pos = osc_pos;//synth->voice[i]->osc_cello.pos*oct_mult; 
     107                        osc_pos=synth->bog_pos[key%12] *oct_mult; 
     108                        osc_pos=osc_pos-(float)trunc(osc_pos); 
     109                        voice->osc_viola.pos = osc_pos; 
     110                        osc_pos=synth->bog_pos[key%12] *oct_mult*2; 
     111                        osc_pos=osc_pos-(float)trunc(osc_pos); 
     112                        voice->osc_violin.pos = osc_pos;//synth->voice[i]->osc_violin.pos*oct_mult*2; 
     113 
    142114                 
    143                 printf("%f\n",voice->osc_viola.pos); 
     115                } 
    144116        voice->eg1_phase = 0; 
    145117        voice->eg2_phase = 0; 
  • nekostring/trunk/src/neko_voice_render.c

    r6 r29  
    2222#include "neko_voice.h" 
    2323 
    24  /******************************************************************** 
    25  *                                                                   * 
    26  * Neko-DSSI started out as a DSSI demonstration plugin, and       * 
    27  * originally this file was just Steve Brookes' Neko code with as  * 
    28  * little modification as was necessary to interface it with my DSSI * 
    29  * plugin code.  If you'd like to see that simpler version, check    * 
    30  * out the included file src/neko_voice_render-original.c.         * 
    31  *                                                                   * 
    32  * Since that beginning, the following code has gained band-limited  * 
    33  * oscillators, velocity sensitive envelopes, a more stable filter,  * 
    34  * and some measure of optimization, so it's considerably more       * 
    35  * complex.                                                          * 
    36  *                                                                   * 
    37  * Oh, and Steve, wherever you are -- thanks.                        * 
    38  *                                                                   * 
    39  ********************************************************************/ 
    40  
    4124#define M_2PI_F (2.0f * (float)M_PI) 
    4225#define M_PI_F (float)M_PI 
     
    9578    /* MIDI note to pitch */ 
    9679    for (i = 0; i < 128; ++i) { 
    97                 // we randomise each note a little to avoid octaves "cancelling" 
    98                 // it's hackish and horrible, and it means that some octaves can have a deep swooshy flange 
    99                 // oh well. 
    100         pexp = (float)(i - pitch_ref_note) / 12.0f;//+(0.004-0.008*((float)rand()/2147483647)); 
     80        pexp = (float)(i - pitch_ref_note) / 12.0f; 
    10181        neko_pitch[i] = powf(2.0f, pexp);//; 
    10282    } 
     
    357337    float fund_pitch; 
    358338    float deltat = synth->deltat; 
    359     float freq, freqkey, freqeg1, freqeg2, lfo; 
     339//    float freq, freqkey, freqeg1, freqeg2, lfo; 
    360340 
    361341    /* set up synthesis variables from patch */ 
     
    368348    float         eg2_rate_level[3], eg2_one_rate[3]; 
    369349 
    370     float         balance1 = 1.0f - *(synth->mix); 
    371     float         balance2 = *(synth->mix); 
     350//    float         balance1 = 1.0f - *(synth->mix); 
     351//    float         balance2 = *(synth->mix); 
    372352    float         vol_out = volume(*(synth->volume) * synth->cc_volume); 
    373353        //         value = xpd->a * exp(xpd->c * cval * log(xpd->b)); 
     
    380360 
    381361    fund_pitch =  voice->target_pitch; 
    382  
    383362    fund_pitch *= synth->pitch_bend * *(synth->tuning); 
     363         
     364         
    384365         
    385366    omega1 = fund_pitch; 
     
    403384    eg2_amp *= 0.99f;  /*    if (!eg1_phase && eg1 > 0.99f) eg1_phase = 1;         */ 
    404385 
    405     freq = M_PI_F * deltat * fund_pitch * synth->mod_wheel;  /* now (0 to 1) * pi */ 
     386   // freq = M_PI_F * deltat * fund_pitch * synth->mod_wheel;  /* now (0 to 1) * pi */ 
    406387 
    407388    /* --- LFO, EG1, and EG2 section */ 
     
    427408        // generate cello 
    428409        vco(sample_count, voice, &voice->osc_cello, 
    429                       osc_index, 0.999, 0.3, *(synth->cello), deltat * omega1/2); 
     410                    osc_index, 0.999, 0.3, *(synth->cello), deltat * omega1/2); 
    430411        // generate viola 
    431412        vco(sample_count, voice, &voice->osc_viola,