Teensy 3.2 for multichannel delay unit?

Status
Not open for further replies.

mykle

Well-known member
Hello,

I'm trying to figure out if I would be able to build a certain piece of audio hardware I'm imagining using the Teensy. I really enjoyed Paul's demo video of the multi-tap delay. I have a design in mind for a multi-channel delay unit. I've also been looking for an excuse to start playing with the Teensy Audio library.

However, my concept involves being able to switch between & merge multiple channels of delayed audio -- at least four, to be really useful. And I imagine the sample length being something like ten seconds per channel. If I round up my total audio buffer size to sixty seconds, then my audio buffer would need to be 60 * 48khz * 16 bit samples = 5.76 megabytes.

Certainly that would fit on an SD card, and I could stick that in the teensy audio board's SD slot. But I've read there's limits to how fast SD cards can be read, and that getting even two simultaneous channels to play back at once (at audio bandwidth) requires a particular breed of SD card. (Could there be an SD card somewhere that's optimized for random access?)

I read about attaching a RAM chip that gets the memory buffer up to 1.5 seconds, but that's still almost two orders of magnitude too small.

I also read how 128 megabits of additional flash can be added to the teensy, equivalent (i hope) to 16 megabytes. But I'd be constantly re-writing this memory. It seems like flash could be a bad choice there. Although 100,000 write/erase cycles might take me a long time to use up ... I guess it would work for a while, if that spec can be believed. (If that flash chip can be socketed for easy replacement, I'd be less wary.)

On the other hand, I do have a pile of old laptop RAM in my basement, and I've read that the Cortex M4 has an auxilliary memory controller that can read SDRAM. Is there a way to hook up an old DIMM or SIMM to the Teensy 3.2 and use that as a buffer?

Thanks for any advice,

-mykle-
 
Last edited:
Hi,

SD cards won't work as a RAM substitute. SPI flash won't work either, very long write times; it's really just useful for permanent storage.

your best bet would be to use a bunch of SPI SRAM chips, as (i think) is shown in Paul's video (using frank's "memory board"). though even that won't get you nowhere near 5.76MB; it's only 6 x 1Mbit = 0,75MB. so worth about ~ 8.5 seconds of mono 16 bit, if i see it right (the teensy lib is 44.1kHz, not 48kHz). it's possible to pull off very nice delays with those (for instance -- using 2 x 23LC1024, i believe), but unlikely 4 channels with 10 sec delay line each.

AFAICS, SRAM with more capacity means larger ICs with parallel interfaces. thus many pins. i don't think they'll work with teensy; and the MK20 doesn't have the FSMC, which you've probably read about (the "auxilliary memory controller").
 
Last edited:
Is there a way to hook up an old DIMM or SIMM to the Teensy 3.2 and use that as a buffer?

I'm probably the last person who could say the word "impossible", since I did something similar 17 years ago with SIMMs interfaced to a 8051 microcontroller!

But trust me when I say I know from experience this would be a long and difficult path.
 
This does make me curious though. What sort of project would use a 1 minute audio delay? That's an extremely long delay. Even just the 9 seconds (mono) with Frank's Memoryboard gives this sort of "is this thing really working" impression when you say or do something, and then you hear the sound.
 
So lets break this down into the two design specifications you have.
60 * 48khz * 16 bit samples = 5.76 megabytes total storage space
48khz * 16 bit samples = 768kHz or 1.302us per bit write/read speed

http://uk.rs-online.com/web/p/sdram-memory-chips/8115096/ seems like a potential.

Just grab an off the shelf RAM chip

care to elaborate?

i count about 36 i/o pins on this off the shelf RAM chip. teensy 3.x breaks out 34. minus 7 for i2s.
 
Ooops you're quite right! That's very rookie of me.

Yeah these data rates will probably need a high speed parallel interface
 
This does make me curious though. What sort of project would use a 1 minute audio delay? That's an extremely long delay. Even just the 9 seconds (mono) with Frank's Memoryboard gives this sort of "is this thing really working" impression when you say or do something, and then you hear the sound.

a guitar loop pedal, I can imagine looping entire verses and multiple layers when used properly. OF course it's not a delay, but it's an extension of the principle of a delay line.

https://www.youtube.com/watch?v=temYymFGSEc

