Audio Library

Status
Not open for further replies.
Paul, I'm working on documenting the stgl5000 controls currently, replacing all the blah blah with actual documentation.

Awesome!! Thanks.

I must confess, I haven't even used the audio processor stuff, so I don't really know anything more than what's in the STGL5000 datasheet.
 
pull request sent. It needs more testing and a couple of good examples, but I'm also aware you are prepping a 1.0 release and don't want to hold that up.

In addition to the gui docs I also added four defines to control_sgtl5000.h because enabling tone controls with eqSelect(2) is mysterious while eqSelect(TONE_CONTROLS) is easier to understand.

Code:
//For frequency adjustment
  #define FLAT_FREQUENCY 0
  #define PARAMETRIC_EQUALIZER 1
  #define TONE_CONTROLS 2
  #define GRAPHIC_EQUALIZER 3
 
Last edited:
Thanks again Nantonos!

I added a bit more documentation stuff, basically just listing the examples on each object. Nothing in the actual code has changed in the last couple days.

I've just tagged this as version 1.0. I'm preparing Teensyduino 1.20-rc5 right now, with Audio 1.0 and the SD card speedup.

My intention is to release 1.20 by Friday.

I'm also considering closing this incredibly long thread, which is pretty much all about the beta testing period while APIs changed so much. We can start new threads, based on 1.0.
 
Are there any plans to allow for changing the "adc1" pin from "A2" to another ADC pin? It's easy to modify input_adc.cpp to use a different pin. I'm asking because A2 conflicts with the I2C SCL pin on the SmartMatrix Shield, so some users are going to need to use a different pin.

If you're open to the idea but don't have a plan to do it, I can try to come up with a good way to do it and submit a pull request.
 
Hi - forgive me if this has already been addressed/isnt the right spot to post...I haven't looked through the entire thread.

I can't compile my arduino sketches that are generated by audio system design tool. here is an example of a sketch after I'd added the void setup() and void loop() functions
________________________

#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>

// GUItool: begin automatically generated code
AudioInputAnalog adc1; //xy=474.36365127563477,232.54545211791992
AudioOutputAnalog dac1; //xy=686,252.63637161254883
AudioConnection patchCord1(adc1, dac1);
// GUItool: end automatically generated code

void setup(){
}


void loop(){
}
________________________

I've downloaded the audio library (version 1.0 stable) and have it in
/Applications/Arduino.app/Contents/Resources/Java/libraries

I am getting this message


In file included from sketch_oct05a.ino:1:0:
/Applications/Arduino.app/Contents/Resources/Java/libraries/Audio/Audio.h:31:2: error: #error "Teensyduino version 1.20 or later is required to compile the Audio library."
/Applications/Arduino.app/Contents/Resources/Java/libraries/Audio/Audio.h:37:24: fatal error: DMAChannel.h: No such file or directory
compilation terminated.

I realized I had the earlier version of teensyduino, and so I installed teensyduino 2.0 from
https://www.pjrc.com/teensy/td_download.html
(which was slightly confusing where is was located on the page- maybe label the link explicitly 'teensyduino2.0' instead of 'A release candidate for next version ')
however after install, this didnt take the message away from the compilation error of the arduino sketch. i still get

/Applications/Arduino.app/Contents/Resources/Java/libraries/Audio/Audio.h:31:2: error: #error "Teensyduino version 1.20 or later is required to compile the Audio library."
i cant seem to finder 'teensyduino' on my computer - is it a package or it simply downloads a bunch of .h and .ino files to your arduino libraries folder?

And I can't find DMAchannel.h anywhere on my computer - (its #included in audio.h which is #included in my sketch). actually - there are a few libraries that im not able to track down to their source. audiostream.h for example - it is included in audio.h but i don't see it anywhere in the libraries folder.

any ideas?
I'm really excited to get started using this library once I get it all figured out! just got three more teenys in the mail to start trying things out
thanks
Zach
 
