Friday, March 26, 2010

My actual patches

I've been considering making my own patches, the one's I'm blogging about, available for download. I figured a good way to try was to find a file-sharing website. Let's see how this works!




Wednesday, March 24, 2010

Return of Thor

So I'm getting deep into sampling with the Akai S2000 and have made some great progress. It's good to have a lot of things going on to break up the monotony of working in one particular soft synth. I figured out a good trick, something that's easy to implement--keep the old Mac and the sampler at home and ONLY edit Akai programs at home. That doesn't mean I can't prepare new samples while I'm at work. It just means I have to wait until I get home to really work on putting everything together.

So I'm back to programming Thor. Still just one or two patches a day, but I'm moving forward with it. I'll be sure to share a new patch in the next day or so. The good news is I'm slowly grinding towards the end of the DX7 ROM 2a. I really am down to the final stretch!

Friday, March 19, 2010

More on sampling...

This week it seems I've been non-stop sampling with the S2000. I've made a few changes in the way I'm working which makes things faster. But it can also be a pain. Here I'll try to explain as briefly as possible what happened yesterday up until the early hours of this morning.

I started out by getting a high-powered breakfast, my ritual when I've got a big day ahead of me. That consists two pints of milk--one white, one chocolate because I don't like white milk and store-bought chocolate milk is too sweet--and a cinnamon twist from local donut shop Shipley's. Normally I'd prefer a chocolate iced donut, but my wife and I had stopped in too early. I made a pot of coffee when I got home. And let me tell you, there is NOTHING quite like working all day on a project on just a quick morning sugar rush and a steady stream of java. I made 8 cups and slowly sipped about half a cup at a time, roughly once an hour. Something else that helps is drinking LOTS of water.

First step is identify your source and record. For me this is easy: Absynth. I choose this one because it's the easiest way to draw waveforms, and I've built up a nice library of single waves. I use Absynth's record feature to get a 1/4 second snippet of 4 octaves: C0, C2, C4, and C6.

Next step is trim the samples. I've found this works best, even if the note is just slightly out of tune: C0=1348 samples, C2=337, C4=84, and C6=21.

Before I continue, let me say these samples will be out of tune and, for the moment, will have to be tuned manually. Why is that? Notice that the sample length (at 44.1k) of all 4 notes is a whole number. That's because samples are absolute; there are no fractions of samples. I forget the exact frequencies of those notes, but I do know that those frequencies do not fall neatly into any subdivision of the 44.1 kHz sample rate. What this means for us is that each new cycle is going to be a variation of the source sound until enough cycles have passed that it falls back right again. Don't ask me how many time it takes because I don't know, nor do I care. If you know how to use a calculator, you can figure it out. I'm perfectly comfortable tuning samples. Anyway, because those sample lengths are only approximations of the full wave cycle, each sample will tend to be slightly sharp.

Notice that the lengths of C4 and C6 don't fall in the same logical pattern as C0 and C2. Why is that? Notice that C2 is an odd number of samples but directly proportional to C0 4:1 based on a cycle of 1348 samples. Remember, there's no such thing as a fraction of a sample. For C4 and C6 to work, they have to be based on a slightly lower number that can be further divisible: 1344. That way, you can maintain the 4:1 ratio with C4 and C6. But what's the obvious problem here? The tuning will be pushed further sharp, a problem which will have to be corrected later.

So the samples are trimmed. A hard lesson I learned early on was that the S2000 only likes samples of a certain length. I haven't been adventurous enough to find out exactly what that is, but I did learn that 1348 samples seems to be long enough. The S2000 doesn't seem to like looping a full sample, either. So I do know that the sample length for a full wave cycle at C0 has to be at least twice that. I also figured out that the S2000 doesn't necessarily leave the loop points where I set them. Assuming that the points will be shifted somewhat, we need a third wave cycle as a safety. So that's 1348 3 times.

The next step, then, is to copy the wave onto itself to yield an appropriate length, 1348*3 for low notes and 1344*3 for high notes. This is where the samples part ways with the MBP. I load 'em up to a convenient floppy disk and transfer 'em to my almost 10-year-old PC, still running Win98SE perfectly stable! I have an audio editor that, though extremely dated at this point, works wonders with sample information. Now if only it had batch processing... The procedure goes like this: Select all, copy, move cursor to end of sample, hold down paste until the desired length is reached, tab to next window, repeat. This goes very quickly using only shortcut keys, no mouse.

After lengthening the samples, loop points have to be set. Since each sample is the same length and there is no variance in the waveform, the loops can also be all the same length. It's not a hard guess: 1348 for low notes, 1344 for high notes! The difficulty has been that this is a lengthy mouse operation, selecting an exact length and looping to selection. I'm wondering if manually typing in the info would be faster, since it should be the same for all samples.

The next step would not have made sense to me had I not learned a hard lesson last night: My particular sample editor works best in wav format and doesn't seem to output aif properly, at least not in a way that's compatible with the S2000. When I tested the samples, there were not looping. When I checked to see what the problem was, the loop length had been increased by one sample. It worked fine after I jiggled the alpha dial, but I'll leave it to the reader to guess what happens when the loop length gets jacked with! So for the way I work, the output has to be all wav from the Mac to the PC.

After the WAV files (NOT aif) have been trimmed, lengthened, looped, and root keys set, they have to be saved in a format friendly to the Akai, which IS aif. My earlier mistake had been trying to work all in aif in order to cut out a few steps which shouldn't be necessary (they are). I herd all my growed-up samples back onto floppies for the drive back to the MBP. The floppies are then erased (again, for the third time, by the way) after the wavs have been transferred to the Mac. I fire up Logic, load all samples into the bin, and then batch convert the whole lot of 'em to aif.

These go BACK to the floppies which are then loaded into the old PPC Power Mac and copied to a desktop folder. Mesa is already up and running, so it's a simple drag-and-drop into the sampler memory. Finish line!

For now, I'm fine tuning all samples from the face of the sampler. This works for now because all samples have a strong fundamental. The trouble will be when sidebands cause enough trouble to confuse the tuner or when additive waveforms emphasize an overtone which will be detected as being out-of-tune even if it isn't. In the future, fine-tuning information will have to be included in the wav file. It will certainly be less time-consuming.

Beyond that, there are a few nit-picky items to handle. For example, this process leaves the file extension in place. I like to rename all samples so that they don't have the extension. It takes a little time, but MESA makes that much easier.

Here's a wrap-up of the entire procedure:

1. Record samples with Absynth, save in wav format.
2. Trim waveforms in Logic.
*Cycle lengths are (in samples): C0=1348, C2=337, C4=84, C6=21
3. Transfer to PC
4. Copy/Paste samples to proper length
5. Set loop. Length is 1348 samples for low notes, 1344 for high notes.
6. Transfer back to MBP, load into Logic.
7. Batch-convert to aif.
8. Transfer to Mac PPC.
9. Use MESA to transfer to S2000.


Tuesday, March 2, 2010

How to make small samples that WORK

Let me start by telling where I am with the Thor project. Right now I'm having a lot of trouble staying motivated and inspired to work. I've taken some time off from the Thor project. While it was refreshing, I've also found that I'm getting lazy. It's very difficult to stay focussed. At this point, I'm feeling like working on that project is a chore.

It's the BRICK WALL. We all hit it at different times in various projects. It's not a good feeling. So how do we get through it?

The answer comes from advice I give my piano students: Proceed slowly. Getting in a hurry causes us to slip up, make mistakes, overlook important details, and form bad habits. Some brick walls are easily knocked down with a big hammer. But what if we lack the strength/discipline to wield that hammer or the wall is just too thick? Easy. Just get a smaller, lighter hammer and a chisel. SLOW DOWN. Conserve your strength. What you find is that the creative ability is strengthened through slow, deliberate work. The bricks in my wall are called Distraction and the mortar is Fatigue.

I moved my S2000 to my evening office. That went a long way to bustin' up some bricks. But that does nothing for feeling mentally, creatively, and even emotionally worn out. No biggy.... Just slow down. And that leads to the next piece of advice I give my frustrated piano students: Slow progress DOES NOT EQUAL no progress. It takes time to develop a skill in music. Chip away. Having said that, I might have a lot of time during the day, but I'm reserving that for only one or two patches a day and not the four to eight I've done in the past. Perhaps there will be a big sprint to the finish line, but it will have to wait until I can chip away at some more of this brick and mortar. We'll make it!

What I really want to write about are a few little discoveries I've made working with the Akai S2000.

I started out creating waveforms in Absynth that ranged from silly simple, like saw waves, triangle waves, pulse waves, to complex FM variations of those as well as "classic" FM (sine operator modulating up to four additive waveforms) and simple sinusoids. My next task was transferring them to the Akai. This was no big deal. I took the shortest sample I could get away with and attempted to loop a single cycle. I also thought it would be a good idea to leave off the anti-aliasing filter for a good "digital" sound. After spending many days on this, I thought I had a good things going.

Apparently I thought wrong. When I began assembling these first attempts, there were pops everywhere, and I didn't even want to think about how long it would take to fix the problem. I made it a point to stay away from the sampler for about a week because I knew there was no end to that frustration. I was also having a lot of trouble keeping my mind on Thor. Ultimately, this led to moving the sampler to my other office late last week.

