pouët.net

Go to bottom

How to: write a soft synthesizer

category: code [glöplog]
Quote:
delegate sound rendering to another thread,

you don't even have to. In W4K3D I just render a new chunk of sound at each frame. :)

Also, there's this talk I gave about 4k audio at notacon/blocparty some years back. Heavily focused on size limits, but might still be useful to some.
added on the 2013-06-03 17:42:32 by BarZoule BarZoule
yumeji: the filter code looks like its from "Musical Applications of Microprocessors", published in 1985.
added on the 2013-06-03 23:08:52 by jmagic jmagic
@BarZoule, thank you, I’ll watch it for sure when I have spare time!

Btw, I’ve heard of “time shift” by some musicians I’m friend with, and I don’t understand what it is in the end. A special effect on all instruments? Or a simple rewind of the time, accelerated?
added on the 2013-06-04 00:00:12 by phaazon phaazon
That term could mean anything, although I think what they meant was "timestretch".
added on the 2013-06-04 00:06:01 by Gargaj Gargaj
time.. stretch?
gargaj was there first.
jmagic: I have the second edition of the Han Chamberlin's "Musical application of microprocessor", and most of the example code is written in assembler for 6502, 68000 or for the Notran music system, so I don't think the code posted by yumeji comes from this book.
It's not the literal code but the algorithm is similar, i.e. using integrators.
added on the 2013-06-04 14:39:34 by trc_wm trc_wm
considering the sound playback/buffer:
what kb said

using the waveOut API does the trick without having to spend much space and thoughts on buffering, threads etc.

just make sure that the large buffer "allocation" is NOT done on the heap with a malloc or new statement.
better use a static allocation so the buffer resides in the .bss section of the binary.

it seems certain Vista/7 sound drivers (or maybe the driver model itself) dislike providing heap-allocated buffers to the waveOut functions which gets written to after the waveOut call.
at least we had undefined behaviour and even crashes with uncovering static until we changed it back to a static allocation like 4klang uses it.
added on the 2013-06-04 15:07:46 by gopher gopher
Speaking of that, how does the synth progress? Do you plan to release a public VSTi for it? It's been quite a while since Uncovering Static, and I'm really interested in seeing what you managed to come up with ;-)
added on the 2013-06-04 17:10:06 by Punqtured Punqtured
A nice / tiny / multiplatform lib to get going quickly with real-time audio I/O is RtAudio: www.music.mcgill.ca/~gary/rtaudio/
added on the 2013-06-05 00:21:03 by bdk bdk
Libaries that weren't written with size in mind are pretty much always too big for 4k/64k I'd say, no matter how tiny they are. ;)
Yep, relatively "tiny" :D
added on the 2013-06-05 00:24:20 by bdk bdk
People asking for a scenesynth version of Raymarching beginner's thread, could very well use this thread I started in hope of exactly that ;)
added on the 2013-06-06 11:48:51 by Punqtured Punqtured

login

Go to top