Important alert: (current site time 7/16/2013 2:36:46 AM EDT)
 

winzip icon

Wavettes(Update 31 May))

Email
Submitted on: 5/31/2006 4:14:59 PM
By: Robert Rayment 
Level: Intermediate
User Rating: By 45 Users
Compatibility: VB 6.0
Views: 19470
author picture
(About the author)
 
     ~Wavettes~ by Robert Rayment. Designer for short WAVs using some maths formulae and a range of settings. Screenshot shows the settings. There are 3 dozen Presets (from the millions) to show the idea. These can be added to, from the program, and are saved in Presets.txt in the same folder. So can be easily editted with Notepad or whatever. WAVs can be saved as 8 or 16 bit mono, though there is usually not much difference. Some code is adapted from Ulli's prog at (CodeId=64845) and a UC container from Eric Madison at (CodeId=40130) is used. Making noisy WAVs is not to everyones's taste but I found it quite amusing and perhaps some of you will too! Zip 164 KB. __________________________________________________ Update (4th May) Compiles now with no advanced optimization. Seems to avoid a crash when exitting the exe on at least one system. One report I've had suggests that 'buzz' on headphones might be due to a Windows setting for volume or audio properties. __________________________________________________ Update (10th may) Behaviour of Play button modified to act more like normal button & some typos. __________________________________________________ Update (29th May) Replaced Play button with normal button. __________________________________________________ (31st May) Carles spotted an article in vbaccelerator.com which explains the real reason for 'crashes at shutdown' for some PCs when using XP themes with VB6. The URL is rather long so go to vbaccelerator.com, select VB section and search 'crashes at shutdown'. I haven't modified this code but you can try it if you want to. Otherwise simply delete the manifest file. __________________________________________________ Update (31st May) VBAccelerator code (see above) now included.

 

Windows API/Global Declarations:

Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
'**************************************
'Windows API/Global Declarations for :Wavettes(Update 31 May))
'**************************************
A few
winzip iconDownload code

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. Afterdownloading it, you will need a program like Winzip to decompress it.Virus note:All files are scanned once-a-day by Planet Source Code for viruses, but new viruses come out every day, so no prevention program can catch 100% of them. For your own safety, please:
  1. Re-scan downloaded files using your personal virus checker before using it.
  2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.
  3. Scan the source code with Minnow's Project Scanner

If you don't have a virus scanner, you can get one at many places on the net including:McAfee.com

 
Terms of Agreement:   
By using this code, you agree to the following terms...   
  1. You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
  2. You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
  3. You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
  4. You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.


Other 68 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Intermediate category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments

5/1/2006 2:29:50 PMLight Templer

Hi Robert, VERY cool app! My ***** for and regards - LiTe
(If this comment was disrespectful, please report it.)

 
5/1/2006 2:42:46 PMDaniel Harris

I found it amusing!! I love it and I hope you'll improve it
(If this comment was disrespectful, please report it.)

 
5/1/2006 5:09:32 PMahmed elsheshtawy

Well done
(If this comment was disrespectful, please report it.)

 
5/1/2006 8:22:42 PMSpector

Nice work Robert! Glad to see there is a lot of DSP code being posted on PSC for vb as of late. Keep it up!
(If this comment was disrespectful, please report it.)

 
5/1/2006 8:59:53 PMKenneth Foster

Another great dish from the head Chef.I love it. 5 from Texas
(If this comment was disrespectful, please report it.)

 
5/1/2006 10:05:11 PMKenneth Foster

Only problem encountered was when the program is compiled,pressing the close button, I get an error.Says GraphWav has encountered an unexpected error and must close.
(If this comment was disrespectful, please report it.)

 
5/1/2006 11:25:04 PMChris S.

Creative! Danke.
(If this comment was disrespectful, please report it.)

 
5/2/2006 12:48:14 AMBill K of Boston

nice work Robert! 5 stars here!
seems like lots of lo-freq modulation.
Why does C have modulation?
How to get pure sine wave?
Thanks,
Bill

