Results 1 to 4 of 4

Thread: Tips for Sound Waves

Threaded View

  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

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