Hi,
I'm working on a small synth using a T4.0 w/Audio library. I want the "oscillators" to track the pitch / frequency of a simple (sine / square) external audio waveform. I already have some good success with a prototype, but my problem is that the audio library and my external input reading causes audible glitches.
I've tried:
1. polling the audio input pin, looking for the rising edges and measuring micros() differences. This fails because the input signal will never hit the start / stop of the micros() time consistently.
2. Using an interrupt
This is better in some ways, but it seems to frequently miss my external interrupts.
I found the following, but I'm not sure where to find a mapping of pins to ports in order to try it.
https://www.pjrc.com/fast-pulse-counting-with-interrupts-and-why-nested-priority-really-helps/
I've thought about using one of the Teensy's counters like in the Frequency counter examples, but I can't seem to wrap my head around how this will work with so much that is going on in the audio library.
Any suggestions or pointers are appreciated. Thanks
Doug
I'm working on a small synth using a T4.0 w/Audio library. I want the "oscillators" to track the pitch / frequency of a simple (sine / square) external audio waveform. I already have some good success with a prototype, but my problem is that the audio library and my external input reading causes audible glitches.
I've tried:
1. polling the audio input pin, looking for the rising edges and measuring micros() differences. This fails because the input signal will never hit the start / stop of the micros() time consistently.
2. Using an interrupt
Code:
// setup signal input pin ISR
pinMode(signalInPin, INPUT_PULLUP); // MUST use this with IOC interrupts!
// https://forum.pjrc.com/threads/66146-T4-0-ISR-Rising-Edge-Voltage-Trigger-Level?p=269780&viewfull=1#post269780
attachInterrupt(digitalPinToInterrupt(signalInPin), Input_ISR, RISING);
I found the following, but I'm not sure where to find a mapping of pins to ports in order to try it.
https://www.pjrc.com/fast-pulse-counting-with-interrupts-and-why-nested-priority-really-helps/
I've thought about using one of the Teensy's counters like in the Frequency counter examples, but I can't seem to wrap my head around how this will work with so much that is going on in the audio library.
Any suggestions or pointers are appreciated. Thanks
Doug