electro-music.com   Dedicated to experimental electro-acoustic
and electronic music
 
    Front Page  |  Radio
 |  Media  |  Forum  |  Wiki  |  Links
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 » Microcontrollers and Programmable Logic
pitch class quantizer
Post new topic   Reply to topic Moderators: State Machine
Page 1 of 1 [14 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
Author Message
bearblock



Joined: Sep 27, 2006
Posts: 90
Location: uk
Audio files: 1

PostPosted: Sat May 31, 2008 11:46 am    Post subject: pitch class quantizer Reply with quote  Mark this post and the followings unread

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!


Image005.jpg
 Description:
 Filesize:  51.46 KB
 Viewed:  18065 Time(s)

Image005.jpg



Mixdown.mp3
 Description:

Download (listen)
 Filename:  Mixdown.mp3
 Filesize:  1.76 MB
 Downloaded:  1193 Time(s)

Back to top
View user's profile Send private message Visit poster's website
neandrewthal



Joined: May 11, 2007
Posts: 672
Location: Canada

PostPosted: Mon Jun 02, 2008 12:50 am    Post subject: Reply with quote  Mark this post and the followings unread

Put me down for two please Shocked
_________________
" I went through quite a few trannies til I found one I liked" - Wild Zebra
Back to top
View user's profile Send private message
mono-poly



Joined: Jul 07, 2004
Posts: 937
Location: Rotterdam, Netherlands
Audio files: 2

PostPosted: Mon Jun 02, 2008 12:55 am    Post subject: Reply with quote  Mark this post and the followings unread

Can you get some more info about what the module does?
Back to top
View user's profile Send private message
bearblock



Joined: Sep 27, 2006
Posts: 90
Location: uk
Audio files: 1

PostPosted: Tue Jun 03, 2008 4:18 am    Post subject: Reply with quote  Mark this post and the followings unread

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 Very Happy
Back to top
View user's profile Send private message Visit poster's website
bearblock



Joined: Sep 27, 2006
Posts: 90
Location: uk
Audio files: 1

PostPosted: Wed Jun 04, 2008 11:47 am    Post subject: Reply with quote  Mark this post and the followings unread

as promised, here's the binaries and source, and a quick diagram of how to link things up.


quant.gif
 Description:
 Filesize:  36.67 KB
 Viewed:  745 Time(s)
This image has been reduced to fit the page. Click on it to enlarge.

quant.gif



quantizer.zip
 Description:

Download (listen)
 Filename:  quantizer.zip
 Filesize:  2.72 KB
 Downloaded:  778 Time(s)

Back to top
View user's profile Send private message Visit poster's website
neandrewthal



Joined: May 11, 2007
Posts: 672
Location: Canada

PostPosted: Mon Jun 30, 2008 2:32 am    Post subject: Reply with quote  Mark this post and the followings unread

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
Back to top
View user's profile Send private message
bearblock



Joined: Sep 27, 2006
Posts: 90
Location: uk
Audio files: 1

PostPosted: Fri Jul 04, 2008 3:40 am    Post subject: Reply with quote  Mark this post and the followings unread

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.

TL;DR version - yes but I need some help Confused
Back to top
View user's profile Send private message Visit poster's website
CJ Miller



Joined: Jan 07, 2007
Posts: 368
Location: 127.0.0.1

PostPosted: Sun Jul 20, 2008 12:05 am    Post subject: Reply with quote  Mark this post and the followings unread

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 for the info, and the cool demo!
Back to top
View user's profile Send private message
bearblock



Joined: Sep 27, 2006
Posts: 90
Location: uk
Audio files: 1

PostPosted: Sun Jul 20, 2008 10:12 am    Post subject: Reply with quote  Mark this post and the followings unread

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!
Back to top
View user's profile Send private message Visit poster's website
CJ Miller



Joined: Jan 07, 2007
Posts: 368
Location: 127.0.0.1

PostPosted: Wed Jul 30, 2008 4:00 am    Post subject: Reply with quote  Mark this post and the followings unread

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?
Back to top
View user's profile Send private message
bearblock



Joined: Sep 27, 2006
Posts: 90
Location: uk
Audio files: 1

PostPosted: Fri Aug 01, 2008 8:50 am    Post subject:   Reply with quote  Mark this post and the followings unread

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 Very Happy 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:  637 Time(s)
This image has been reduced to fit the page. Click on it to enlarge.

q0001.jpg



q0002.jpg
 Description:
 Filesize:  105.03 KB
 Viewed:  618 Time(s)
This image has been reduced to fit the page. Click on it to enlarge.

q0002.jpg


Back to top
View user's profile Send private message Visit poster's website
sneakthief



Joined: Jul 24, 2006
Posts: 569
Location: Berlin

PostPosted: Tue Sep 23, 2008 6:31 am    Post subject: Reply with quote  Mark this post and the followings unread

I'm going to try this quantizer!

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
Back to top
View user's profile Send private message Visit poster's website
bearblock



Joined: Sep 27, 2006
Posts: 90
Location: uk
Audio files: 1

PostPosted: Tue Sep 23, 2008 9:21 am    Post subject: Reply with quote  Mark this post and the followings unread

hey sneak Very Happy

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 Confused

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...
Back to top
View user's profile Send private message Visit poster's website
sneakthief



Joined: Jul 24, 2006
Posts: 569
Location: Berlin

PostPosted: Tue Sep 23, 2008 4:24 pm    Post subject: Reply with quote  Mark this post and the followings unread

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?

thanks!

_________________
Sneak-Thief - raw electrofunk
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: State Machine
Page 1 of 1 [14 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
 Forum index » DIY Hardware and Software » Microcontrollers and Programmable Logic
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


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