Page 1 of 3 123 LastLast
Results 1 to 10 of 24

Thread: tone generation in .WAV format using Pascal

  1. #1

    tone generation in .WAV format using Pascal

    Hi guys, I don't know if this site is of any use to you http://juhara.com/article-7-tone-gen...th-delphi.html but it shows how to generate tones as .WAV formatted data.

    I reckon it could easily be adapted to do other outputs like tones with custom ADSR (Attack Decay Sustain Release) envelopes for synthesizing notes from different musical instrument types (just an idea).

    cheers,
    Paul

  2. #2

    tone generation in .WAV format using Pascal

    so this is how we make a synth :?

    cool

    i will try some things, maybe i can replace some .wav effects generating then at program start
    From brazil (:

    Pascal pownz!

  3. #3

    tone generation in .WAV format using Pascal

    I played with that some time ago. But i think it's quite hard to generate any "usable" sounds yourself. If you want to achieve certain effect's you're better off using existing software. Generally you will only be able to generate simple "runescape-ish" sounds.

    Nevertheless, it's alway's nice to play with it. You sure learn alot by doing that.
    Coders rule nr 1: Face ur bugz.. dont cage them with code, kill'em with ur cursor.

  4. #4

    tone generation in .WAV format using Pascal

    Quote Originally Posted by chronozphere
    I played with that some time ago. But i think it's quite hard to generate any "usable" sounds yourself. If you want to achieve certain effect's you're better off using existing software. Generally you will only be able to generate simple "runescape-ish" sounds.

    Nevertheless, it's alway's nice to play with it. You sure learn alot by doing that.
    i read a litle about synths today, i will try write some kind of oscilator today, and with luch , using multiple oscilators, generate some cool sounds
    From brazil (:

    Pascal pownz!

  5. #5

    tone generation in .WAV format using Pascal

    Maybe OpenAL fits well in this kind of testing? Doesn't it take wave data same way as OpenGL takes textures, so would be ideal for realtime wave changing.

  6. #6

    tone generation in .WAV format using Pascal

    I have experience with OpenAL, and i totally agree with you. You could easily generate WAVE data on-the-fly and feed it to OpenAL. It might be even easier than saving it to disk/mem with a header and play it using WinAPI routines.
    Coders rule nr 1: Face ur bugz.. dont cage them with code, kill'em with ur cursor.

  7. #7

    tone generation in .WAV format using Pascal

    at the moment im using directsound, i will try openal later for other plataforms compatibility

    progress -> 10%
    From brazil (:

    Pascal pownz!

  8. #8

    tone generation in .WAV format using Pascal

    someone know others sources of info about programming synths ?

    everything i try seach on google i receive results about paid products or other stuff.
    From brazil (:

    Pascal pownz!

  9. #9

    tone generation in .WAV format using Pascal

    Perhaps this site could help (not pascal, but hey)

    http://www.codeproject.com/KB/audio-...lkitparti.aspx

    downloads require a free registration, but that shouldn't be an issue - I haven't had any problems (spam, etc).
    cheers,
    Paul

  10. #10

    tone generation in .WAV format using Pascal

    Oh, if it helps I have whipped up an array of note frequencies and some constants for note names (use as indices into the array).

    <note>s = sharp
    <note>b = flat
    other = normal

    I calculated them from this site http://www.techlib.com/reference/mus...requencies.htm

    [pascal]
    cNote_C = 0;
    cNote_Cs = 1; cNote_Db = 1;
    cNote_D = 2;
    cNote_Ds = 3; cNote_Eb = 3;
    cNote_E = 4;
    cNote_F = 5;
    cNote_Fs = 6; cNote_Gb = 6;
    cNote_G = 7;
    cNote_Gs = 8; cNote_Ab = 8;
    cNote_A = 9;
    cNote_Es = 10; cNote_Bb = 10;
    cNote_B = 11;
    cNotes : Array[0..11,0..8] Of Single =
    (
    //octave
    //0 1 2 3 4 5 6 7 8
    {C } (16.351875 , 32.70375 , 65.4075 , 130.815 , 261.63 , 523.26 , 1046.52 , 2093.04 , 4186.0,
    {C#/Db} (17.3242080860764, 34.6484161721528, 69.2968323443056, 138.593664688611, 277.187329377222, 554.374658754445, 1108.74931750889, 2217.49863501778, 4434.99727003556),
    {D } (18.3543591061988, 36.7087182123977, 73.4174364247953, 146.834872849591, 293.669745699181, 587.339491398363, 1174.67898279672, 2349.35796559345, 4698.7159311869),
    {D#/Eb} (19.4457660936351, 38.8915321872702, 77.7830643745405, 155.566128749081, 311.132257498162, 622.264514996324, 1244.52902999265, 2489.05805998529, 4978.11611997059),
    {E } (20.6020715177497, 41.2041430354995, 82.4082860709989, 164.816572141998, 329.633144283996, 659.266288567991, 1318.53257713598, 2637.06515427197, 5274.13030854393),
    {F } (21.8271344404066, 43.6542688808133, 87.3085377616265, 174.617075523253, 349.234151046506, 698.468302093012, 1396.93660418602, 2793.87320837205, 5587.7464167441),
    {F#/Gb} (23.1250433952296, 46.2500867904591, 92.5001735809182, 185.000347161836, 370.000694323673, 740.001388647346, 1480.00277729469, 2960.00555458938, 5920.01110917876),
    {G } (24.5001300327029, 49.0002600654058, 98.0005201308116, 196.001040261623, 392.002080523246, 784.004161046492, 1568.00832209299, 3136.01664418597, 6272.03328837194),
    {G#/Ab} (25.9569835766525, 51.913967153305 , 103.82793430661 , 207.65586861322 , 415.31173722644 , 830.62347445288 , 1661.24694890576, 3322.49389781152, 6644.98779562304),
    {A } (27.5004661403537, 55.0009322807073, 110.001864561415, 220.003729122829, 440.007458245659, 880.014916491317, 1760.02983298263, 3520.05966596527, 7040.11933193054),
    {A#/Bb} (29.1357289533821, 58.2714579067643, 116.542915813528, 233.085831627057, 466.171663254114, 932.343326508228, 1864.68665301646, 3729.37330603291, 7458.74661206582),
    {B } (30.8682295533639, 61.7364591067279, 123.472918213456, 246.945836426911, 493.891672853823, 987.783345707646, 1975.56669141529, 3951.13338283058, 7902.26676566117)
    );

    [/pascal]

    some of the frequencies (Hz) may be out slightly, but not by much so you would never notice.

    cheers,
    Paul

Page 1 of 3 123 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •