Hello,
I work in a neuroscience lab studying the auditory system, and we use TTL trigger pulses to sync our audio stimuli with the EEG system. The way I do this is through simultaneous analog and S/PDIF audio from the same soundcard, with analog going to headphones and S/PDIF int values being split by a custom box into separate TTL bit lines. My current device requires a custom PCB to be made and populated, but I'm hoping the Teensy 4.0's S/PDIF input could replace it.
Basically, every time a new S/PDIF sample arrives, the device would write its bits (or a subset of them) out to the GPIO. It would need to do this in real time, but I am hopeful it could work since that is all the system needs to do. It would need to work with 44.1 or 48 kHz and 16 or 24 bit audio.
Is this possible? Is there any example code that reads the latest sample, perhaps triggered by an interrupt? Or perhaps the S/PDIF samples go to a register I can poll? I have read up on the audio library, but I don't believe there is a way to use that in real time since it's designed to do more than just pass samples through.
Any guidance appreciated!
I work in a neuroscience lab studying the auditory system, and we use TTL trigger pulses to sync our audio stimuli with the EEG system. The way I do this is through simultaneous analog and S/PDIF audio from the same soundcard, with analog going to headphones and S/PDIF int values being split by a custom box into separate TTL bit lines. My current device requires a custom PCB to be made and populated, but I'm hoping the Teensy 4.0's S/PDIF input could replace it.
Basically, every time a new S/PDIF sample arrives, the device would write its bits (or a subset of them) out to the GPIO. It would need to do this in real time, but I am hopeful it could work since that is all the system needs to do. It would need to work with 44.1 or 48 kHz and 16 or 24 bit audio.
Is this possible? Is there any example code that reads the latest sample, perhaps triggered by an interrupt? Or perhaps the S/PDIF samples go to a register I can poll? I have read up on the audio library, but I don't believe there is a way to use that in real time since it's designed to do more than just pass samples through.
Any guidance appreciated!