(If this comment was disrespectful, please report it.)

 
5/2/2006 2:25:01 AMRobert Rayment

Kenneth: Sorry can't tell what the cause of your problem is - obviously I don't get it.

Bill: Can't hear any lo-freq modulation for the music scale with my sound card - curious!

Thanks all for votes!

(If this comment was disrespectful, please report it.)

 
5/2/2006 4:45:17 AMPaul Turcksin

Amazing! Wish I understood :)
(If this comment was disrespectful, please report it.)

 
5/2/2006 8:01:36 AMTerriTop

Robert, as always an excellent bit of code!! I especially enjoy the grahical representation of the waveforms....very nice touch. Thanks for sharing this....TerriTop
(If this comment was disrespectful, please report it.)

 
5/2/2006 8:08:03 AMUlli

well done robert and tnx for the ref
(If this comment was disrespectful, please report it.)

 
5/3/2006 2:02:21 AMe-roq

Awesome. :)
5 Globes
(If this comment was disrespectful, please report it.)

 
5/4/2006 2:20:11 AMEvilgenious

I play it and after closing it I am still hearing waves in my headphone like a bee singing in my ears. Those noise were horrible but the work was awesome.*****
(If this comment was disrespectful, please report it.)

 
5/4/2006 8:15:47 AMRobert Rayment

Evilgenius: Strange I don't get that. Try commenting out StopPlay on the main form at Form_Unload.
(If this comment was disrespectful, please report it.)

 
5/4/2006 8:40:02 AMRobert Rayment

EvilGenious: Alternatively, in ModeResWav.bas try

Public Sub StopPlay()
'PlaySound 0, SND_PURGE
PlayWAV vbNull, 0, SND_PURGE
End Sub

(If this comment was disrespectful, please report it.)

 
5/4/2006 12:34:41 PMRobert Rayment

I've now had this program tested on a WinME, Win2K and another 2 WinXP systems all with no problem. So difficult to know why the 2 problem encountered above are occurring. Maybe related to the sound card?
(If this comment was disrespectful, please report it.)

 
5/5/2006 8:15:58 AMKenneth Foster

Robert, That took care of the problem I had.Now works fine. Ken
(If this comment was disrespectful, please report it.)

 
5/6/2006 3:17:18 AMStewart

The code is clean and well written. More than anything though it does what you say it will do and it does it well. You have commented a lot of the sections well which unfortunatly is more than I can often say for myself. Very nicely done. 5 balls :)
(If this comment was disrespectful, please report it.)

 
5/6/2006 12:39:36 PMEvilgenious

Hmmmm.I dont understand why this problem arised. I also play it on other headphone and it worked well. May be problem with my headphone. Sorry Robert.
(If this comment was disrespectful, please report it.)

 
5/6/2006 1:32:13 PMRobert Rayment

Thanks for replies. Seems as though the 2 fundamental problems are resolved. Though why checking the advanced options seems OK on most PCs but not all is a puzzle.
(If this comment was disrespectful, please report it.)

 
5/11/2006 9:18:44 AMHappy Lobster

Thanks for sharing this code! It's cool - could play on this for hours.

Readers might also be interested in this:

http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=56198&l ngWId=1

Wicked
little synth with a pattern editor.


(If this comment was disrespectful, please report it.)

 
5/12/2006 8:40:39 AMHappy Lobster

5/5
(If this comment was disrespectful, please report it.)

 
5/12/2006 11:12:24 AMRichard Mewett

Robert - simply fantastic! One of those (increasingly) rare gems that really makes you go "wow!" I assume this must have been a hard slog and highly deserving of *****
(If this comment was disrespectful, please report it.)

 
5/12/2006 12:29:10 PMRobert Rayment

Richard - thanks. Actually Ulli's program provided a good 'kick start'. The hardest thing I've written in recent years was the Chess program.

(If this comment was disrespectful, please report it.)

 
5/29/2006 11:25:44 AMEric O''Sullivan

