The Chatterbox > Creation Station

Spectere's Fantastique Softsynth

<< < (2/3) > >>

Spectere:
54-bit?  .NET doesn't support that! :p

I'm kind of weird when it comes to comments.  I generally either comment steps (on the WAV writer, for instance, I label all of the parts of the WAV header so that it doesn't look like glorified line noise) or comment procedures.  Things like wave generation are generally pretty obvious, too, so I tend not to document those.

I also document things that I don't understand particularly well.

Actually, do you want the full program or just a wave generator and mixer?  I could whip up the latter pretty quickly if you want a no-nonsense demonstration of that.

Bobbias:

--- Quote from: Spectere on December 24, 2010, 02:02:20 AM ---54-bit?  .NET doesn't support that! :p

--- End quote ---

Then we make it support it. Then we port .NET to a ternary computing architecture!

I think I'd rather the whole program. I prefer seeing real implementations of things, rather than some specific program designed just to demonstrate one little thing, etc. Sometimes that can be kinda helpful, but unless the API is really retarded for something (y halo thar DirectX) it's better to see a real implementation, IMO. As long as things are commented properly, and it sounds like I'd be able to follow things pretty well from what you've described your commenting patterns as. Hell, that's pretty much what I do, lol.

I comment things I don't understand well, things that might be a bit confusing (especially if I get fancy and use something crazy like a ternary operator in some obscure place), steps a lot of the time (even just as a reminder for what  the steps for something actually are) or anything that might not be very straightforward.

Of course, my commenting is a lot more sporadic lately, but that's because the largest project I've worked on any time recently has been the WPF based video player I've started. It's mostly an experiment to see how WPF works, and to see what I can make for watching videos. (Un)fortunately there is a built in WPF thing for playing media, so most of the low level stuff is completely hidden (although ideally I'd like to replace that... But it seems that there is little to no real explanation of what I'd have to do in C# to actually make one of those... I'd love to use ffdshow or something to be able to leverage that thing and play media the right way, but it seems like there's no real nice way to deal with that in C#, other than use some trashy hack of an interface someone made ages ago... Or something that's rather incomplete.)

Anyway, I'm tired, and rambling on.

Spectere:
brb, creating Malbolge.NET.

The main issue with seeing the real implementation in this case (and it's one that I'm coming to realize now that I'm trying to change synths) is that WaveGen was built around BeepMap, not vice versa.  As such, there is a ton of cruft in the synth itself to support the program.  Essentially, the program and WaveGen work together to act as a sequencer.  The program arranges the note and rest events and WaveGen processes the lists.  Due to the way it's designed, it would be practically impossible to make the program work in real-time.  The render-then-play process is required to make it work.

Because of all that, I decided to abandon bringing Synthia to the program and instead building that up as its own engine.  I made sure to put "Synthia is not a sequencer" in my design docs twice to remind myself of that.  I suppose it wouldn't be a terrible program to learn on, but I don't consider it to be a good way to write a synthesizer.  A simple wave generator?  Sure.  A softsynth?  Nah.

I'm starting on a new project from the bottom.  Synthia is going to handle mixing, plugin chains, and managing note events that are passed to it by programs.  The plugins will work similarly to Buzz Tracker, starting with a generator plugin, going through any number of effect plugins, and ending with output.  It won't have any output aside from raw stream data, but I'm going to write a program that does it for the sake of testing.  It's going to work per-sample, so it'll be possible to actually stream Synthia's output, something that isn't possible with BeepMap/WaveGen.  Furthermore, all audio processing will be done with double precision floats and converted to a desired bit depth.  I've found that dealing directly with integers is nothing short of a pain in the ass, particularly when it comes to dealing with peaks.  -1.0 and 1.0 make a hell of a lot more sense.  Plus, it'll be much easier to actually alert the calling program about clipping, since we're not dealing with maximum values anymore.

Whew, I'm kind of excited about this.  Ever since I've taken up what I like to call the "STFU and code" technique (namely, not once thinking about failing -- I used to obsess over maybes and wind up never getting anything done), I've been more driven to do this type of shit than ever.

With regards to comments, I'm a bit sporadic as well.  I distinctly recall doing actual work within a "for" statement (not inside of a block, but actually in the for statement, as the last parameter) and not really documenting it.  I'll have to look for that one.  Then there was always the comment I left when I hacked in multithreading support to a VB.NET program that I wrote a while ago.  It basically did nothing but talk about how awful and hackish the code was.  Oh well, both cases wound up working quite well.

Bobbias:
Awesome, also, lol at the comment stuff. I remember in my Java programming class in highschool I used a ternary operator inside a for loop to actually do work... That confused the shit out of my teacher :P

Spectere:
This was my piece of for abuse:


--- Code: ---for(; resIndex <= resolutions.GetUpperBound(0) && resolutions[resIndex, 1] != displayHeight; resIndex++);
--- End code ---

Fun fun!

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version