Here's what I think happened: Absynth (hard lesson learned here) does not output a consistent waveform. I checked. I turned the unison random setting all the way to 0. It really made no difference. That makes it impossible to find a decent loop point consistently.

The other problem had to do with aliasing. Because of all the digital noise introduced in the upper registers, it's really impossible to find the wave cycle. And if you can't find the wave cycle, it's impossible to set the right loop point.

I discovered all this purely by listening. I can't stress that enough. When my ears could no longer explain what they were hearing, I had to resort to a visual editor to see if I could figure out the problem or confirm my suspicions.

What I found with my eyes was exactly what my ears were telling me: Absynth is horribly inconsistent. I have some theories. I'm running Absynth at the standard 44.1 kHz. My guess is that running up against the Nyquist frequency is causing some phasing problems. It could be that would happen anyway, though. If Absynth uses dithering to handle noise with anti-aliasing turned on, there should consistently be some differences in the waveform from cycle to cycle. Again, this makes looping a single cycle impractical. To check waveforms, I used Absynth to record itself (standalone version) and ported the results to Logic for trimming. It became a contest to see which cycle ought to be sampled, and it's not to be won without difficulty.

The logical conclusion is that I'd have to resort to a visual editor (Logic) to pick out these single cycles and loop the full sample. That takes all the guesswork out of setting loop points and should, in theory, render it a non-issue. Away from the Akai, I decided to test this theory in NN-XT. The result was flawless! I was making some great pads within seconds.

After getting my method down, I tested this theory on the Akai. This time I took an old Dell Inspiron with software capable of sending SDS and MIDI'd it up to the Akai (still don't have SCSI yet). The sample transfer felt almost instantaneous. At first, the loop sounded automatic (it was a saw wave). It was good like a good loop should. But the higher samples didn't sound right. So I scroll through Akai pages to try to get to the bottom of the loop problem. I got to the sample trim and the Akai got totally confused. The sample was smaller than what the Akai was prepared for, so it stopped working entirely. Complete failure. The workaround is to use the group buttons to scroll past the trim pages. After accidentally causing a few more failures, I got to the sample loop page and found there was very little room to adjust. I'm not sure why, but Akai just refuses to simply loop an entire sample, especially one that small. Am I missing something here?

Now, one mistake I made that I won't repeat was using saw waves. The problem with saw waves is they inherently have that "pop" when the cycle restarts. That makes them easy to tune. Another side benefit is looping various numbers of saw cycles for a syncing effect. This will introduce more harmonics or sub-harmonics (and they say audible loop points are a bad thing--bah!). The down side is this really only works for saw and pulse waves. While this CAN be useful for other kinds of waveforms, I generally advise against it. But the point is that tuning the "perfect" saw wave is impossible because you can't really tell whether the wave is "syncing-up" with the loop point or if it's the beginning of the cycle. Another analogy is to visualize a physical ramp. If you were to cut off the upper portion of a ramp, you'd just have a shorter ramp. If you cut the ramp in half, you'd still have a ramp. Same phase, same angle. Due to this fact, every point on the saw ramp is potentially a loop point. Good luck actually finding the right one. Using a tuner will help you get closer, but you still have to wonder if you got it exactly right.

So here are some observations: The samples have to be longer. Let's say that we make the lowest note we sample (C0) a point of reference. My ideal would be to make it 3x longer and loop the 3rd cycle. Easy. Next, we need to make all higher, shorter samples equally as long in terms of time and number of samples as the lowest sampled note. Also easily done. Finally, every wave cycle must be identical to the first. By fixing the first two problems with a simple cut-and-paste operation, each successive waveform WILL be identical.

Hold on, we're not done yet! Because of problems with Absynth not producing a consistent waveform, we can't simple relegate loop points and length to a simple function of proportion to our lowest-pitched sample. Theoretically, you should be able set all loops made this way (cut-and-paste) to exactly the same length. But what will happen with higher notes is a greater degree of variance. So start out by using the longer loop length as a point of reference and gradually shorten the loop until the loop point is inaudible--shouldn't take long. A quick SDS dump to the Akai will wrap up this part of the sample editing process.

Before I move on to further editing the samples in the Akai, I want to point out that this process really does create a perfectly flawless sample. But the real trick is listening. Ever notice how EVERYTHING in life/nature/etc. works perfectly in theory but fails in practical application? The reason why our plans fall apart so often is that changing some of the factors involved and even unintentionally introducing outside factors causes variances in the result. For example, when sampling C4 and C6, I should have gotten identical results by setting the loop length to be the same as the C0 sample with absolutely no audible loop points. Playing back those samples did not yield the expected results.