Pensive - you are able to compile your arduino sketches by simpling copying the export file from the audio system design tool into a new arduino sketch? do you add a setup() and loop()?
are you able to find DMAchannel.h in your /Applications/Arduino.app/Contents/Resources/Java/libraries/Audio ?
 
I've downloaded the audio library (version 1.0 stable) and have it in
/Applications/Arduino.app/Contents/Resources/Java/libraries

The paths for everything are different on mac than the are on Linux or Windows so I don't know if that is the correct location. However, note that Teensyduino 1.20-rc5 (and later versions, presumably) adds the Audio library so you will get it if you ask to install it (or sellect "install all libraries").

In file included from sketch_oct05a.ino:1:0:
/Applications/Arduino.app/Contents/Resources/Java/libraries/Audio/Audio.h:31:2: error: #error "Teensyduino version 1.20 or later is required to compile the Audio library."
/Applications/Arduino.app/Contents/Resources/Java/libraries/Audio/Audio.h:37:24: fatal error: DMAChannel.h: No such file or directory
compilation terminated.

Yes, that message is correct. There was a change to the audio library shortly before 1.0 which required a dependency on the new DMAChannel which is not in Teensyduino 1.19

I realized I had the earlier version of teensyduino, and so I installed teensyduino 2.0 from
https://www.pjrc.com/teensy/td_download.html
(which was slightly confusing where is was located on the page- maybe label the link explicitly 'teensyduino2.0' instead of 'A release candidate for next version ')

To be clear, the version is 1.20 not 2.0. Also, 1.20 has not been released yet so you need the 1.20-rc5 release candidate (the labelling on the download page is correct). There is also a forum topic about the new version.
http://forum.pjrc.com/threads/26727-Teensyduino-1-20-Release-Candidate-5-Available

1.20 is close to being released; unfortunately that late change regarding DMAChannel means that you happen to have hit a period of time where it is absolutely necessary to use a releae candidate. This doesn't happen often.

i cant seem to finder 'teensyduino' on my computer - is it a package or it simply downloads a bunch of .h and .ino files to your arduino libraries folder?
teensyduino is a program which updates the Arduino environment to add support for the Teensy boards, and also installs a bunch of libraries which have ben updated t be Teensy compatible as well as supporting the Arduino boards. Its the thing you downloaded from the download page. To do that, it needs to be run, not just put somewhere.

And I can't find DMAchannel.h anywhere on my computer
This indicates that you have not run the teensyduino 1.20-rc5 installer. Because that installs DMAChannel.

As a check, you can look at the Help > About Arduino splash screen. This has the Arduino version and Teensyduino version listed, so you can check exactly what you are running.
 
yes sorry 1.2 not 2.0

its very odd...I have installed 1.20-rc5

after it not working for a while i ended up installing it again and still doesnt work
 
has anyone checked the teensyduino 1.20-rc5 install on a mac yet?

Yes, works fine.

sc.png
(click for full size)
 
Use the menu, Arduino > About Arduino, to check if you really have 1.20-rc5 installed.


Edit: Also, make sure you have Teensy 3.1 or Teensy 3.0 selected in Tools > Boards. The library can't possibly compile if you have a non-Teensy board selected.
 
Last edited:
got it to work - i had arduino 1.0.5 installed

the teensyduino 1.20-rc installer says that it work with 1.0.5, but it wouldnt for me...

once i installed arduino 1.0.6 - i had to reinstall teensyduino 1.20-rc. now it works - thanks for the help everyone!
 
now that I have 1.0.6 installed and check Arduino>About Arduino i can see clearly that teensyduino 1.20-rc5 is on the about page - beforehand (1.0.5) it didn't mention its existence at all so i figured it was hidden or something since I had an earlier version of teensyduino installed.
 
ADC objects - multiple audio inputs?

The Audio System Design Tool allows you to create multiple adc objects. however each of them say to use pin A2 for audio input. Is it possible to have multiple inputs? Is there something special about pin A2 other than being referenced by the AudioInputAnalog class?
 
ADC objects - multiple audio inputs?

