PDA

View Full Version : Sound Generation



Mrwb
19-04-2004, 09:40 PM
Hi! I want to create a non-vcl softsynth-like thingy.
What I want, is a program capable of creating tones with a given frequency and waveform.
The problem is, I have no idea where to start, and I've been googling for 5-6 days now without any luck.
All I've found are systems which creates tones from a SoundFont file or a wav sample, and vcl stuff which uses units I'd rather avoid because of size issues.
A tutorial or something would be extremly helpfull.
Other topics that would be interesting are wav mixing, or better put, combining different waves into one wave preferably without anything else than mmsystem.

Thanks in advance! :)

Paulius
20-04-2004, 07:12 AM
I've been thinking of doing the same thing, but AFAIK there's no real tutorials for this, the most usefull stuff I found was some articles by kb http://www.kebby.org/ and there was something in hugiSE http://www.hugi.scene.org/main.php?page=hugise01

Mrwb
22-04-2004, 10:10 PM
Hey, thanks for the reply. I read kb's tut a while ago, didn't really do much for me except helping making some decisions regarding the fileformat.. :S I also checked out the articles in HugiSE when it was realeased, maybe I should refresh my memory though ;) Tobad this is a topic not often covered, at least with delphi.. oh well. I'll post here if I find out anything usefull. :)

TheLion
22-04-2004, 11:00 PM
Not sure if it's usefull, but I had a demo of a SineWav generator application written in Delphi, it came with full source, I've just checked it and found it in my old Samples directory! :)

I've searched the web and found the main website of it, but the guy doesn't include the source anymore, there is another program that also shows it, which does come with source! :)

http://www.david-taylor.pwp.blueyonder.co.uk/software/audio.html

If you want the source for the old version of SineWave (2.x), just send me your e-mail address in a PM (Private Message) on the forums and I'll mail the zip to you! :)

Mrwb
23-04-2004, 03:57 PM
Thanks! :D That was excactly what I was looking for! Only downside is the use of SysUtils etc. but that could be fixed though ;) thanks again.

Paulius
12-05-2004, 09:16 PM
I've made some progress on my softsynth http://legion.gibbering.net/paulius/Synth.zip, its really crappy, non realtime and minimalistic, cause I was thinking of makeing a 4k intro with it, but gave up - not enough bytes left to do anything decent graphically. Adds a little over 1kb to a compressed executable.

Mrwb
12-05-2004, 09:50 PM
Paulius: thats really nice! :D I've put my synth project on ice because I've had a lot to do lately at school etc. no time for programming :( Summers break is up in a month though ;)

gaze
18-01-2005, 10:46 PM
Hi there,

you could always search for soundchip emulation or YM2413 or PSG or something like that.

cairnswm
19-01-2005, 06:28 AM
I found a component called TToneGen at http://www.alan-warriner.co.uk/soft.htm

Might also give some ideas

noeska
19-01-2005, 06:28 PM
also read this: http://www.noeska.com/doal/lesson11.aspx
there should be more lessons on the way, but i do not promise anything.

Gadget
01-03-2005, 08:58 AM
Well, from experience I would start by playing around with the raw Direct Sound interface.

Essentially, you need to init the interface first, then create some cyclic buffers, write the buffers in the shape of the waveform you want, then play!

The hardest bit is actually working out what to write to the buffer, and managing buffer changes. You need to pick a frequency first, then think about the shape of the wave eg. saw tooth, then write the correct bytes (or words if 16 bit) for that shape. If you imagine that a simple square wave could alternate between $FFFF and 7FFF, simply write $FFFF for x number of bytes, then $7FFF for x number of bytes, and you should have a simple square wave. (full height to half height square wave)


I did exactly this for my Nintendo NES emulator, but just after I implemented some crude pAPU (audio) channels I shelved it.

EDIT:

Once you get that far you can start playing around merging wav files etc. It's simply a case of manipulating the buffers.