Audio Guidance for a teensy project

Status
Not open for further replies.

ceremona

Well-known member
Hi Folks,

I am wanting to make an audio project that initially allows for a single audio IN (ADC) and and single audio out (DAC). While it seems that this is possible just via the teensy 3.1 most of the basic audio code examples I see seem to presume that one is using the audio shield (via the AudioControlSGTL5000 codec; statement?).

All I want to do (for now) is have the input signal function as a simple real(ish)-time frequency/amplitude modulator of an existing signal/sound which could come from memory or just via a simple sine tone generator. I've lurked all over the audio forum posts but I'm not totally clear at what point the CPU/ADC/DAC complexity of what I am trying to do is too limited for the Teensy alone and requires me to use the shield also?

Eventually, I might want to add another line-in ADC to the modulation and this will surely require to shield since I will be using 2 ADC lines, but I am just trying to understand what is possible with the equipment I have for now? Also, I am not clear whether I could just use the Teensy Pedvide ADC library to do what I am thinking of for now, and to what extent the functionality of this library overlaps with the general teensy audio library?

Any guidance would be appreciated.

Thanks so much.
 
I am wanting to make an audio project that initially allows for a single audio IN (ADC) and and single audio out (DAC). While it seems that this is possible just via the teensy 3.1 most of the basic audio code examples I see seem to presume that one is using the audio shield (via the AudioControlSGTL5000 codec; statement?).

This will allow adc to output directly to the dac:
Code:
#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
//---------------------------------------------------------------------------------------
AudioInputAnalog         adc; 
AudioOutputAnalog        dac;
//---------------------------------------------------------------------------------------
AudioConnection patchCord0(adc,  dac);
//---------------------------------------------------------------------------------------
void setup() {
  // put your setup code here, to run once:
  AudioMemory(4);
}


void loop() {
  // put your main code here, to run repeatedly:
}

This aleast could get you going i think.
 
Also, I see that there's room to solder on memory to the teensy board. Judging by the form factor it looks like it can take: http://www.jameco.com/1/1/44476-m45pe10-vmn6p-m45pe10-128k-x-8-flash-2-7v-prom-pdso8-memory.html (though I may want a larger amount). But I'm not totally clear what kinds of memory this surface mount can accept or what the size limit is? From lurking on the forum, I take it that this is for memory that uses an SPI interface?

Thanks.

You can use this one: W25Q128FV (128 MBit)
 
Thanks folks. I'm still really unclear though about when I should (or even can) use the Pedvides ADC library with Paul's Audio library. I mean say if I want to use the Ringbuffer feature of Pedvides ADC library.

When I load it into the Arduino path, I then I wind up clobbering over and ADC library from the Teensy avr:
<code>
Used: /Users/cere/Documents/Arduino/libraries/ADC
Not used: /Applications/Arduino.app/Contents/Java/hardware/teensy/avr/libraries/ADC
</code>

I'm also just wanting to see what I can "get away with" using the Teensy LC and simple ADC/DAC functions without the audio library (since the audio library is said not to support the Teensy LC), but am looking for a simple examples and don't see any. If it's the case that using the LC for audio is just not practical (in terms of speed) then I guess, I should just move on and use the audio library straight off.

Thanks.
 
Eventually I'm planning to port a small but useful subset of the audio library to Teensy-LC. It will run at 22 kHz sample rate and 64 sample block size.

Teensy-LC is plenty fast enough to do simple things, like playback and probably even 256 point FFT. But the more advanced filters and synthesis features (probably) aren't ever going to happen on LC, because they depend heavily on the DSP extensions. Things like 1024 point FFT and audio delays won't be possible either, because they take too much memory.
 
Ok so in this simple setup:
<code>
#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>

// GUItool: begin automatically generated code
AudioInputAnalog adc1(A0); //xy=184.88888549804688,110.88888549804688
AudioSynthWaveformSineModulated sine_fm1; //xy=454.8888854980469,248.88888549804688
AudioOutputAnalog dac1; //xy=900.8888854980469,470.8888854980469
AudioConnection patchCord1(adc1, sine_fm1);
AudioConnection patchCord2(sine_fm1, dac1);
// GUItool: end automatically generated code


void setup() {
// Audio connections require memory to work. For more
// detailed information, see the MemoryAndCpuUsage example
AudioMemory(12);
sine_fm1.frequency(400);

Serial.begin(9600);
while (!Serial) delay(50);

}

void loop() {

// When AudioInputAnalog is running, analogRead() must NOT be used.
}
</code>

How do I go about reading the values from AudioInputAnalog? Since I am not allowed to use the analogRead function while the AudioInputRead is working. I would like to see what the input signal value is and print it to the serial terminal.

thanks.
 
How do I go about reading the values from AudioInputAnalog?

You don't.

The patchCord1 object causes the adc1 output to feed automatically into the input of the modulated sine wave generator.

I would like to see what the input signal value is and print it to the serial terminal.

You could also connect the adc1 object to a queue object. Those queue objects let you actually access the data from the Arduino sketch.
 
Thanks for the pointer, Paul. I was just starting play around with the peak function as a workaround. Wasn't paying attention to the queue object, so that's helpful.
 
Status
Not open for further replies.
Back
Top