So what do you do about it? Well, on the one hand, you can freak out and consult your visual editor to figure out how to exactly line up the end of one cycle with the beginning of another. I think a common misconception is that visual editing is faster than listening. Personally, I disagree. Scrolling back and forth comparing two ends of a wave is time consuming itself. A solution is using a loop tuner to compare both ends of a loop at once, scrolling through until you find a closer match. But upon listening, you'll find that the cycle is still audible. Visual editors are great for larger-scale sampling, but ultimately you'll want to be sure that what you hear is what you want everyone else to hear. A visual editor simply will not do the same job your ears will.

Now for my final observations! An SDS dump will quickly get small samples to the Akai. Don't forget that we're now dealing with much longer samples than the single cycles I was going for in the beginning, so SDS transfers are going to take a lot more time. At least the extra time involved is still reasonable, only a few seconds.

The samples still have to be edited on the Akai. The loops so far have been perfect in the few tests I've run. You'll want to rename them. You'll also want to set a root key. We're dealing with a small number of samples for each instrument we create, so many of the inconveniences we have to put up with aren't quite so bad.

Time to go make some more Thor patches. Perhaps my future blogs will be more about sampling with the Akai S2000! I've got big plans for the sampler.


Monday, March 1, 2010

"What's Love Got To Do With It?": Harmonica 1

The DX7 in all it's glory was, as most know, featured on a plethora of recordings back in the 80s. It's this sound designer's understanding that included THE harmonica sound on Tina Turner's "What's Love Got To Do With It?" If so, it's a real FM synthesis treasure.

As I worked on this, I was once again reminded of the vast difference between the DX7 and Thor. The Harmonica 1 sound, at least the way I envisioned it, is a bit richer than most patches I've written so far. And yet for it's complexity, it's really a simple patch.

We'll start with that. FM8 shows it as a 4-op patch. So judging between the visual data behind Harmonica and the actual sound, we see it's a DECEPTIVELY simple patch. No, there won't be any need for using a resonant filter as a 4th oscillator. But we do need all our modulation resources. I'm not necessarily going to attempt a direct emulation of the Harmonica structure. Rather, this time, I'm going for a somewhat imitative timbrel quality which will be modulated by three EGs and an LFO.

Let's start by getting the basic timbre down. We have a chain of 4 ops. We'll get a better approximation if we use Osc1 in place of A and B, Osc2 in place of C, and Osc3 for the carrier. Initially, we'll ignore using any FM amount in osc2 and 3. A and B have the ratio 7.62:5.056. What do we know about decimal values in Thor? Thor doesn't like them. So let's think about them in terms of notes in the C scale. 7=Bb, 5=E. 7.62 is equivalent or approximate to the leading-tone 7th, B natural. So we'll set the ratio for the nearest harmonic interval of a 5th--5:4, or G:C. To make this work for us, we set the semi to 4, raising them both a major 3rd to get closer to the ratio we need.

The next part arises from an ongoing complaint I have about Thor's implementation of FM. This specifically has to do with how Thor handles oscillators modulating each other and all the pitch instability it causes, radically shifting the pitch in most cases. This is obviously avoided by using Key Note to scale the effect. The inherent problem with this approach, however, is that the effect cuts out at C3 with scaling at 100. I'm not going to take the time to further fix the problem now for this patch, but I think what happens next is interesting.

Route Osc1, amount 100, to Osc2 FM. You'll need two scales. Set the first amount to 63, Filter Env, and the second to 60, Mod Env. Route Osc2, amount 68, to Osc3 FM, and scale first amount 40, Amp Env, and second amount 90, Key Note. What this does is link up all 3 oscillators without making them TOO perfect. I didn't use keyboard scaling with the first set because I thought a little instability and noise in that part of the chain wouldn't be such a bad thing, and I wanted to use the mod and filter envelopes to try to recreate a kind of breakpoint effect that the DX7 uses and is absent in Thor.

We don't need filters for this one. We do need a little vibrato, however, and this is where the designer's ear comes into play. The original DX7 patch has a dramatic vibrato whose rate is keyboard scaled (the higher you play, the faster the vibrato). I don't really like doing things that way, so I'm going to keep the vibrato constant. Set LFO1, amount 13, to Osc3 Pitch. Set LFO1 rate to 5.26Hz, triangle wave. Mod Env A 9.0 ms, D 3.2 ms, and R 3.2 ms. Filter Env A 78.8 ms, D 423 ms, S -3.7dB, R 7.50 s. Amp Env A 34.9 ms, D 4.73 s, S -13.4 dB, and R 423 ms.

To finish up, notice that FM8 oscillators are not perfectly tuned to harmonic ratios. The differences are mostly very slight and subtle. You can detune the oscillators to reflect that. For my taste, however, the timbrel variation strays to far from the sound I'm trying to get, so I just substitute the chorus effect. It should be very subtle, and I'll leave the reader his/her own judgment as to what it needs.

And that's it for a simple FM harmonica!