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
Developing voltage quantizer
Post new topic   Reply to topic Moderators: State Machine
Page 1 of 1 [7 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
Author Message
Feifer



Joined: May 16, 2012
Posts: 54
Location: San Diego

PostPosted: Sun Jun 08, 2014 5:29 pm    Post subject: Developing voltage quantizer Reply with quote  Mark this post and the followings unread

So as my first project in micro controllers I'm making a quantizer using a pic16f877a. I know there are simpler ones that can be made out there but I wanted a lcd readout, 2 channels, and enough IOs to talk to the DAC, an encoder and 2 buttons, so I went with this larger chip.
The ADC samples in 10 bits which will eventually cover 10 octaves, 5 up and 5 down. 8 decimal units covers 1 semitone, so 96 is 1 octave. The sample is divided by 96 to get the octave and also % by 96 to get the note. It compares that note to a list notes for a particular scale and then outputs the closest note with the octaves added back in.
Anyways, I got a working prototype right now or rather a proof of concept. I was playing around with it by giving it random pitches from noise into a sample and hold. Everything works pretty good except it seems like it lands on these in between notes quite often, where it can't decide which way to round. Is this sort of an inherent problem of quantizers? Is there some way to deal with this in the code? I'm not sure how many people out there have made their own quantizers but I though I'd throw it out there.
thanks.

edit: I'm guessing the first suggestion would be to get an ADC with more than 10 bits?
Back to top
View user's profile Send private message
sneakthief



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

PostPosted: Mon Jun 09, 2014 2:03 am    Post subject: Reply with quote  Mark this post and the followings unread

How you process the incoming signals on the front end makes a big difference when it comes to reducing jitter.

Check out the ACXSynth PIC16f88 quantizer's schematic and code:

http://acxsynth.com/quantizer/quantizerfr.htm

_________________
Sneak-Thief - raw electrofunk
Back to top
View user's profile Send private message Visit poster's website
Feifer



Joined: May 16, 2012
Posts: 54
Location: San Diego

PostPosted: Thu Jun 12, 2014 11:04 am    Post subject: Reply with quote  Mark this post and the followings unread

Thanks sneakthief,
Well it looks like they're only using a 10 bit ADC also. And the only thing they're doing to process the signal is to level shift it so the pic can read it. That's what I was planning on doing on my final product, but shouldn't have anything to do with jitter. I would think that the main thing is to have a very well regulated reference voltage, but for the input signal, I'm not sure what to do about that.
Back to top
View user's profile Send private message
sneakthief



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

PostPosted: Mon Jun 16, 2014 1:00 am    Post subject: Reply with quote  Mark this post and the followings unread

Yes, quantizer jitter is a problem with many CV quantizers when voltages are near the note-switchover point. Is your source voltage completely clean?

Using a trigger signal in conjunction with the CV input is usually the best solution if you want to eliminate jitter.

Properly grounding the input end is important. Also, if you have your circuit assembled on a prototyping board, that may be causing problems due to stray capacitance inherent with non-soldered connections..

Here's another two PIC-based quantizer projects you can reference: http://www.bartonmusicalcircuits.com/cvquant/
http://www.clsound.com/quantizer.html

_________________
Sneak-Thief - raw electrofunk
Back to top
View user's profile Send private message Visit poster's website
helge-h



Joined: Jun 17, 2014
Posts: 24
Location: Norway
Audio files: 2

PostPosted: Tue Jun 17, 2014 4:37 pm    Post subject: Reply with quote  Mark this post and the followings unread

I have made an oscillator with an arduino uno, and a quantizer, and I have the exact same problem. I believe one solution could be to use hysteresis on the CV (a software schmitt trigger). I have not yet tried it, but the algorithm could be something like this: when the CV rises, just pass it through, but if it falls you should wait until it drops more than a set limit (determined through experimentation). And of course the other way around for initially falling CV.

Helge
Back to top
View user's profile Send private message
Feifer



Joined: May 16, 2012
Posts: 54
Location: San Diego

PostPosted: Fri Jun 20, 2014 9:17 pm    Post subject: Reply with quote  Mark this post and the followings unread

helge-h, you read my mind.
I was just implementing a hysteresis into my code! Basically, I'm introducing 2 other variables for the previous output and the previous midpoint (crossover point between 2 notes in the scale list)
Code:
if (current ADC value >= previous midpoint - 1 && current ADC value <= previous midpoint + 1){
output = previous output;
}
previous output = output;
previous midpoint = midpoint;

Just got done flashing it. Still gotta take it to the garage and see how it performs.

Last edited by Feifer on Sat Jun 21, 2014 10:09 am; edited 1 time in total
Back to top
View user's profile Send private message
Feifer



Joined: May 16, 2012
Posts: 54
Location: San Diego

PostPosted: Sat Jun 21, 2014 12:21 am    Post subject: Reply with quote  Mark this post and the followings unread

Well that worked a treat! A little hysteresis is just what the doctor ordered. I can't even force it to jitter!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic Moderators: State Machine
Page 1 of 1 [7 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