Hmm, Stomporgan idea...

Started by JimRayden, May 09, 2006, 06:13:21 PM

Previous topic - Next topic

RickL

Hardwire bass pedals, or momentary switches, to a portable keyboard with a 'one-finger chord' feature. Sound quality can be as good as you're willing to pay for. The deluxe version uses bass pedals with extra switches mounted on top of each pedal. All 'one-finger chord' keyboards require you to press two keys to get a minor chord. Press just the pedal for a major chord or press the switch on top, which also presses the pedal to get a minor chord.

I have several sets of keyboard/pedal combinations wired up like this that I used, along with the internal drum machine or a better drum machine MIDI'd to the keyboard, when I used to play as a single. The internal drum machine doesn't have to be running to get a sustained chord when you press the key (or the pedal or switch that you've wired in parallel with the key).

R.G.

Sorry - I kept quiet as long as I could.  ;)

There's a web page with all of the code for making a full octave of notes come out of a PIC. See: http://chip.aeug.org/oct54all.asm

This one generates all twelve notes in the octave that's one up from the guitar's low E, the one containing E on the second fret of the fourth string. It's easy to rewrite to have the tones from bass E (41hz) on up come out. That gives you a single chip that makes all of the bass notes for an octave below guitar come out at the same time.  The chip is obsolete, but a modern replacement would run the same code, and cost less than $1.50.

From there, momentary switches give  you a lowest-octave footpedal bass, with all notes coming out independently. If you took *exactly* that code and put a CD4013 dual flipflop on each output, you could sum the outputs to get a stringish sounding sawtooth wave instead of a buzzy square wave for each output. Of course, the sky is the limit in making an actual foot organ.

And no tuning, no temperature dependence, etc. as  you could crystal control the frequency if you liked.
R.G.

In response to the questions in the forum - PCB Layout for Musical Effects is available from The Book Patch. Search "PCB Layout" and it ought to appear.

Unbeliever

Very good, but it's not 'analog'. :)

R.G.

QuoteVery good, but it's not 'analog'.
Yes, I know. That's why I kept quiet as long as I could.  :icon_biggrin:

However, the bigger question is - does it matter?
I have here a chip with 18 pins on it. When you connect +9V power to it, twelve of the pins put out the equal tempered music scale as square waves. It just generates the notes. Inside the chip are analog things that do the clever analog stuff of running in synchronism from that crystal and producing just the frequencies you want on the output pins. How much better does it get?

This is exactly what the 555 and the 74HC132 circuits do, except that they require all the other R's and C's and junk to do the deed.

There are no electronic musical tone sources that are simultaneously temperature and time stable as well as purely analog. About the best is an L-C oscillator, which is what organs used to do before we got cheap digital chips. Those still need tuning.


R.G.

In response to the questions in the forum - PCB Layout for Musical Effects is available from The Book Patch. Search "PCB Layout" and it ought to appear.

JimRayden

R.G., I was waiting forward to your participation, no need to hold your breath. ;D

You, evil evil evil person made me consider looking into PIC programming. Actually digital ciruits are still an unvisited area for me. As my urge to learn exceeds my analogueism and lazyness, I think I'll actually look into programming myself, instead of just dropping a code in a chip.

But when I've already got a PIC to play with, wouldn't it be possible to program a whole organ simulator in it - several sine generators and leslie-ish phasing? Or will I have too much trouble finding a chip with an appropriate sampling rate? Can anyone explain about the digital and analogue conversion systems? Will I need a separate dedicated chip for that?

Or is decent audio generating and soundwave processing too complex an area for regular two-buck-PICs?

----------
Jimbo

R.G.

QuoteAs my urge to learn exceeds my analogueism and lazyness, I think I'll actually look into programming myself, instead of just dropping a code in a chip.
Good for you. I'll tell you the trick on the "Old Crow" audio generator. He runs a timer to overflow at a rate of 31??? Hz, and then counts down as many ticks of that timing as is needed for making each note. The 31+kHz timer gives him 128 instruction times between ticks, and he uses 89 of those in testing and outputting the audio signals, then wastes the rest of the 128 instructions in a wait loop at "Main".

And that's a good introduction to what you can and can't do in a uC of any stripe. uC's are limited by how many instructions they do in a given time period. If what you want to do is generate audio, then you have a real-world constraint on how long any set of instructions can run, and that correspondingly sets the slowest uC you can use to do that job.

