Friday, June 3, 2011

HE v2 "sampling" mode brainstorm

Is a glitchy "sampling" mode on the new HE better than no "sampling" mode at all? The intent is to have a mode that records sound input and turns it into an envilope. Here's how I'm doing it so far:

20 sub-samples are taken from the input at 5ms intervals, then averaged. the average becomes the main "sample" that lasts 100ms. this occurs 10 times a second.

so it samples at a total of 200hz. the problem is when I hit a note like low E (82-ish hz), or any note really, that the played note will get pretty close in-phase with my sampling frequency from time to time as it "drifts". because of that, for an entire 100-200 milliseconds, it'll only be sampling the "dips" in-between the sound waves and will average close to 0, even though to our ears the note rings loud and clear. as clear as it was when it was sampling at the peaks of the same waves 300ms earlier! the result is a stuttery glitchy envelope instead of smooth envelope following.

adding circuitry is a last resort (there's barely any room left on the PCB). so far I've tried:

1. adding offsets of 2.5ms every 2 samples to try and average an equal number of wave dips and peaks.

2. only keeping the very highest sample out of 20

3. ignoring sudden drops of envelope if the next one goes right back up again (loss of detail)

Increasing the sampling frequency is difficult at the moment since the whole foundation of the bare-bones design is built around 20 sub-samples per "real" sample, because of the interpolation I'm doing. I think I'll try adding a timer interrupt that samples much more/faster and independantly of the rest of the program.

7 comments:

Scott said...

not sure exactly what your doing so sorry if this doesn't make sense but you could rectify the signal in code thus ~ doubling the frequency? also taking max over the observation time seems logical to me. another option is to do a rolling average over the longer periods instead of just the 20 sub samples. or a rolling average of the max of each interval.

no DMA right ? is there an ADC buffer at least? you should be able to set it up to fill the buffer and only interrupt when its full. so your not creating too much overhead by sampling more frequently.

Marcus fischer said...

I think whatever sampling solution you come up with is better than having none at all. People will work with or around the quirks. It's part of what makes something unique. :)

Can't wait to get my hands on a hollow earth.

Anonymous said...

Just found your blog and some fantastic work. I'm interested in your stuff can you drop me a line when you get time and we can talk more about possible purchases? Cheers
wailsound@gmail.com

digital potentiometer said...

If you are on a board without retriggerable AI and you do not have two extra counters available (necessary to generate a finite pulse train on most of these boards), you can still optimize your performance a bit by explicitly committing the task before it is started like in this example.

Ben Pollard said...

Hey, I've been looking at some extreme pedals the last year or so, and one that I always come back to is the hollow earth. Can't get enough of it. If your going to take orders on the V2 please let me know as I'm really keen. If you do decide to go with a front end so that waves can be designed on a PC and don't want to spend the time doing it I'd love to get involved (I'm a C#/WPF programmer for a robotics firm in England by day).

Cheers, keep up the good work, Ben
killboy___powerhead at hotmail dot com

Billy Moffat said...

Im very interested in your work, especially with the loopers, bitcrushers and the other wacky stuff. Do you have any of them for sale or make custom jobs?
AL
hungry.brain.emporium@gmail.com

Money Saving Apps said...

I am also your follower at Facebook, i would like to thank your for great posts throughout this year!!