Robert, great project but there are some bugs. I get a "Send Error Report" when exiting out of the compiled version and there is some odd CPU usage going on. If you select a function, the cpu usage goes up and stays there until about 2 seconds after you play it at which point it goes back down again.
(If this comment was disrespectful, please report it.)

 
5/29/2006 12:24:36 PMEric O''Sullivan

oh, and if you need code to trap the Error Report dialog to help see what's up, let me know and I'll send you a module
(If this comment was disrespectful, please report it.)

 
5/29/2006 12:51:04 PMRobert Rayment

I think the original Play button has caused the odd problem on one or two PCs. Replaced now with normal command button.
(If this comment was disrespectful, please report it.)

 
5/29/2006 1:00:06 PMEric O''Sullivan

found the bug with the Error Report - it's caused by the InitCommonControls call and the manifest. If you take it out, the program runs and exits fine.
(If this comment was disrespectful, please report it.)

 
5/29/2006 1:48:33 PMRobert Rayment

Thanks Eric well that's a solution. Puzzle is why I have no such problem on my PC - ah well!

(If this comment was disrespectful, please report it.)

 
5/29/2006 3:43:34 PMRiccardo Cohen

Very good code, thanks for sharing! Only one issue: Program crashes when window is closed.
5 globes from me!
(If this comment was disrespectful, please report it.)

 
5/29/2006 3:47:09 PMRiccardo Cohen

Addition: running windows Xp sp 2
(If this comment was disrespectful, please report it.)

 
5/30/2006 1:16:26 AMRobert Rayment

The manifest file seems to be problem on some PCs - try deleting it.
(If this comment was disrespectful, please report it.)

 
5/31/2006 11:56:37 PMT Jackson

Shame I don't have VB6. If it works half as good as it looks, *****. GUI design is excellent. Well done.
(If this comment was disrespectful, please report it.)

 
6/10/2006 5:12:39 AMChad Gutowsky

Like WOW...... Pure pefection. Thanks for sharing, this is so very sweeeeet. ^O^
(If this comment was disrespectful, please report it.)

 
6/25/2006 12:00:06 PMkilll

great! more work to polish!

add more functions to deal with wav

just like cool edit pro
(If this comment was disrespectful, please report it.)

 
7/13/2006 7:09:48 PMWarren Goff

Hi

Could you tell me why when I loop from 20 Hz to 20kHz (20000) I get lower frequency sine waves mixed in? I default to Sine(X), No ramps and no echo, duration .1 sec and I changed the HS(1) min=20 max = 20000.
Dim i As Long
For i = 20 To 20000 Step 100
HS(1).Value = i
Lab(1) = "Frequency = " & i
aPlay = True
aPlayOnce = True
EvalPlot PIC, PIC2, uAmp * AmpMult, uFrq, uDur, aPlay
PlayWAV SoundFile(1), 0, SND_MEMORY Or SND_ASYNC
Next

Thanks...


(If this comment was disrespectful, please report it.)

 
7/14/2006 1:14:57 AMRobert Rayment

Warren: If you mean the display then this samples across the whole wavette but as there are only about 500 sample points(pixels) it cannot produce an exact shape of the wave. It is an indication only. The alternative would be to only display a fraction of the wavette and to have a scrolling display. This would be more accurate but would not quickly show the overall shape.
(If this comment was disrespectful, please report it.)

 
6/6/2007 6:21:04 AMJoaquin Marcher

OMFG, the return of this amazing application, Robert, do you marry me? :P you're the best, I love all your works! nice to meet you =)
(If this comment was disrespectful, please report it.)

 
4/26/2009 11:56:35 PMEddie

Robert, this is a great program. I'm a maths teacher and I was looking for something to connect trigonometry with, so that my students can see that trigonometry has other (cool) applications.
I wonder, would it be possible to be able to save to mp3 and mid file formats?

All in all, 10/10 from me.
(If this comment was disrespectful, please report it.)

 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.