Audio Library

Status
Not open for further replies.
Nantonos, any idea of the maximum speed the "control voltage" should support?

That is a slightly harder question than it appears. Conventionally, the filter cutoff frequency would be changed:
- once per played note, or more usually
- with a combination of note pitch plus the output from an ADSR, or LFO, or both, to give tonal articulation over the note duration

So we would be talking of updates in the 0.1 to 200Hz range. However,

a) an ADSR can slew quite fast, giving a lot of update in the attack phase especially, and
b) it is increasingly common to use audio-rate modulation. Not all analog modules support this and the ones that do vary a lot as to what sorts of frequencies they can operate at.

I'm also vaguely aware that digital filters have constraints on settling time and some behave badly if the control signal changes too fast. Aiming for a moderate update speed and then slew-limiting the update rate (for example with the running averaging that you mention) seems like a reasonable approach.

Sorry I can't quote a maximum worst case update frequency. Well, no-one wants it above 20kHz. But the sensible maximum is a lot less than that.
 
Last edited:
Yeah, there's a lot of trade-offs here.

Today I asked about exp2() approximations on a mail list. Several people replied with polynomials and other tricks. I'm debating how accurate vs CPU time I want to make this. The simple exp2() approximation is at worst 0.34% error, and the sin() approximation is about 0.07% error using a 3rd order polynomial. I'm hoping for a exp2() algorithm that's a bit better, but then the filter is hardly a sharp roll-off or really narrow peak. But I'm not sure how I feel about resorting to two polynomials, 3rd and 4th order, calculated 44100 times per second, inside an object people are likely to use for multiple instances. Efficient and "good enough" might be much better than perfect but drains away CPU time that could implement more objects?

I also found a paper with some analysis of the stability issues with rapid changes. I'm not sure I fully understand it all (the math is very complex). I'm going to try some fast waveforms on the control input and see if anything really terrible happens. Apparently the expected failures are suddenly transitioning to a lower corner frequency while the resonance is set low (a pair of conditions probably not used much in music synthesis).
 
Finally, after 2 solid days of struggling with numerical approximations in fixed point math, I've finished the control signal input for the state variable filter.

The filter produces 3 outputs: low pass, band pass, and high pass. Previously it only took the signal in to filter. Now you can feed a control signal to modulate/sweep the filter's corner frequency.

The filter coefficient is recomputed on every audio sample, so at least in theory you can control the corner frequency with any audio signal. I had earlier considered recomputing the coefficient every 2 or 4 samples to conserve CPU time, but in the end I went with recomputing it at the full sample rate.

The GUI has been updated with documentation for this filter. Just connect any audio signal to the second input, and set the center frequency and number of octaves you want your control signal to modulate it, and you've got a "voltage controlled" filter!!

I've done a LOT of testing by checking numbers, and some testing with sine waves from my function generator, but so far no testing with actual audio. Please, if you're interested in the VCF, give it a try and let me know how it works for you?

Edit: Here's a screenshot in the GUI.

vcf.png
(click for full size)
 
Last edited:
Also, if anyone knows how to do equations nicely in HTML markup... I could use a hand with this bit:

Your options are
- use <sup> and <sub> (easy, limited)
- put classes everywhere and set font size, relative positioning in CSS (morte complex, still not great)
- use MathML and then include a javascript library for all the lame browsers that don't support 9or removed support for) MathML (verbose, but adequate)

For MathML, MathJAX is recommended.

The simple power law equation you have looks fine to me as it is, by the way.
 
Regarding equation documentation, I was kinda hoping someone might actually *do* the conversion and post text that might be copied into the html. Sure, pointers to web technologies are great.... if only I had a lot more hours in every day!

But I'm *really* hoping some of you might actually try using this new filter for some sound synthesis or other projects! That's the part that would be really helpful. I don't have a background in music or synthesis, so I'm really depending on you guys to let me know if this thing really works in practice. I'm poured a LOT of work into the math and it seems good, but there's no substitute for really using a thing to tell if it really is good.

Please, let's not turn this into a web technology thread. If anyone else comments on the equation stuff, please let it be actual html/javascript stuff to be copied into the documentation. The last thing I need right now, no matter how powerful and easy it might be, is yet another framework or system to learn.
 
Please, let's not turn this into a web technology thread. If anyone else comments on the equation stuff, please let it be actual html/javascript stuff to be copied into the documentation. The last thing I need right now, no matter how powerful and easy it might be, is yet another framework or system to learn.

I just setup server for work where they wanted this for mediawiki and I had the exact same problem in displaying formulas in a nice way. There is really no html or java script you can use that I know that will just work. You have to install some type of package for your webserver and setup the server to use it. I personally used Latex and I will say its probably not worth your time. That being said I found this website where it looks like you can type up your formula and embed it like so.

