Consulting

Results 1 to 11 of 11

Thread: Sine Wave Audio Sound Generator

  1. #1

    Sine Wave Audio Sound Generator

    Is it possible to generate sine wave sound of custom frequency in excel vba?
    without beep function?

  2. #2
    VBAX Contributor GarysStudent's Avatar
    Joined
    Aug 2012
    Location
    Lakehurst, NJ, USA
    Posts
    127
    Location
    With Beep:

    [VBA]Public Declare Function Beep Lib "kernel32" (ByVal dwFreq As Long, ByVal dwDuration As Long) As Long

    Sub BeepTest(Nfreq As Long)
    Beep Nfreq, 900
    End Sub

    Sub MAIN()
    Call BeepTest(1200)
    End Sub[/VBA]

    Change the 1200 for your desired frequency.
    Have a Great Day!

  3. #3
    Well i am aware of the beep function

    I want to generate sine wave sound without beep function

  4. #4
    Mac Moderator VBAX Guru mikerickson's Avatar
    Joined
    May 2007
    Location
    Davis CA
    Posts
    2,778
    Why avoid the beep function?
    Does the sound made with that method not do what you want it to?
    or do something that you don't want?

    Also, there are websites that will create a .wav file of any sine wave that you specify. Would downloading a particular file and having Excel play that file suit your needs?

    http://www.audiocheck.net/audiofrequ...r_sinetone.php

  5. #5
    well,
    the beep function does not play from speakers and does not have good sound quality
    for building some musical program you need some files needs to play via speaker. we can play wav file by sndplaysound function but you dont have control on frequency and duration

  6. #6
    VBAX Newbie
    Joined
    Dec 2013
    Posts
    1
    Location

    Lightbulb

    Hi Jignesh,

    It is possible.
    I have a journal on this topic. Jatin D., T. S. Sheshadri and Dr. N.Ramesh, “Sinusoidal Sound Generators Using Excel”, The Journal of Acoustical Society of India, vol. 36, No. 1, pp. 39-48, 2009.
    If you require any help. You can send me a mail...

  7. #7
    VBAX Sage SamT's Avatar
    Joined
    Oct 2006
    Location
    Near Columbia
    Posts
    7,814
    Location
    JatinD,

    Glad you joined, and thank you for the reference.

    We would like you to hold the discussion with Jignesh here in this thread so that future guests and members can benefit from it.

    Thank you for the consideration of our desires.
    I expect the student to do their homework and find all the errrors I leeve in.


    Please take the time to read the Forum FAQ

  8. #8
    VBAX Newbie
    Joined
    Jun 2014
    Posts
    2
    Location
    I have a request similar to Jignesh. I'm generating song melodies algorithmically in Mac Excel and wish to hear them played - in any way possible. The note pitches and durations are simple sequences of numbers. Is there some way I can convert this data into a Midi file so that I can play it in Garageband or on some other player? Or play it directly in Excel by writing some VBA code?

  9. #9
    Mac Moderator VBAX Guru mikerickson's Avatar
    Joined
    May 2007
    Location
    Davis CA
    Posts
    2,778
    JohnF,
    Does your use of Garageband imply that you are on a Mac?
    There are ways that VBA can tell another program "play the specified file", but no way for VBA to directly play music files. (Or convert duration and pitches to sound.)

    It might be easier to use VBA to algorithmically generate the song melodies, export that information to a file and then have the other software take it from that point on.

    I'm curious to hear these algorithmic melodies, do you have any YouTube or ... of your music?

  10. #10
    VBAX Newbie
    Joined
    Jun 2014
    Posts
    2
    Location
    Quote Originally Posted by mikerickson View Post
    JohnF,
    Does your use of Garageband imply that you are on a Mac?
    There are ways that VBA can tell another program "play the specified file", but no way for VBA to directly play music files. (Or convert duration and pitches to sound.)

    It might be easier to use VBA to algorithmically generate the song melodies, export that information to a file and then have the other software take it from that point on.

    I'm curious to hear these algorithmic melodies, do you have any YouTube or ... of your music?
    Yes, I'm on a Mac. I'm using Excel to generate number sequences representing note pitches and durations to go with simple chord progressions. I'm thinking I'll construct Midi files and hopefully be able to play them in Garageband. I don't have anything you can listen to yet.

  11. #11
    Mac Moderator VBAX Guru mikerickson's Avatar
    Joined
    May 2007
    Location
    Davis CA
    Posts
    2,778
    Unfortunatly, AppleScript tells me that GarageBand is not scriptable.

Posting Permissions

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