For instance: making a sine wave. First you determine what is an acceptable accuracy on the sine wave. For LFOs and such, probably 8 bits is plenty. For distort-y music sounds, 8's fine. If, however, you are listening to an almost-sine flute tone in a hifi recording, you need sixteen bits to record the delicate nuances. So you have eight bits of resolution on the sine wave itself, to not waste any of those bits of resolution you need to output 256 samples to make up the sine. So you have to put out a sample 256 times in each sine wave. An 82 Hz low E has to be output at 20992 times per second. That's 48uS between each cycle, and you can only afford as many instructions in each loop as will fit in 48uS. That can get down to a remarkably tight number of instructions per loop.

Making square waves, however, is simple - you only need two samples per loop (one high, one low) so you have a relatively long time between samples, lots of instructions. That's what the Top Octave thing does, it computes timing on twelve square waves. This is still less overhead than computing the samples on a single sine wave.

Quotewouldn't it be possible to program a whole organ simulator in it - several sine generators and leslie-ish phasing? Or will I have too much trouble finding a chip with an appropriate sampling rate?
You will have a lot of trouble finding a chip that's fast enough for the straightforward job of doing several sine generators and phasing. But so much depends on how you define what you are doing. For instance: a sine wave is a deadly boring wave to listen to. Sawtooth waves are much nicer sounding, and are very much like the raw sound of an vibrating string. If you only want ONE wave out, and you settle for it being a sawtooth that you run through some passive filtering, then maybe you can reverse the problem from generating all sounds at the same time into generating only the one sound that you want depending on the key that's hit.

And yes, the alert reader will recognize that I am proposing the resistor-matrix setup as in the 74HC132 case - I was cheating.  :icon_biggrin:

Sawtooths are dead easy to program - you just set up a counter, and output the counter value to a DAC. The output is a sawtooth. So updating the output waveforms is just an add and an output instruction.

So if I were doing this app, I would get a PIC that has a built-in pulse width modulator channel. A suitable device is the 16F818 or '819. I would set up the I/O pins to scan the key switches for what key is pressed - if any. And when a key is pressed, output a sawtooth ramp on the PWM by just ramping a counter in synchronism with an internal count. The internal count can be fixed, and the key that's pressed tells you what the count to use is. When no key is down, the PWM output is 50% to avoid keying transients.

QuoteCan anyone explain about the digital and analogue conversion systems? Will I need a separate dedicated chip for that?
At one time you would have needed a separate chip. Today, most uCs have a selection of medium resolution A-D and D-A on chip. It varies with the specific chip. The 16F818 is one I like. It has up to five channels of 10-bit (that is, 1024 separate values it can read) A to D, and a 10 bit PWM output as well as the normal assortment of internal counter/timers and such. The 10bit A-D reads pots really well, although you can also do that with just the pins on a normal PIC to about 8 bits. The A-D is faster though. The PWM is a built-in DAC.

Detailed soundwave processing at high resolutions *is* too demanding for a two-buck PIC. You really need to get to 16 bit A-D and D-A at 32kHz sampling rate, plus have some time left over for processing, and they're not quite there yet. But they get better every year.

My fairness reminder is cutting in. This can get to being a terriffically complex area. But it is fun. I think you'll enjoy it. If you want help on the stomporgan, I'd be happy to help. I was doing something similar at one time - you see, I like bagpipes...  :icon_biggrin:
R.G.

In response to the questions in the forum - PCB Layout for Musical Effects is available from The Book Patch. Search "PCB Layout" and it ought to appear.

JimRayden

Informative, as always. Though I'll have to go and learn the basics of digital chips and then come back and read your post again.

I can't understand why you consider sine wave boring to listen to. According to my quick and dirty test oscillator, it's a very pleasant bell-tone. I imagine sawtooth being quite harsh sounding, be it 'complex' and interesting.

I've done some programming in the past and I reckon sawtooth and squarewave generating not being too much of a hassle. A digital phaser, on the other hand, might be quite a challenge.

----------
Jimbo

Unbeliever

Here's a digital VCO someone is developing on the synth-diy list (samples too):
http://kbadc.synth.net/dvco.html

JimRayden

Okay, first task is to comprehend the possibilities of a two-buck-PIC. Then sweep the dust off my programming skills. ;D

Being read a few tutorials and articles, I have tons of questions right now, which I don't want to ask here to save server space. Any convenient web address with some info on the topic?

-----------
Jimbo