Results 1 to 4 of 4

Thread: Tips for Sound Waves

  1. #1

    Thread Starter
    pathfinder NotLKH's Avatar
    Join Date
    Apr 2001
    Posts
    2,397

    Tips for Sound Waves

    Just wondering if any of you have any ideas for sounds.
    I'm programming wave files in my off time, and so far I've
    concentrated on waves from simple sin constructions, sin
    constructions where the frquency varies by another sin or cos
    function, multiples of sin/cos functions with 2 different frquencies
    and 2 different amplitudes. Any Suggestions?

    for example, one of my wav subs looks like this:
    VB Code:
    1. Private Sub SIREN(ByRef IN_WAVE As Variant)
    2. Dim MyLen As Long
    3. Dim PIE As Double
    4. Dim MyVal As Long
    5.  
    6. Dim MyInc_01 As Double
    7. Dim MyInc_02 As Double
    8. Dim MyInc_03 As Double
    9. Dim MyInc_04 As Double
    10. Dim MyHight01 As Long
    11. Dim MyHight02 As Long
    12. Dim Freq_01 As Long
    13. Dim Freq_02 As Long
    14. Freq_01 = Val(TogTxt(2).Text)
    15. Freq_02 = Val(TogTxt(3).Text)
    16. MyInc_04 = (Freq_01 - Freq_02)
    17. PIE = 3.14159265358979
    18. MyLen = UBound(IN_WAVE)
    19. MyInc_01 = 2 * Freq_01 * PIE / MyLen
    20. MyInc_02 = 2 * Freq_02 * PIE / MyLen
    21. MyInc_03 = Val(TogTxt(4).Text) * PIE / MyLen
    22. MyHight01 = Val(TogTxt(0).Text)
    23. MyHight02 = Val(TogTxt(1).Text)
    24.     For i = 0 To UBound(IN_WAVE) ' Step 2
    25.         MyInc_01 = 2 * ((Sin(MyInc_03 * i)) * MyInc_04 + Freq_02) * PIE / MyLen
    26.         MyVal = MyHight01 + Int(MyHight02 * Sin(i * MyInc_01))  '+ Int(MyHight02 * Sin(i * (MyLen - (2 * i)) * MyInc_02 / MyLen)))
    27.         If MyVal > 32000 Then
    28.             MyVal = 32000
    29.         Else
    30.             If MyVal < -32000 Then
    31.                 MyVal = -32000
    32.             End If
    33.         End If
    34.         IN_WAVE(i) = MyVal
    35.     Next i
    36. End Sub

    and a couple of sample outputs are attacheded.

    Any Suggestions?
    Attached Files Attached Files

  2. #2
    Hyperactive Member thinktank2's Avatar
    Join Date
    Nov 2001
    Location
    Arctic
    Posts
    272
    Mathematica has a play function that can generate sound files.

    Actually they are quite funny !!

    One of the commands is Play

    "Play[f, {t, tmin, tmax}] plays a sound whose amplitude is given by f as function of time t in seconds between tmin and tmax."

    you can even generate sounds in number of channels.

    Play[{f1,f2,f3,...fn},{t,tmin,tmax}]

    There are probably many sound related functions in mathematica but I only remember this one.

    http://documents.wolfram.com/v4/MainBook/2.9.18.html

  3. #3

    Thread Starter
    pathfinder NotLKH's Avatar
    Join Date
    Apr 2001
    Posts
    2,397
    Sorry,
    I was hoping for a more personal response.

    I"M making wave files by hand, and I was hoping for some tips,
    ie, equations to generate interesting sounds. Mathematica might
    be able to, but I want to do it by hand. So....\If you have any
    good equations you can suggest, please do so. BTW, their
    equation is just a simple wave, but still, good for this thread, for
    all the possible followers.


    -Lou

  4. #4
    Hyperactive Member thinktank2's Avatar
    Join Date
    Nov 2001
    Location
    Arctic
    Posts
    272

Posting Permissions

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



Click Here to Expand Forum to Full Width