Jump to content

BlowMe

Active Members
  • Posts

    33
  • Joined

  • Last visited

Posts posted by BlowMe

  1. You can get a better effect using sine waves. Heres an example stolen from the Hacker Voice forums

    #include <stdio.h>
    #include <math.h>
    #include <malloc.h>
    
    #ifndef DBL_EPSILON
    /* Difference between 1.0 and the minimum double greater than 1.0 */
    #define DBL_EPSILON 2.2204460492503131e-16
    #endif
    
    
    int writesamples(char *filename, short *samptable, int samples)
    {
    FILE *f1;
    f1 = fopen(filename, "wb");
    fwrite(samptable, sizeof(short), samples, f1);
    return fclose(f1);
    }
    
    double makesinetable(float *sinetable)
    {
    const double pi = (4.0 * atan(1.0));
    double angle_rad, desiredpeak, inputpeak;
    int i, angle = 0;
    float value;
    
    // Create the sine table
    while(angle <= 360){
     angle_rad = (pi * (angle / 180.0));
     value = sin(angle_rad);
     sinetable[(angle - 1)] = value;
     angle++;
    }
    
    inputpeak = 0.0;
    for(i = 0; i < 360; i++)
     if(sinetable[i] > inputpeak) inputpeak = sinetable[i];
    
    desiredpeak = 32767.0;
    return ((desiredpeak / inputpeak) + DBL_EPSILON);
    }
    
    void samplefloats(float *sinetable, short *samptable, int samples, double factor)
    {
    double dSample;
    int nSample, i;
    for(i = 0; i < samples; i++){
     dSample = ((double)sinetable[i] * factor);
     nSample = (int)dSample;
     if(nSample < -32767) nSample = -32767;
     else if(nSample > 32767) nSample = 32767;
     samptable[i] = (short)nSample;
    }
    }
    
    int main(void)
    {
    float *sinetable;
    short *samptable;
    double factor;
    
    printf("rawsine16.c");
    printf("=================\n");
    printf("  MAKE A SINE WAVE \n");
    printf("=================\n");
    
    sinetable = malloc(360 * sizeof(float));
    samptable = malloc(360 * sizeof(short));
    
    factor = makesinetable(sinetable);
    samplefloats(sinetable, samptable, 360, factor);
    writesamples("thing16bit.raw", samptable, 360);
    
    free(samptable);
    free(sinetable);
    return 0;
    }

    personally, I've never played with it in C/C++, but i've made a whole lot of interesting sounds using the same technique in python, its all very fun.

    I did have a link to a page describing the technique used to create sounds using the .wav file format and sine waves, but unfortunately it seems to be 404'ing now. If anyone has any further information of this subject it would be great to see it shared.

    James

  2. This is a cool app... sorry I can't help with the C++ but if you get a chance a link to that CSV file would be nice. I'd like to write my own app in PHP maybe.

    actually I just did a quick google and found one here:

    http://ip-to-country.webhosting.info/

    thanks anyway. keep up the good work.

    Yeh, we used the CSV from that site, like I said, TomB modified it a lot, if you download the package you can see what he did. If you write one in PHP, I wouldn't mind taking a look.

    Thanks

    James

  3. Thanks for adding the command line argument, that makes it a lot nicer.

    I never got a problem with EmptyLinkedList() when I compiled with minGW on windows, or gcc on linux but I'll take another look. I know ip-to-country.txt is pretty big, but since I already had it in an (almost) usable format (TomB had to make some changes) I thought I would just use it.

    Basically like I said, this application was made purely for learning purposes, but thanks for the changes, you taught me some stuff.

  4. A little while ago I decided to make an program that would trace an IP to the country it originated from. After finding a CSV file of IP Number ranges and their corresponding countries I got to work, with out much luck. After talking to TomB about it for a while, he decided to give me a pretty in-depth (at least for me) tutorial on aspects of C and C++ like linked lists and text phrasing.

    The result of this tutorial is this app: Download Source Code

    sorry about the lack of comments, everything I need is in chat logs. Its not too hard to work out though.

    The code isn't really mine, so as far as I am concerned do as you will unless TomB says otherwise.

  5. It took me 30 seconds to google the answer.

    :P

    yeh, but he wanted out answer not googles  :???:

    google would only tell him if its been done, not if its possible.

    In reply to the original question, I think the answer is no, I have never heard of it. There may be a way, but I am not aware of it. However, I am no tor expert.

  6. put linux/ or win 95 on your psp....

    @ natual_orange can't be done unless you install it in bochs, and it would be slow, unusable and wouldn't interact with the PSP's WiFi

    Look, .n00berS, I already posted this in your other thread.  This can't be done. stop trying to turn your PSP into a security tool. because it can't be done well (or at all)

×
×
  • Create New...