Results 1 to 12 of 12

Thread: Spectrum Analyzer

  1. #1

    Thread Starter
    Fanatic Member kinjalgp's Avatar
    Join Date
    Apr 2000
    Location
    India
    Posts
    535

    Question

    Does anyone know how to make spectrum analyzer for audio player. I tried a lot but could make only a audio level indacator using a single bar of bitmap and clip control of VB. please help me if anyone knows it.

    Thanks.

  2. #2
    Guest
    Do you know about time domain, frequency domain, and FFT's (Fast Fourier Transforms)? The "spectrum" is frequency information.

    Send me your code.
    [email protected]

  3. #3

    Thread Starter
    Fanatic Member kinjalgp's Avatar
    Join Date
    Apr 2000
    Location
    India
    Posts
    535
    Ya, I know about time domain frequency domain etc and also know that spectrum is plotted on frequency domain. Do you know how to do that and make a good spectrum lik that of JET Audio

  4. #4

    Thread Starter
    Fanatic Member kinjalgp's Avatar
    Join Date
    Apr 2000
    Location
    India
    Posts
    535
    I have written my program using the utorials on Audio Level Indicator available at Microsoft's website. In that they have used progress bar to indicate audio level bu i have modified it and used the Picture Clip Control to show the audio level. The picture is a bitmap on which i've drawn around 42 bars which shows different levels and depending upon the value of audio level, the corresponding bitmap is clipped and displayed in a picture box. Thus is looks like LED's moving up and down.

  5. #5
    Lively Member
    Join Date
    Jul 1999
    Posts
    87
    Where can I find this nice tutorial on Microsoft ?
    Please tell me.

    Thank you, Jerry.

    Homepage: http://fraxionsoftware.cjb.net
    ICQ: 40269591
    Mail: Contact Me

  6. #6

    Thread Starter
    Fanatic Member kinjalgp's Avatar
    Join Date
    Apr 2000
    Location
    India
    Posts
    535

    Thumbs up

    Goto microsoft.com's programmers section. In that goto visual basic downloads. there you'll find the audio level example. I don't remember the page url.

  7. #7
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221

    Unhappy

    Bah! There was no resolution in this volume sample!
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  8. #8

    Thread Starter
    Fanatic Member kinjalgp's Avatar
    Join Date
    Apr 2000
    Location
    India
    Posts
    535
    I told you that i had modified that code to produce a good looking audio level indicator using bitmaps looking like LED's.
    If you want to do so make a bitmap containing as many bars as you want starting form bar one showing only one LEd glowing and the last bar showing all LED's glowing. Paint it in green or so. Now use a Picture Clip control on your form (project refrences) now add a picture box to the form and also the bitmap tht you have prepared. Set the followng properties of the clipcontrol in the form load sub. in the same project of Microsoft. Remove the code for progress bar, but not the entire code!(clpBar is the name of my picture clip control, imgGreen is the name of the bitmap.)

    Dim a As Long

    Private sub Form_Load()
    clpBar.Cols = 42
    clpBar = imgGreen
    Timer1.Interval = 80
    Image1.visible= False
    End sub

    Private Sub Timer1_Timer()

    On Error Resume Next

    ' Get the current output level
    mxcd.dwControlID = outputVolCtrl.dwControlID
    mxcd.item = outputVolCtrl.cMultipleItems
    rc = mixerGetControlDetails(hmixer,mxcd,MIXER_GETCONTROLDETAILSF_VALUE)
    CopyStructFromPtr volume, mxcd.paDetails, Len(volume)
    If volume = 0 Then
    a = 0
    Else
    a = Log(volume) * 3 ' (I have just written this formula on trial and error basis for smooth animation)
    End If
    If a > 41 Then a = 41 'Since my bitmap has 41 vertical bars
    picBar1 = clpBar.GraphicCell(a)
    End sub


    I hope this will help you. Note that the distance between the bars in bitmap should be equal or you'll not get proper animation.

    Good Luck.
    Kinjal.

    I had asked for a tutorial on spectrum analyzer and now someone is asking me to give tutorial on audio level indiator. Ha ha ha.... Never mind!

  9. #9
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221

    Post

    Sorry didn't have time to check your sample, heres mine:
    I removed all controls except the timer and added the amplitude function., This one will show that the resolutions is too bad.
    [code]
    Private Sub Timer1_Timer()
    Dim pos As Integer
    On Error Resume Next

    Do
    DoEvents
    Caption = Amplitude
    pos = pos + 1: If pos > ScaleWidth Then pos = 0: Cls
    Line (pos, 0)-(pos, Amplitude)
    Loop
    End Sub

    Private Function Amplitude() As Long
    mxcd.dwControlID = outputVolCtrl.dwControlID
    mxcd.item = outputVolCtrl.cMultipleItems
    rc = mixerGetControlDetails(hmixer, mxcd, MIXER_GETCONTROLDETAILSF_VALUE)
    CopyStructFromPtr volume, mxcd.paDetails, Len(volume)
    Amplitude = volume
    End Function

    [code]
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  10. #10
    New Member
    Join Date
    Jul 2004
    Location
    Philippines
    Posts
    4
    I have a code of a VB Oscilloscope using sound card and modified it for my VB Temperature sensor but it's kinda slow....

    I need a VU meter that returns an integer value... for my temperature control system....

    Where can i find it in microsoft? Does it return Values?
    --Brig-XXX--

  11. #11
    New Member
    Join Date
    Jul 2004
    Location
    Philippines
    Posts
    4

    Could not get wave in meter...

    I've got the code from microsoft but it didnt work! it returns an error Msgbox "Could not get wave in meter" & Could not get wave out meter! I dont know where is the error... i am using win Xp proffessional!

    Can anybody help me?

    I need it for my Temperature monitor... using sound card...

    A sample code would be great...
    --Brig-XXX--

  12. #12
    Fanatic Member
    Join Date
    Dec 2002
    Location
    North Carolina
    Posts
    734
    You should probably make a new thread, seeing as this one is over four years old...

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