<a href="http://www.codecogs.com/eqnedit.php?latex=\fn_cm&space;\LARGE&space;F&space;=&space;Fcenter&space;*&space;2^{signal&space;*&space;octaves}" target="_blank"><img src="http://latex.codecogs.com/png.latex?\fn_cm&space;\LARGE&space;F&space;=&space;Fcenter&space;*&space;2^{signal&space;*&space;octaves}" title="\LARGE F = Fcenter * 2^{signal * octaves}" /></a>

CodeCogsEqn.png

I haven't tried this with our server though so I don't know if actually works.
 
Last edited:
Regarding equation documentation, I was kinda hoping someone might actually *do* the conversion and post text that might be copied into the html. Sure, pointers to web technologies are great.... if only I had a lot more hours in every day!
Do you have a list of the equations you wanted to use?

But I'm *really* hoping some of you might actually try using this new filter for some sound synthesis or other projects! That's the part that would be really helpful. I don't have a background in music or synthesis, so I'm really depending on you guys to let me know if this thing really works in practice. I'm poured a LOT of work into the math and it seems good, but there's no substitute for really using a thing to tell if it really is good.
I was working on that this evening. (I ordered an Audio Adapter when they came out, but its just been sitting in my parts drawer. This evening I was sketching out circuits needed to connect the line in and line out to Eurorack modular synth levels).

Please, let's not turn this into a web technology thread. If anyone else comments on the equation stuff, please let it be actual html/javascript stuff to be copied into the documentation. The last thing I need right now, no matter how powerful and easy it might be, is yet another framework or system to learn.
Well okay, but you did ask.
 
Pretty plots ona a ILI9341_t3 display but no music

Trying to plot a FFT on pjrc ILI9341 display but as soon as I do tft.begin the audio board turns belly up. I am using the latest download from github and assume the audio library is not supporting transactions ( yet? ). Long wait? Or should I look for another GFX display for this sort of project?
 
"Teensyduino version 1.20 or later is required to compile the Audio library"

Did something change since last night? I downloaded the library on my work PC today and it will not compile, works at home, but that was before you moved around the examples. Also, where did the examples go for SD card playback? They moved around and they are gone now, perhaps an update is happening as I type?
 
Last edited:
"Teensyduino version 1.20 or later is required to compile the Audio library"

Did something change since last night? I downloaded the library on my work PC today and it will not compile, works at home, but that was before you moved around the examples. Also, where did the examples go for SD card playback? They moved around and they are gone now, perhaps an update is happening as I type?

Yes, I changed a lot of stuff last night. Quite a few of the examples had names and code and comments that are based on details about how the library works internally. I'm getting things ready for a 1.0 release "real soon now". Part of that effort is going through all the examples.

There were far too many examples for just a flat list, so I grouped them into a few categories. Over the next few days I'll probably rename several of them and make some significant edits.

The .WAV file player is one of the 2 examples still in the first level of the hierarchy.
 
Y...
Anyway, I'll start playing with the library as soon as the boards arrive and see what I can do to adapt it.

I will be looking forward to your contribution. Right now I am mainly interested in passing 32bit the I2S interface in Master mode (so it works with the external DAC) and conversion of any data size to 32 bit (e.g. playing 16bit 44KHz music samples)
 
Tried moving the SPI pins to 7 and 14 the display will work but when I try to fire up both audio and display .... nada.
 
I am mainly interested in passing 32bit the I2S interface in Master mode (so it works with the external DAC)

Which DAC chip are you using? Is it a breakout or dev board that's available somewhere, or your own design. I'm curious... especially to see a photo!
 
Tried moving the SPI pins to 7 and 14 the display will work but when I try to fire up both audio and display .... nada.

Can you post the code you have so far? I'll look into a fix. It might require tweaking in the ILI9341_t3 library....

Maybe this would make a good example to include with the audio lib?
 
Which DAC chip are you using? Is it a breakout or dev board that's available somewhere, or your own design. I'm curious... especially to see a photo!

The ESS9018K2M http://esstech.com/PDF/ES9018-2M PB Rev 0.8 130619.pdf
Actually I mentioned this way back in this thread and was encouraged to modify the code myself. Unfortunately that was/is beyond my capabilities...
I have a board from diyinhk:http://www.diyinhk.com/shop/audio-k...ume-control-and-spdif-inputxmoses9018k2m.html
with a custom frequency clock in order to generate the correct frequency in master mode for the DAC chip (Slave mode for the Teensy -- made an error in my previous post. I want to use the Teensy in Slave mode)
 
Last edited:
Yes, I changed a lot of stuff last night. Quite a few of the examples had names and code and comments that are based on details about how the library works internally. I'm getting things ready for a 1.0 release "real soon now". Part of that effort is going through all the examples.

There were far too many examples for just a flat list, so I grouped them into a few categories. Over the next few days I'll probably rename several of them and make some significant edits.

The .WAV file player is one of the 2 examples still in the first level of the hierarchy.

Audio testing is going very good. I think I can get my boss on board as soon as I find some quality Bluetooth libraries or tutorials. We'll be buying a lot of bootloader chips if this works out.

The link to wav2sketch is broken, anyone have that program? I wanted to try converting a file.
 
Status
Not open for further replies.
Back
Top