Posted: Sat May 31, 2008 11:46 am Post subject:
pitch class quantizer
hi, welcome to my new thing. it's based on at ATMega48 like the playstation interface, but it is a bit more complex as it uses the ADC, and also some digital support chips to address all the switches. attached is a photo and a short philip glass-ripoff i made by way of a demo. enjoy!
sure thing mono, it's basically a control voltage quantizer working to the 1V/8ve standard as has been done several times before. I just had the idea for the keyboard style interface to select the scale (i.e. in the photo D, D# and G are the only allowable notes) and thought it was too cool for no-one to have tried it.
There are also two triggering modes; 'active' changes the output whenever a threshold is crossed and generates a trigger pulse, wheras 'passive' waits for an incoming trigger before it can change the output, like a S+H. The two pots let you transpose the CV before or after the quantization process.
I'd be more than happy to make the code available so people can build their own variations of this. The analogue side of things isn't that great (there are too many trimmers to set, and in active mode there are occasional glitches due to ADC noise) and I'm sure some of the people here could improve on it. I have a diagram of the pinouts of the programmed uC and how to hook it up to the 74LS151 data selectors (neccessary to read 14 switches with 5 i/o lines) that will also be useful.
One other thing - it would be pretty easy to write a version of the firmware that generates a staircase wave corresponding to the selected scale, so you could design an ARP-style (i.e. comparator & S+H) quantizer around it. This would avoid ADC glitches and allow for multiple channels, but implementing the two triggering modes might be harder? Anyway i'm glad you guys are interested in this project, I can upload some docs and stuff when I get back from work
Any chance of a pcb layout for this? A lot of us are dying for diy quantisers and your keyboard style switching is way better than any banks of preset scales. _________________ " I went through quite a few trannies til I found one I liked" - Wild Zebra
hey, I've never designed a pcb before, only done stuff on stripboard. also function creep has kicked in and if i was going to put moar work into this i could make it a lot more powerful/flexible. I'm pretty sure that the staircase wave/comparator/s+h design is the way to go here. As a diy project, it would scale really nicely - you could have as as many channels as you need driven by a single 'keyboard'. With a good analog section (ahem) you would get better performance and less glitching as well.
Another thing - it would be possible to have momentary instead of toggle switches for the 'keys'. This opens up the possibility of having multiple scale modes in memory at the same time, and scanning them with a pot or cv. Pressing a switch would send an interrupt to the uC (via something like a 74LS148) telling it to toggle the state of that note in the active pattern. There would also have to be a SIPO shift register to drive the LEDs which would be updated whenever something changes.
Joined: Jan 07, 2007 Posts: 368 Location: 127.0.0.1
Posted: Sun Jul 20, 2008 12:05 am Post subject:
Nice work, BB! I too have been surprised to not see this sort of thing out there before. I've got a few AVRs here, but I haven't had the time to get into them yet.
I don't know about the ATMEGA48. Do you suppose that ATMEGA8 might work as is? What speed crystal does your 48 use?
thanks CJ! i'm not sure if it would work as is with a atmega8 - but you could certainly get it working with only minor tweaks. the xtal i'm using is 20Mhz so yeah, you would have to use a 16Mhz one instead.
having checked out the datasheet, I would recommend downloading the atmega8 header file, changing quantiser.asm to .INCLUDE it instead of the atmega48 version, and trying to compile. it will complain about a couple lines in the ADC initialization section, but i think you can just delete them and it will work fine... good luck!
Joined: Jan 07, 2007 Posts: 368 Location: 127.0.0.1
Posted: Wed Jul 30, 2008 4:00 am Post subject:
Score! I got a couple of ATMEGA48 to try this with. But no 74ls151 on hand, maybe I'll try with 4051. What kind of supplies do you use? +5 for the MCU, multiplexers, and DAC? Five octave range then? Or do different chips run off of different voltages?
hey, i am indeed using +5v for the mcu and 'plexers. the dac is just a r/2r discrete design so it is powered by the mcu. re. the 'plexers, i would suggest using a digital type like hc151, ac151 etc - it doesn't need to be analogue but it does need to be quite fast. the incoming and outgoing control voltages are scaled down and up respectively by some opamps running on +- 12v, so that the mcu can work at 12 bits per octave. this makes the code simpler/faster and gives a range of over 20 octaves the downside is that the gain of the opamps has to be set precisely, so i used trim pots and tuned it by ear.
edit: schemos! just to reiterate - they're probably not optimal but they seem to work ok.
q0001.jpg
Description:
Filesize:
88.22 KB
Viewed:
764 Time(s)
This image has been reduced to fit the page. Click on it to enlarge.
q0002.jpg
Description:
Filesize:
105.03 KB
Viewed:
775 Time(s)
This image has been reduced to fit the page. Click on it to enlarge.
Are you still happy with your code, or have you made any changes yet?
But more importantly, do you have any tips for the calibration procedure? Do I start with the ADC first? _________________ Sneak-Thief - raw electrofunk
the code is good to go. like you, i'm less sure about the analog side of things however...
my prototype probably could be calibrated better, but the procedure is this:
1) patch the output into a VCO 1v/8ve input (and listen to the VCO, natch)
2) turn off all the notes except C, and select active triggering.
3) turn the input transpose pot (the 10k in the ADC page) and see if you are getting decent octaves
4) if not, adjust the DAC scale trim (the 1k variable resistor) and go back to step 3
this is the most important step; you should now be able to turn on other notes, turn the input transpose pot around and get fun arpeggios. of course it's never that simple is it
when i got to this stage it turned out that i got a weird key-change at one point along the pot's travel. sounded awesome actually but not what was expected. what was happening - when you get to the most-significant bits of the DAC (i.e. pins 12 & 13 of the ATMega48), even 0.1% precision isn't good enough for those 2K resistors, so i had to stick another 2 trimmers in there.
if it's now sounding properly intonated, you can...
5) turn C on and all other notes off, and the output transpose pot to 12 o'clock. adjust the 100k DAC trimmer til you are getting exactly 0V, 1V, 2V etc. on the output.
now to calibrate the ADC. you will need a ready source of DC voltages of exactly 0V and 1V patched into the quantizer CV input.
6) turn all notes on and the input transpose to 12 o'clock. adjust the ADC scale trimmer (the 50k) until the output voltage is exactly 1V higher with 1V going in, than it is with 0V going in.
7) adjust the final trimmer (10k on the ADC page) until the output CV is basically the same as the input one.
and that's it! thanks for checking this out - i hope you find the ADC noise level to be ok. mine has a bit of jitter so I tend to use it in 'passive' trigger mode, which waits for a pulse on pin14 before it allows the output to change. i think this might be one of those situations where stripboard can't compete with a nice PCB with a ground plane...
hey cool, thanks for replying so quickly. i'm ordering the atmega48 chips so i'll post my results when i get them.
bearblock wrote:
3) turn the input transpose pot (the 10k in the ADC page) and see if you are getting decent octaves
- should it be a one octave range when rotating the pot fully CCW all the way to CW?
bearblock wrote:
when you get to the most-significant bits of the DAC (i.e. pins 12 & 13 of the ATMega48), even 0.1% precision isn't good enough for those 2K resistors, so i had to stick another 2 trimmers in there.
- do you mean the 1k and 100k trimmers on your schematic?
bearblock wrote:
7) adjust the final trimmer (10k on the ADC page) until the output CV is basically the same as the input one.
- I thought the 10k on the pre-ADC was the input transpose pot, and not a trimmer. do you mean the 100k trim?
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