The good news is that 4 channel playback from a decent SD card is achievable, but I don't know about recording as well, and writing at the same time... :-/
 
Last edited:
a guitar loop pedal, I can imagine looping entire verses and multiple layers when used properly. OF course it's not a delay, but it's an extension of the principle of a delay line.

https://www.youtube.com/watch?v=temYymFGSEc

The good news is that 4 channel playback from a decent SD card is achievable, but I don't know about recording as well, and writing at the same time... :-/

Exactly. It's more of a looper, similar to what you might do with tape loops if you lived in the seventies. (Tape was the internet of the seventies. :) But with random access I could do a lot of handy things, like tweaking in & out points, A/B mixing (or A/B/C/D/E/F/G/H mixing), processing one channel with another channel, et cetera.

Still, my vision for this definitely involves reading and writing at the same time -- or, rather, reads and writes alternating fast enough that the user doesn't know the difference. So I assume SD is not the thing.

However ... I did a search on DigiKey for serial-access memory, and discovered some niche RAM technologies that I'd never even heard of!

Here's 4 Mb of Magnetoresistive MRAM:
http://www.digikey.com/product-detail/en/MR25H40MDF/819-1055-ND/4169130
"They are the ideal memory solution for applications that must store and retrieve data and programs quickly using a small number of I/O pins"

Here's 4 Mb of FerroElectric F-RAM:
http://www.digikey.com/product-detail/en/CY15B104Q-SXI/428-3413-ND/5702263
(Datasheet in Chinese, but their other F-RAM datasheets claim high speed, trillions of writes, hundreds of years, etc.)

If I could make do with 4MB, it seems like one of these might work. Assuming I can adapt it to the pads on the audio board ...

BTW, all the SPI-RAM datasheets i've looked at lately talk about three SPI modes: "normal" SPI, "dual" SPI and "quad" SPI. Can the Teensy speak "quad" SPI for reads and writes?

(The FRAM chips also describing supporting SPI modes 0 and 3. Suddenly SPI is way more complicated than I knew ..)
 
Last edited:
those are 4Mbit though?, so you'd still need like 8 (ie, for 4 Mbyte)! that might even be possible, but way too $$$ methinks.

and i see. a looper. fwiw, i was always wondering how the EHX 2880 was doing it (stereo only, but it records to SD); from what i've seen, it has a blackfin + some ISSI SRAM chip + (presumably 4-bit) SD.

it records/loops the entire SD (like minutes and hours, if need be), so i'd figure the SRAM is mainly working as some sort of recording buffer in this type of set-up. so you wouldn't need all that much SRAM, after all. something along these lines might be doable, i don't know? probably not 4 channels though.

fwiw, though it's stereo, not quad, you might want to consider a ready-made, hackable platform such as this ; it comes with both SD and 8MB SDRAM
 
Last edited:
Perhaps this?
You'll have to use 16bits for the data or use 2x8bits muxed. The address pins can be controlled by a shift register. This'll give you a FIFO kind of device which makes sense as you're recording sound chronologically

I don't think you'll find F-RAM that'll have the capacity, but they may exist somewhere.
 
DDR memories have a narrow range of very fast supported clock speeds. If you look at page 14 on that datasheet, you'll see the maximum clock cycle is 12 ns. That's the slowest you can use! And during the data phase, you must transfer data on both edges of that clock, or every 6 ns. Even worse, if you look carefully at the timing diagrams, you'll need you need to transition in the middle of those 6 ns.

Unfortunately, DDR is only practical with dedicated hardware interfaces, or the fastest FPGAs. Even in FPGA, meeting DDR timing with the programmable logic is extremely difficult. Many FPGAs now have dedicated DDR interface circuits for exactly this reason.

