PT 8211 and teensy 3.2

Status
Not open for further replies.
I have all assembled and can see audio on a pc with windows 8 And get pops on my audio mixer when unplugging usb as i do with my other whirlwind pcusb can also hear changes in audio when selecting playback but no audio can be heard. my goal is a simple digital to analog convertor using usb as input Here is my sketch.
#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include <SerialFlash.h>

// GUItool: begin automatically generated code
AudioInputI2S i2s1; //xy=129,144
AudioInputUSB usb1; //xy=152,62
AudioOutputAnalog dac1; //xy=384,155
AudioOutputPT8211 pt8211_1; //xy=432.49999999999994,63.33333333333332
AudioConnection patchCord1(usb1, 0, pt8211_1, 0);
AudioConnection patchCord2(usb1, 1, pt8211_1, 1);
// GUItool: end automatically generated code
void setup() {
// put your setup code here, to run once:

}

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

}
 
You're missing AudioMemory. The library can't do anything without memory!

Open any of the library's examples, from File > Examples > Audio.
 
So I have another question regarding this DAC/ pt8211with teensy3.2. I can not control the volume with the main computer volume I can control it within specific programs like explorer or Qlab. 2nd question I am only able to upload code with A PC mac with Elcapitan not working ?
Code:
#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include <SerialFlash.h>

// GUItool: begin automatically generated codeAudioInputUSB            usb1;           //xy=104,51
AudioOutputPT8211        pt8211_1;       //xy=432.49999999999994,63.33333333333332
AudioConnection          patchCord1(usb1, 0, pt8211_1, 0);
AudioConnection          patchCord2(usb1, 1, pt8211_1, 1);
// GUItool: end automatically generated code
void setup() {
  // put your setup code here, to run once:

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

}
 
OSX 10.11 El Capitan was released in 2015. Since then, all users could upgrade for free to 10.12 Sierra in Sept 2016 and, again for free, to 10.13 High Sierra in Sept 2017. Thus, I‘m not sure if it makes sense to bother with that outdated stuff. Since the updates for macOS have been free for a long time, there is no reason to not upgrade regularly. It‘s not like in the Windows ecosystem where missing third party drivers or incompatible hardware force users to keep older OS versions.
 
So I have another question regarding this DAC/ pt8211with teensy3.2. I can not control the volume with the main computer volume I can control it within specific programs like explorer or Qlab Ignore second question as regards to el capitan I still use for other reasons I actually find the older OSX better pre mavericks you can actually do more with certain things.
 
I can not control the volume with the main computer volume I can control it within specific programs like explorer or Qlab

I can only answer about how Teensy works, what happens on the Teensy side. Your question involves many other parts, like a Mac and MacOS, and programs running on your Mac. I can't speak to how those work.

I can tell you Teensy will merely take the 16 bit data your Mac sends and forward it to the PT8211 chip. Unlike the more expensive SGTL5000 on the audio shield, where the chip has a variable gain amplifier which Teensy can control, the cheap PT8211 has no such variable gain volume circuitry. It simply plays the data at one full scale level.

Teensy could be programmed to multiply the numbers by a volume setting before sending them to the PT8211. The mixer object would be the simplest way. Your program (message #4) doesn't have anything like that. The PT8211 is simply getting whatever your Mac is sending.

When the volume control is working, that must mean some program or driver on your Mac is multiplying all the numbers to scale them, before they're sent to Teensy.

When the volume control is not working, I can only guess why. But I will guess for you... My guess is your Mac may be sending the volume setting to Teensy and expecting Teensy to do the work of adjusting the audio level. The AudioInputUSB object has an undocumented volume() function. You can call it to read the setting requested by your Mac. It returns a float, which should range from 0 to 1.0. Maybe you could add code to read this and adjust a mixer gain?
 
so I tried this code not that good with code stuff and am trying to learn so that is my only reason for doing this I don't want to be beat by any type of device.
anyways here is the volume attempt to control pt 8221 with computer system volume as opposed to a applications volume.
Code:
#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include <SerialFlash.h>

// GUItool: begin automatically generated code
AudioInputUSB            usb1;           //xy=123,67
AudioInputAnalog         adc1;           //xy=216,226
AudioOutputPT8211        pt8211_1;       //xy=554,75
AudioConnection          patchCord1(usb1, 0, pt8211_1, 0);
AudioConnection          patchCord2(usb1, 1, pt8211_1, 1);
// GUItool: end automatically generated code
void setup() { // read the PC's volume setting
  float vol = usb1.volume();

  // scale to a nice range (not too loud)
  // and adjust the teensy output volume
  if (vol > 0) {
    // scale 0 = 1.0 range to:
    //  0.3 = almost silent
    //  0.8 = really loud
    vol = 0.3 + vol * 0.5;
  }
  // put your setup code here, to run once: // give the audio library some memory.  We'll be able
  // to see how much it actually uses, which can be used
  // to reduce this to the minimum necessary.
  AudioMemory(20);

}

void loop() { // read the PC's volume setting
  float vol = usb1.volume();

  // scale to a nice range (not too loud)
  // and adjust the teensy output volume
  if (vol > 0) {
    // scale 0 = 1.0 range to:
    //  0.3 = almost silent
    //  0.8 = really loud
    vol = 0.3 + vol * 0.5;
  }
  // put your main code here, to run repeatedly:

}
 
You're on the right path, but you also need to add a mixer into the signal path. Then use the variable "vol" to control its gain.

For stereo, you'd use 2 of those mixers. 3 of the 4 inputs on each will be unused. That's fine, since you're just using it as a way to control the level of the signal.

For info about how the mixers and their gain settings work, check out part 2-2 of the tutorial (pages 12-13 in the PDF, or at 9:06 in video).
 
Status
Not open for further replies.
Back
Top