The Audio System Design Tool allows you to create multiple adc objects. however each of them say to use pin A2 for audio input.

That limitation was fixed very recently. Download the latest audio library from github.
 
ok great - i had version 1.0 stable downloaded

however on the teensy3.1 technical specifications page

https://www.pjrc.com/teensy/teensy31.html#specs

under the communications table

it mentions that there is only 1 I2S Audio pin
which is the case - being able to use multiple pins as audio input or only 1?

also - what is the FIFO size (8) of the audio pin referring to? I know all the live audio memory is allocated to 'AudioMemory' and that it comes in in blocks 128 samples wide - is the FIFO size referring to the max amount of these blocks that can be stored at once? I don't think that would be 8 because I've seen a few examples that provide AudioMemory(x) with values >8
ex: the recorder.ino example initializes AudioMemory(60)
 
The Audio System Design Tool allows you to create multiple adc objects. however each of them say to use pin A2 for audio input. Is it possible to have multiple inputs?

The ADC object supports only a single input signal.

The design tool allowing multiple instances of objects limited to only a single instance is a known issue. Patches or pull requests to fix this are welcome. Eventually, I'll get around to adding such javascript code, but it's not a high priority right now.

https://github.com/PaulStoffregen/Audio/issues/58

Someday, I (or others) may create a multiple input ADC object. A stereo one on A2 & A3 using the 2 ADCs is probably the simplest approach. A 2+ channel one using a pair of DMA channels (one to acquire the data, another to reconfig the ADC) to automatically sweep through several channels is also possible, but quite a bit trickier to implement. Again, it's "only" a matter of someone writing that code. But it's not going to write itself, so it'll only happen if someone with the skills and interest does so and publishes their code.


it mentions that there is only 1 I2S Audio pin
which is the case - being able to use multiple pins as audio input or only 1?

I2S is a communication protocol, where (usually) 2 channels of audio are transmitted using a single data line and 2 or 3 clock signals.

also - what is the FIFO size (8) of the audio pin referring to?

The FIFO is a small amount of buffering built into the I2S port inside the chip. It allows up to 8 incoming samples to be stored, in the (very unlikely) event where the processor is unable to read the data immediately.

The audio library uses DMA channels to move the data very quickly and efficiently. Odds are slim the incoming FIFO ever has more than 1 sample when using the audio library. Even if you're using I2S output and other DMA-based stuff, the DMA is very quick. But if some other DMA-hogging library were in use and delayed the audio library's DMA, the FIFO allows quite a lot of time for the samples to be queued up inside the I2S hardware.

For the way the audio library works, the 8 sample FIFO is massively overkill. The FIFO could also allow time for a less efficiently written library (eg, not using DMA) to respond. In the very early days of Teensy 3.0, before this library was even started, hpyle published some I2S code which could use either method.

But now, everything is DMA based, with the library implementing AudioConnection objects and a GUI for designing your system.... pretty amazing how far things have come in since those very early days.
 
ADC objects - multiple audio inputs?

The Audio System Design Tool allows you to create multiple adc objects. however each of them say to use pin A2 for audio input. Is it possible to have multiple inputs? Is there something special about pin A2 other than being referenced by the AudioInputAnalog class?

Since you mentioned A2, I assumed you were talking about the onboard ADC. But now you are mentioning I2S which implies the ADC on the Audio board. Which one do you mean?
 
I'd like to ask everyone following the audio library to give 1.20-rc6 a try.

http://forum.pjrc.com/threads/26763-Teensyduino-1-20-Release-Candidate-6-Available

This copy has the latest audio library, latest OctoWS2811, and a couple small but important updates in the core lib and SPI, which impact the audio library.

Please, give this a try and let me know if it works for you. Unless any problems turn up, I'm going to make a final 1.20 release tomorrow. 1.19 is getting very old, and 1.20 seems to be working great.

Please give this last release candidate a quick try, if you can. We'll probably have 1.20 around for a while, so if there's any problem, now's the last change to fix.
 
Status
Not open for further replies.
Back
Top