Accessing such a memory chip from a microcontroller's GPIO pins just isn't practical. :(
 
As much as I'd like to see Teensy used, for this large memory requirement, a single board computer like Beaglebone or Raspberry Pi is probably much more appropriate.
 
...the maximum clock cycle is 12 ns. That's the slowest you can use!

Thanks for the information Paul! This will be useful to know for an FPGA project I'm currently designing

It is a shame there isn't memory that'll do this though. The Teensy does have the speed required.
From a manufacturers point of view though I guess there isn't a market for slow access, high storage ICs

EDIT-
Well obviously there's Flash memory but there's a limited number of write cycles
 
Last edited:
As much as I'd like to see Teensy used, for this large memory requirement, a single board computer like Beaglebone or Raspberry Pi is probably much more appropriate.

I would agree with you, a RasPi has enough IO to handle an LCD screen, 4 or 5 footswitches and a bunch of LEDs. It also has enough power to do not just looping but all manner of effects without memory limitations and with bolt on 24bit audio boards a-plenty, (or usb sound cards) overall, you'll get a much more capable result.

Assuming you can get linux to play ball reliably in a headless environment. That's a whole other skillset in itself. :)
 
As much as I'd like to see Teensy used, for this large memory requirement, a single board computer like Beaglebone or Raspberry Pi is probably much more appropriate.

Hmm ... any chance I can use Arduino and/or the Teensy Audio library on one of those platforms? =)
Or any other option to write bare-metal code in C without an OS?

I admit I got really frustrated trying to do audio on Linux years ago. I pretty much gave up on the idea of linux as an audio platform. It's probably better now, but running an entire unix OS to accomplish this level of thing still strikes me as insanely bureaucratic. And the real-world result of software bureaucracy is latency and bugs ... I've never seen an effects pedal kernel-panic before, and I don't want to start.

Here's some other opinions:

"The on-board chipset of the RPi has quite some limitations unfortunately. It only does playback and because of it's design it is not really suited for real-time, low-latency audio processing." -- http://wiki.linuxaudio.org/wiki/raspberrypi

The beagleboard might be a bit better -- http://lac.linuxaudio.org/2014/papers/32.pdf describes a way to get latency down to 7ms on it, although apparently it has no native audio IO & needs a USB audio interface to be purchased & installed. (7ms is considered "low latency audio" in the Linux world, but some audio engineers consider anything over 5ms to be a potential problem.)
 
those are 4Mbit though?, so you'd still need like 8 (ie, for 4 Mbyte)! that might even be possible, but way too $$$ methinks.

Oh yeah, duh. b as in bits, not bytes. Soooo ... I guess 8 of those F-RAM would be $120 worth of chips. Not cheap, but not impossible either.

and i see. a looper. fwiw, i was always wondering how the EHX 2880 was doing it (stereo only, but it records to SD); from what i've seen, it has a blackfin + some ISSI SRAM chip + (presumably 4-bit) SD.

it records/loops the entire SD (like minutes and hours, if need be), so i'd figure the SRAM is mainly working as some sort of recording buffer in this type of set-up. so you wouldn't need all that much SRAM, after all. something along these lines might be doable, i don't know? probably not 4 channels though.

Tell me if I'm wrong because I've never done this, but ... doesn't the slowness of SD writing mean that your buffer fills up faster than you can empty it? Or is it faster to write SD in large blocks somehow?

fwiw, though it's stereo, not quad, you might want to consider a ready-made, hackable platform such as this ; it comes with both SD and 8MB SDRAM

Wow, that's a pretty interesting universe. Like PD, but then you can unhook it from the computer and stick it in a box. Thanks for the link! I'll look into it more.
 
Those little 23LC1024 RAM chips work out to be more affordable than FRAM. Eight of them makes 1 Mbyte for $16, versus two FRAMs at $30 or $40.

Connecting 46 of those RAM chips seems kinda crazy, but it probably could be done with appropriate logic chips and buffers.
 
One could use 4 or more Memoryboards with pins2-4 patched to different Teensy-pins. Easy. Just no pinheaders for 2-4 and some short wires instead.

Or, perhaps better, create an new board..
 
Last edited:
Tell me if I'm wrong because I've never done this, but ... doesn't the slowness of SD writing mean that your buffer fills up faster than you can empty it? Or is it faster to write SD in large blocks somehow?

i honestly have no clue. incidentally, this thread just cropped up again, which i suppose (i haven't been following) is similar in spirit; though the concept seems to involve two teensies.

i'd be curious, too, if that would work, or make any difference; ie even for the audio shield equipped with one 23LC1024 -- i haven't tried anything except simple variations of the 'recorder' example, but occasionally was wondering whether it would be feasible to do a simple mono or stereo recorder/looper with simultaneous record/play, overdub etc.
 
Status
Not open for further replies.
Back
Top