electro-music.com   Dedicated to experimental electro-acoustic
and electronic music
 
    Front Page  |  Articles  |  Radio
 |  Media  |  Forum  |  Wiki  |  Links  |  Store
Forum with support of Syndicator RSS
 FAQFAQ   CalendarCalendar   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   LinksLinks
 RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in  Chat RoomChat Room 
 Forum index » DIY Hardware and Software
DIY Atmel AVR based MIDI to CV converter
Post new topic   Reply to topic Moderators: jksuperstar, Scott Stites, Uncle Krunkus
Page 1 of 2 [30 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
Goto page: 1, 2 Next
Author Message
bigtex



Joined: Mar 30, 2006
Posts: 321
Location: Cupertino, California

PostPosted: Wed Jul 26, 2006 4:01 pm    Post subject: DIY Atmel AVR based MIDI to CV converter Reply with quote  Mark this post and the followings unread

I want to make my own MIDI to CV converter, and I want to use the Atmel AVR platform. Why wouldn't I just make the MIDIbox project? Two reasons:

1. I prefer AVRs over PICs because I already know/understand the architecture and instruction set.

2. I already have an AVR controller board and programmer that I can use as a development platform.

So before I get started on code, I wanted to look a little bit at hardware and interface. I think those are more important anyway. The code should only perform what the basic logic ICs can't do easily (MIDI data filtered and pushed out to many DACs).

I'm hoping somebody here has some previous experience experimenting with DACs. I'm thinking that I could make my outputs significantly cheaper if I just build a resistor-ladder 7-bit DAC. MIDI uses 7-bits to represent the note number, i.e. 128 possible notes. If I only plan on using the 12-note scale with this particular project, why bother with an expensive 16-bit DAC if all I need is 128 steps? If I could just scale the voltage between steps to 1/12 of a volt, rather than trying to precisely dial it in using a higher resolution DAC, I'd save a lot of money. That means I could make more output channels, too.

So I'd want each output bit (0 is LSB) to look like this:

0 = 1/12 V
1 = 2/12 V
2 = 4/12 V
3 = 8/12 V
4 = 16/12 V
5 = 32/12 V
6 = 64/12 V
7 = not used

So, for example, note 69, which is supposed to be the A above middle C, or A440, would look like 0b01000101, and would output 69/12 of a volt, or 5.75 volts. The MIDI note number would simply become the numerator in an N/12 fraction. Rather simple, actually. All I'd need are some good precision resistors and it should work like a charm. The microcontroller would hardly be doing any work at all. In fact, with a little deep thought, I could probably do the whole thing with standard logic ICs. But that's probably not necessary.....

I should add that I intend to use all 16 MIDI channels available on a cable, so I'd have 16 outputs, each with pitch voltage and a gate. This method would only work for the note voltage, because for general use CVs, I'd get horrible zippering (i.e. using a CC to control filter cutoff, etc). That's where using a nice DAC comes into play.

So I envision the hardware layout to be uC -> two 8-bit output ports -> serial to parallel converters to get 16 parallel 8-bit channels -> resistor ladders -> pitch CV output. For the gate outputs, I might multiplex 8:16 to use only one more output port to get my gate voltages. That would leave the fourth I/O port for various panel controls or other outputs if necessary. I'd need to use at least one pin for the MIDI input.

I'm aware that any kind of alternate scale, microtuning, etc, would not work in this setup (unless there was a potentiometer per each bit...). I'm just looking to see what others think. Does anybody have any thoughts on this, or a reason why it wouldn't work?
Back to top
View user's profile Send private message
bigtex



Joined: Mar 30, 2006
Posts: 321
Location: Cupertino, California

PostPosted: Wed Jul 26, 2006 4:20 pm    Post subject: Reply with quote  Mark this post and the followings unread

This is sort of for my own reference, but may be of use to others:

MIDI to Equal Temperament Semitones to Hertz. A very handy lookup table.

MIDI Spec. A rather detailed description of MIDI specifications and what MIDI data words look like.

MIDI specification. A more nicely sorted list of MIDI specifications.

R/2R DAC. Example of a resistor-only DAC with a little bit of explanation of theory.

Digital to Analog conversion. Several DAC methods explained. The HyperPhysics page is just fantastic in general, and has in-depth examples and theory for all kinds of digital circuits.

A thought I just had, which may be a good or bad idea, is to use two quad opamps rather than a bunch of resistors. I could then precisely set the gain on each opamp to give the proper output voltage. The advantage here would be bringing those gain adjustments out to the panel to allow for some strange micro-tuning. There could be center detents on the potentiometers, so a normal scale with 12 equal semitones would be easy to return to, but changing the output voltage on a particular bit would alter the tuning of only select notes and still leave octave scaling more-or-less normal. That would be an interesting, albeit possibly non-musical, effect.
Back to top
View user's profile Send private message
DrJustice



Joined: Sep 13, 2004
Posts: 2031
Location: Morokulien
Audio files: 3

PostPosted: Wed Jul 26, 2006 4:57 pm    Post subject: Reply with quote  Mark this post and the followings unread

Hi bigtex!

My first synthesizer (a kit) used a 6 bit R/2R ladder for the CV DAC. The resistors had a tolerance of 0.1%. Each R/2R pair had to be carefully matched and the best pairs put on the MSB end. Doing the best I could with the mirror-scale ohm meter I had at the time, the tuning was musically acceptable in the end, but it never got perfect.

This is not to discourage anyone from making a one-semitone-per-step R/2R DACs, just be aware that the resistor values are very critical if you want it to be well tuned (i.e. linear). The adjustable opamp based DAC is an interesting idea, but it could be hard to keep it in tune perhaps(?)

You can of course get very high precision resistors, e.g. like these.

DJ
--

Last edited by DrJustice on Wed Jul 26, 2006 5:13 pm; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website
bigtex



Joined: Mar 30, 2006
Posts: 321
Location: Cupertino, California

PostPosted: Wed Jul 26, 2006 5:08 pm    Post subject: Reply with quote  Mark this post and the followings unread

Thanks for the experience. I assumed it will be dificult to get perfct, considering how critical the tolerances of the resistors would be. Do you remember how far off it was?

Perhaps there is some commercially available DAC that allows setting the reference voltages. If I could feed an 8-bit DAC with a very precise 256/12 volts, or 21.3333... volts, it would then divide that into 1/12 volt steps. I doubt there are any DACs available that would allow a reference voltage so high, though. There's got to be an easier way...

In the end, a custom circuit to do this type of division reliably may end up being as much trouble and expense as using a nice 16-bit DAC. But getting a quantity of 16 high quality 16-bit DACs would really add up...

I'd still like to try to find a solution. A cheap and effective MIDI to CV converter with many channels would sure be nice. I just don't feel like shelling out the big bucks for an Encore Expressionist.
Back to top
View user's profile Send private message
DrJustice



Joined: Sep 13, 2004
Posts: 2031
Location: Morokulien
Audio files: 3

PostPosted: Wed Jul 26, 2006 5:19 pm    Post subject: Reply with quote  Mark this post and the followings unread

Hmmm... I should have checked these precision R/2R networks first Exclamation

I had no fancy instruments back when I built that DAC. If you listened really careful you could just about hear that it wasn't perfect, but when playing real music it wasn't bothersome to me.

DJ
--
Back to top
View user's profile Send private message Visit poster's website
bigtex



Joined: Mar 30, 2006
Posts: 321
Location: Cupertino, California

PostPosted: Wed Jul 26, 2006 5:25 pm    Post subject: Reply with quote  Mark this post and the followings unread

Oh wow, 0.01% tolerance! Yeah, this is why I was thinking of using a resistor network. I was sure there must be some kind of matched high-precision resistor network like this out there. Now I just need to find a 7-bit or 8-bit equivalent. I bet this will be good enough to actually stay in tune and scale properly. Nice.

Thanks!
Back to top
View user's profile Send private message
DrJustice



Joined: Sep 13, 2004
Posts: 2031
Location: Morokulien
Audio files: 3

PostPosted: Wed Jul 26, 2006 5:31 pm    Post subject: Reply with quote  Mark this post and the followings unread

The Semiconwell folks have 7 and 8 bit networks as well, upwards to 24 bits in fact Smile And yes, I would guess that 0.01% or better will give nicely enough tuned DAC

DJ
--
Back to top
View user's profile Send private message Visit poster's website
bigtex



Joined: Mar 30, 2006
Posts: 321
Location: Cupertino, California

PostPosted: Wed Jul 26, 2006 5:59 pm    Post subject: Reply with quote  Mark this post and the followings unread

Cool, thanks. They've got a great selection. I was also just looking up what Vishay has in the way of resistor networks, and they have some with tolerances of 0.0025%. Crazy. So between Semiconwell and Vishay, I think I'll find something perfect. Semiconwell even has 7-bit ones. Perfect: not a single pin wasted, hooray!

Another idea I just had was to use the 8th bit, which would otherwise be unused, to drive the gate outputs. It would be fairly trivial to do in code, and would make the hardware design much simpler because I wouldn't need to use any extra port outputs. I could then use the gate output to also drive a panel LED to indicate which channels have an active note.

This just might be a really simple project, now that I've thought about it for a bit.

In fact, since I'd have a whole unused port on the uC, I could acutally also add in some 16-bit DACs for CCs. But I think I'll just keep this one simple for now. I'll be more likely to actually build it . Smile

Okay, time to bust out the mechanical pencil and lovely green engineer's rule graph paper.
Back to top
View user's profile Send private message
State Machine
Janitor
Janitor


Joined: Apr 17, 2006
Posts: 2730
Location: New York
Audio files: 23

PostPosted: Wed Jul 26, 2006 6:37 pm    Post subject: Reply with quote  Mark this post and the followings unread

Quote:
In the end, a custom circuit to do this type of division reliably may end up being as much trouble and expense as using a nice 16-bit DAC. But getting a quantity of 16 high quality 16-bit DACs would really add up...


Tex, there are lots of fairly cheap multi-DAC's that would be suit your applications well. They are much more linear than what you will get from finding the right combination of resistors in a ladder network. Not that your idea is bad, I am just suggesting an easier solution. I am currently using an Octal-12 bit DAC from Analog Devices, AD5348. I have it humming away on my bench right now feeding it lookup tables of waveform data!

http://www.analog.com/en/prod/0,2877,AD5348,00.html

I would order 2 samples from Analog Devices. The best thing about that is they don't charge a dime for the samples. Since they are SMT, you would need a conversion platform. Here is where I get all my SMT adapters:

http://www.beldynsys.com/kits.htm

These adapters open a whole world of prototyping for any project builder!


In a paper I wrote a fairly detailed description of the AD5348 device:

The AD5348 is the chip that has been chosen for digital to analog conversions. As seen from Figure 2.11, it is a highly integrated device with a total of eight DACs on a single chip.

“The AD5348 is an octal 12 bit DAC operating from 2.5 to 5.5 volt supply. These devices incorporate an on-chip output buffer that can drive the output to both supply rails, and also allows a choice of buffered or unbuffered reference input.

The chip has a parallel interface. The /CS (active low chip select) selects the device and the data (placed on D0-11 pins) is loaded in the input registers on the rising edge of /WR (active low write strobe). A readback feature allows the internal DAC registers to be read back through the digital port by the use of the /RD input.

The GAIN pin of these devices allows the output range to be set to 0 volts to VREF or 0 V to 2(VREF). Input data to the DACs is double-buffered, allowing simultaneous update of multiple DACs in a system using /LDAC pin (active low load DAC strobe).

An asynchronous /CLR (active low clear strobe) input is also provided, which resets the contents of the input and DAC output registers to all zeros.

These devices also incorporate a power on reset circuit that ensures that the DAC powers on to 0 volts and remains there until valid data is written to the device.” (Analog Devices, 2003) Each DAC is individually selectable via a three bit address applied to the A[0:2] pins. This address is set before writing to the device.
Back to top
View user's profile Send private message Send e-mail
bigtex



Joined: Mar 30, 2006
Posts: 321
Location: Cupertino, California

PostPosted: Wed Jul 26, 2006 7:04 pm    Post subject: Reply with quote  Mark this post and the followings unread

State Machine wrote:
Tex, there are lots of fairly cheap multi-DAC's that would be suit your applications well. They are much more linear than what you will get from finding the right combination of resistors in a ladder network. Not that your idea is bad, I am just suggesting an easier solution.


A cheap multi-channel DAC was the first thing I looked for, actually, before persuing this resistor ladder idea. I guess I didn't look long and hard enough. I may have actually forgotten to check Analog Devices, which is odd, because I'm testing ported code on an ADI DSP development platform at work right now Rolling Eyes

I kind of gave up on that idea after I could only find quad DACs from the likes of Maxim and TI. I think I was also skimming over the non-DIP stuff. I should know better, though, since I can actually solder surface mount stuff reasonably well by hand. In fact, only a year ago (at my previous job) I had gotten as good as replacing 68HC12 chips in under 5 minutes!

Totally off-topic, but check out some of what I used to work on: ROBOTS! I was the electronics tech at Cal Poly's ME department and had a pretty big part in the mechatronics classes. What a lot of fun that was Very Happy

Anyway....


State Machine wrote:
I am currently using an Octal-12 bit DAC from Analog Devices, AD5348.

http://www.analog.com/en/prod/0,2877,AD5348,00.html

I would order 2 samples from Analog Devices. The best thing about that is they don't charge a dime for the samples. Since they are SMT, you would need a conversion platform. Here is where I get all my SMT adapters:

http://www.beldynsys.com/kits.htm

These adapters open a whole world of prototyping for any project builder!


Perfect! I'm definitely going to be sampling these chips. I'm actually rather well acquainted with the sampling process. Been doing it for years. I'm kind of a cheap bastard, so almost everything I've ever built circuits out of was free. It's really in these companies' best interest to give out free samples, including to hobbyists and students, and I'm glad that the sample requesting process has only gotten better and easier over the years.

As for the SMT to DIP adapters, I wish I had kept even a few of the ones I designed at Cal Poly. They were used in the robots shown in the videos above for some really nice TI H-bridges that were only available as SMD. At least I still have all of my Eagle files. It took some time to maximize how many adapters I could fit onto a board, and how many different package styles I could make the adapters compatible with. They turned out really nice. I got the best bang for the buck by getting 14" square boards and then just cutting them up with a bandsaw. Lots and lots and lots of little adapters. Followed by soldering and soldering and soldering pin headers. Well worth it, though. It's a lot cheaper than buying pre-made ones. I could probably just have a few more boards made from a PCB house. Though for just a handfull of adapters, I suppose it makes sense to buy them.

Thanks for all of the info on the Analog Devices DAC. I'm definitely going to look into using that for my design.

Last edited by bigtex on Thu Jul 27, 2006 12:06 am; edited 2 times in total
Back to top
View user's profile Send private message
bigtex



Joined: Mar 30, 2006
Posts: 321
Location: Cupertino, California

PostPosted: Wed Jul 26, 2006 7:22 pm    Post subject: Reply with quote  Mark this post and the followings unread

Just more notes here... ideal voltages, of course... I'll find out what I really get when my samples arrive Very Happy

Code:
Vref = 5.3333 V

0b00000001 = 0.020833 (LSB)
0b00000010 = 0.041667
0b00000100 = 0.083333
0b00001000 = 0.166667
0b00010000 = 0.333333
0b00100000 = 0.666667
0b01000000 = 1.333333
0b10000000 = 2.666667 (MSB)


With these voltages, I'd drop the LSB and just use the upper 7 bits. Then run the output through an opamp (ideal, of course...) with a gain of 2. That would make my lowest used bit's voltage double from 0.41667V to 0.083333V, which is 1/12 of a volt, which is one semitone. So, considering ideal components, this should work perfectly. Now where do I go buying an ideal DAC and an ideal op amp? Rolling Eyes



Edit: Because I just can't help myself, I did a quck FPD sketch of what I might want the panel to be.

Posted Image, might have been reduced in size. Click Image to view fullscreen.

- The MIDI, CV, and gate jacks should be fairly self-explanatory
- The panic button tells the AVR to send zeros to the DACs (turn all outputs off, basically).
- The tune button will send note 69 (reference A, i.e. 440 Hz) to all CV outputs. I can then tune the oscillators against a reference, all at once.
- The 24PPQ output jack will be the MIDI clock's 24 pulse per quarter note signal. I could then pipe this into other analog sequencers (likely through a divide-by-6 to get 4/4 time).

So, depending on the quality of the components I can find, this should be a nice, cheap way to get LOTS of note-only CV outputs. Once I've tackled this I'll feel a little more comfortable designing a higher resolution one for converting MIDI CCs into nice smooth CVs. It could even be an add-on to this project, given enough I/O ports on the uC (or more creative use of multiplexing data outputs). That would be one nice MIDI to CV converter indeed. Imagine 16 note outputs, 16 gate outputs, and perhaps 32 other CV outputs for filters. I'm going to need a much bigger modular Very Happy Very Happy Very Happy (one day...)
Back to top
View user's profile Send private message
jksuperstar



Joined: Aug 20, 2004
Posts: 2478
Location: Denver
Audio files: 1
G2 patch files: 18

PostPosted: Thu Jul 27, 2006 12:53 am    Post subject: Reply with quote  Mark this post and the followings unread

For the DAC, look for a SPI one, since it'll be fast enough, and you'll only have to run 4 wires Smile Smile

I like the AVR architecture too. I built a box with it (you can see it here:
http://electro-music.com/forum/viewtopic.php?highlight=midi+diy+knob&t=7323
)

-jk*
Back to top
View user's profile Send private message Visit poster's website
bigtex



Joined: Mar 30, 2006
Posts: 321
Location: Cupertino, California

PostPosted: Thu Jul 27, 2006 1:19 am    Post subject: Reply with quote  Mark this post and the followings unread

Nice box. You should put up some more info about it. Have you done any more development on it in the last year?

Four wires? I was assuming one wire per resistor ladder DAC in my original plan. The one wire would carry the serial data and then I'd use a serial to parallel converter for each of 16 channels, so 16 output pins form the uC.

If I were to use a multichannel DAC like State Machine suggested, I could get away with even less, unless I'm using parallel DACs, of course... If would be kind of nice, though, to use a 16-channel DAC. I could use a tinyAVR instead. One wire for MIDI input and one wire for serial output to the DAC.

What are the four wires needed for SDI? I know there's a chip select, but that would always be high, so I wouldn't need to use a uC output pin for that. Would another wire be for clock?

I really do need to do some more research on all of this. Oh, the time....
Back to top
View user's profile Send private message
State Machine
Janitor
Janitor


Joined: Apr 17, 2006
Posts: 2730
Location: New York
Audio files: 23

PostPosted: Thu Jul 27, 2006 6:41 am    Post subject: Reply with quote  Mark this post and the followings unread

Quote:
I like the AVR architecture too. I built a box with it (you can see it here:


I love the packaging design. Looks great !!! Very Happy
Back to top
View user's profile Send private message Send e-mail
State Machine
Janitor
Janitor


Joined: Apr 17, 2006
Posts: 2730
Location: New York
Audio files: 23

PostPosted: Thu Jul 27, 2006 7:27 am    Post subject: Reply with quote  Mark this post and the followings unread

Quote:
What are the four wires needed for SDI? I know there's a chip select, but that would always be high, so I wouldn't need to use a uC output pin for that. Would another wire be for clock?


SCLK is for the serial clock, which is always driven by the master: MISO is master-in slave-out data: MOSI is master-out slave-in data. In a typical application, connect the microcontroller's SCLK to the converter's SCLK input, connect the MISO to the converter's DOUT pin, and connect the MOSI pin to the converter's DIN pin. Serial protocols such as SPI, a chip-select input is required to enable the IC. Using this chip-select signal it is possible to connect many ICs to same SPI bus in parallel.

If I were to go with a serial standard, I would use I2C. The key advantage of this interface is that only two lines (clock and data) are required for full duplexed communication between multiple devices. The interface typically runs at a fairly low speed (100kHz to 400kHz). With I2C, each IC on the bus has a unique address. Chips can act as a receiver and/or transmitter depending on it's functionality. There are several multi-DAC available using this interface. If you require faster speeds though, then SPI would be the choice as "superstar" pointed out as his preference.


Quote:
The MIDI, CV, and gate jacks should be fairly self-explanatory


Tex, don't forget a MIDI "THRU" ... easy to add and really comes in handy if you do add more modules and you are not using all 16 channels for a particular patch .... Very Happy


Your ideas are looking good so far my friend !!!

A few comments:

The reason I like higher resolution DAC's is that the output can be a NOTE- CV one minute, as yo intend, and the next it's a HI-Res LFO running at 30 Hz ... you get my drift. It's all in the firmware. The AVR is a powerful RISC IC, you may as well add some cool features as time goes by.

Also, some design history. Years ago when DAC's were expensive and bulky, and no multi DAC's were available, a common technique was to have, say, 8 or 16 CV channels, a single DAC was used and each channel would have a sample and hold channel to sample the DAC's output. The control logic would sequentially scan each channel periodically so the the voltage on the S/H holding capacitor did not "droop". The period was determined by the "droop rate" of the sample and hold design. This allows multiple channel analog voltages using only one DAC!! The S/H could be a simple transistor, capacitor and OP-AMP combination for each channel for a really cheap solution. The AVR is more then capable of scanning the channels and outputting the channel specific data and doing all the other MIDI background chores!

Bill
Back to top
View user's profile Send private message Send e-mail
jksuperstar



Joined: Aug 20, 2004
Posts: 2478
Location: Denver
Audio files: 1
G2 patch files: 18

PostPosted: Thu Jul 27, 2006 10:31 am    Post subject: Reply with quote  Mark this post and the followings unread

You could probably find better info about SPI in the AVR's PDF. But, like State said, you could have 4 multi-channel SPI DACs in your system, and you'd need the 4 basic signals, plus about 1 extra pin per chip. 8 signals could then get you your 4 DACs, and each DAC would have as many channels as you see fit.

The nice thing about the AVR's SPI stuff, is that it's all automated! In your code you'd have to manually select a device, but then you write your byte, and forget about it. After that, you can either poll or use IRQs to drive when the next byte gets sent out. All that bit-banging can be mostly forgotten for the meat of the protocol.

SPI is the same port used to program the AVR (ISP). But it's not a problem. The programming can only be done while reset is forced low externally, so you have your usual pull up on there, and all is good, and you might even add pull ups to the Chip select lines, so the DACs don't go funky while your programming the AVR. But, it might not matter that your "hear" junk out of the DACs while programming in circuit anyway.
Back to top
View user's profile Send private message Visit poster's website
bigtex



Joined: Mar 30, 2006
Posts: 321
Location: Cupertino, California

PostPosted: Thu Jul 27, 2006 3:03 pm    Post subject: Reply with quote  Mark this post and the followings unread

State Machine wrote:
Tex, don't forget a MIDI "THRU" ... easy to add and really comes in handy if you do add more modules and you are not using all 16 channels for a particular patch .... Very Happy


True... but I have an 8x8 MIDI interface... so I don't even need to use Thru jacks. But it wouln't hurt to add one. Good point.


State Machine wrote:
The reason I like higher resolution DAC's is that the output can be a NOTE- CV one minute, as yo intend, and the next it's a HI-Res LFO running at 30 Hz ... you get my drift. It's all in the firmware. The AVR is a powerful RISC IC, you may as well add some cool features as time goes by.


Also a good point. There's no reason to limit options simply because I have a limited application in mind. My main concern was cost, but I could just start small with fewer output channels and leave the design modular so I can add more later. Hmmm.... many things to consider.


State Machine wrote:
Also, some design history. Years ago when DAC's were expensive and bulky, and no multi DAC's were available, a common technique was to have, say, 8 or 16 CV channels, a single DAC was used and each channel would have a sample and hold channel to sample the DAC's output. The control logic would sequentially scan each channel periodically so the the voltage on the S/H holding capacitor did not "droop". The period was determined by the "droop rate" of the sample and hold design. This allows multiple channel analog voltages using only one DAC!! The S/H could be a simple transistor, capacitor and OP-AMP combination for each channel for a really cheap solution. The AVR is more then capable of scanning the channels and outputting the channel specific data and doing all the other MIDI background chores!


I kind of assumed this was the case. I recently got outbid on a rather old MIDI to CV converter on eBay and that got me thinking: how did they do it in the old days. I knew there were many low-cost MIDI synths in the 80s, so they couldn't all have had a DAC per MIDI control. The only thing I could think of was a fast multiplexer (or solid state switch) feeding S/H circuits per each control output, so I guess I was right.

That certainly would be another good option to explore. I could clock the switching well above the audio rate, because the AVR is fast, fast, fast. With one high quality DAC (rather than a lot of so-so cheap DACs) I could feed a whole slew of S/H circuits for outputs. Again... many things to consider. I think I'll let this idea stew for a few days, do some more research, and see how I feel about it a little later. So many options...
Back to top
View user's profile Send private message
ian-s



Joined: Apr 01, 2004
Posts: 2565
Location: Auckland, New Zealand
Audio files: 42
G2 patch files: 601

PostPosted: Thu Jul 27, 2006 3:49 pm    Post subject: Reply with quote  Mark this post and the followings unread

State Machine wrote:
a single DAC was used and each channel would have a sample and hold channel to sample the DAC's output.


The Korg Polysix used this technique. And they got smart, using a single expo converter before the DAC output was demultiplexed, reducing cost and giving near perfect tracking for all six voices.
Back to top
View user's profile Send private message
bigtex



Joined: Mar 30, 2006
Posts: 321
Location: Cupertino, California

PostPosted: Thu Jul 27, 2006 4:59 pm    Post subject: Reply with quote  Mark this post and the followings unread

Oh, hey.. look at this. Four sample and hold amplifiers on one chip. Boy, that's easy.

http://www.analog.com/en/prod/0,,773_925_SMP04%2C00.html
Back to top
View user's profile Send private message
jksuperstar



Joined: Aug 20, 2004
Posts: 2478
Location: Denver
Audio files: 1
G2 patch files: 18

PostPosted: Thu Jul 27, 2006 10:13 pm    Post subject: Reply with quote  Mark this post and the followings unread

Too bad the only +/- 15v/12v ones only have a single channel...then you could've gotten away with using those S&H as your output buffers!

Oh well, probably too expensive for that anyway, you might wanna use opto coupling or better isolated ones that are designed for possibly destructive environments (ground loops and guitar amps can cause big currents!).

And hey, there's an 8 channel version as well Smile
Back to top
View user's profile Send private message Visit poster's website
bigtex



Joined: Mar 30, 2006
Posts: 321
Location: Cupertino, California

PostPosted: Thu Jul 27, 2006 10:54 pm    Post subject: Reply with quote  Mark this post and the followings unread

So for MIDI CCs, such as filter cutoff, I suppose I'd want to calculate an interpolated glide between values to reduce zippering. A 7-bit value padded out to 16-bits would have a lot of room for interpolation, indeed. It could be kind of tricky to get the algorithm just right, though. There would have to be a slight delay during which the value would glide, rather than jumping directly to the value declared by the MIDI data. To be "smart" it should base that delay on the velocity, or even of the acceleration of the value change. Not unlike a PID controller. Wow, it's like robots all over again. Excellent.

Are filter cutoff CCs in MIDI synths usually mapped to the same frequencies as the 12 note scale? That would make sense...

I did read somewhere today that pitch bends are done with 14-bits, so probably two 7-bit words. That will certainly be easier to do. No interpolation necessary.
Back to top
View user's profile Send private message
Blue Hell
Site Admin


Joined: Apr 03, 2004
Posts: 20283
Location: The Netherlands, Enschede
Audio files: 143
G2 patch files: 318

PostPosted: Fri Jul 28, 2006 8:37 am    Post subject: Reply with quote  Mark this post and the followings unread

bigtex wrote:
I did read somewhere today that pitch bends are done with 14-bits, so probably two 7-bit words. That will certainly be easier to do. No interpolation necessary.


That is correct, and there is also a more general MIDI mechanism for 14 bit data, the (Non) Registered Parameter Numbers ((N)RPN, the MIDI spec you referenced earlier has some words on this). For these you first set up an address and then you send data - all by using CC messages.

Furthermore for the breath controller (and some other standard controllers as well) the standard defines a coarse and a fine CC, those could be used for 14 bit data as well.

For your MIDI implementation be sure to get the running status stuff right (just in case you hadn't paid attention to it yet).

_________________
Jan
Back to top
View user's profile Send private message Visit poster's website
jksuperstar



Joined: Aug 20, 2004
Posts: 2478
Location: Denver
Audio files: 1
G2 patch files: 18

PostPosted: Fri Jul 28, 2006 2:42 pm    Post subject: Reply with quote  Mark this post and the followings unread

Filter cutoffs are usually a combination of Note# + some "DC Offset" (static knob value). That way, the cutoff follows the note played, and you don't get high notes disappearing because you set the cutoff too low. Something to think about doing in the AVR before it hits the DAC...
Back to top
View user's profile Send private message Visit poster's website
mi_dach



Joined: Dec 17, 2005
Posts: 133
Location: Sweden

PostPosted: Wed Aug 02, 2006 10:54 am    Post subject: Reply with quote  Mark this post and the followings unread

State Machine wrote:
Tex, don't forget a MIDI "THRU" ... easy to add and really comes in handy...


I am curious how you would add one of these... I'm working with PIC microcontrollers and would like to add a midi thru to my project, but as the PICs only have a single USART it didn't seem at all obvious how to add the Thru (I don't fancy writing my own bit banging routine at the moment). Or do I have it backwards, and the Thru is a copy of the out port?..
Back to top
View user's profile Send private message Visit poster's website
Blue Hell
Site Admin


Joined: Apr 03, 2004
Posts: 20283
Location: The Netherlands, Enschede
Audio files: 143
G2 patch files: 318

PostPosted: Wed Aug 02, 2006 10:59 am    Post subject: Reply with quote  Mark this post and the followings unread

mi_dach wrote:
Or do I have it backwards, and the Thru is a copy of the out port?..


A copy of the input I think, directly in hardware and not routed through the processor. The MIDI standard used to have schematic hints for this.

It would not be too hard though to implement a serial port output in software, driven from a timer interrupt. Well easier than an input anyway ...

_________________
Jan
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic Moderators: jksuperstar, Scott Stites, Uncle Krunkus
Page 1 of 2 [30 Posts]
View unread posts
View new posts in the last week
Goto page: 1, 2 Next
Mark the topic unread :: View previous topic :: View next topic
 Forum index » DIY Hardware and Software
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum
emSynth

Please support our site. If you click through and buy from
our affiliate partners, we earn a small commission.


Forum with support of Syndicator RSS
Powered by phpBB © 2001, 2005 phpBB Group
Copyright © 2003 through 2009 by electro-music.com - Conditions Of Use