VS1053 + Teensy 3.1 - Drum Module

Status
Not open for further replies.

Chuckytuh

New member
Hi guys a couple of years ago I started with a personal project of building a home made electronic drum kit but I didn't just wanted to do the kit, I wanted to build a trigger-to-midi device too. Because I had no experience with electronics I spent my summer vacations learning about electronics and a little about microcontrollers. Got my hand on some samples from atmel and played with the uCs.

Summer break was over and I didn't had my kit done and I wanted to play drums so I made the decision to buy an Alesis Trigger IO and it wall went perfectly.

Few months ago I sold my kit with the main purpose of building a new one (lol) but with the kit the Trigger Io was sold too so now I'm focused on get my hands on a diy drum module. There are many number of open-hardware/source projects around the internet but none satisfies me, I must be able to come up with something! Ultimately I want something that hasn't been done as an open project and that a full diy drum module with sound output. I know it sounds a lot, and it is but I have time and, at least for now, I'm motivated!

I've been doing some research and found a website that sells one IC (SAM3816) with the following characteristics:

Package LQFP144, pitch 0.5 (full datasheet here)
# on chip DSP 16
DSP type P24
max. Polyphony >128 with effects
Internal Memory 32kx24 RAM + 16x 2kx24 DSP RAM, 16k Flash
External Memory 2x 256MB Flash, SRAM, DDR/SDRAM
I/O Interfaces USB, serial MIDI, 8bit and 16bit parallel Host, SPI, GPIO
Audio I/O 16 IN / 16 OUT (digital)

AFAIK it would do the job but I can't find any freely available library, toolchain or programmer and given the fact that they sell evaluation boards and devboards with the SDK in a cdrom, they must only provide the programming tools if I buy them. Although they sell the chips as a solo unit.

Introduction done, what I want to know from you guys is that if I'm able to do something with the teensy and the external codec VS1053. The first brainstorm for the project is something like this: Drum samples go an sd-card or some other memory device, a microcontroller (the teensy or any other IC that you think better suits this project) to do the piezo readings, load the associated sample from the sd-card, do any needed mixing if more than one piezo are triggered at the same time and finally send it to the VS1053.

First problem I see here is that the mixing should be done by the codec or the unit that will output the signal for an external DAC, am I right? Or I can do the mixing directly on the unparsed, lets say, mp3 file, and send it for the codec?

I guess the main problem to solve here is, how can I play more than one sound at the "same time" as soon as one or more piezos are struck?

I guess that the sd-card isn't enough, I need a way to cache most of the samples because the speed rate from the sd-card might not be enough to stream the data for immediate playback.
And probably this type of project isn't suited for the teensyduino libraries.



Sorry for the big post, I understand if you don't want to read it all.

Regards, João Gonçalves
 
Actually, this might be perfect timing, since the audio board and library were just recently released.

The library is still very "beta", but if you give this a try, I'll help. in fact, if you're willing for this to get turned into an example distributed with the library, I'll quite a lot. ;)

A first question I have would be about those drum sound samples. Are they freely shareable?
 
Actually, this might be perfect timing, since the audio board and library were just recently released.

The library is still very "beta", but if you give this a try, I'll help. in fact, if you're willing for this to get turned into an example distributed with the library, I'll quite a lot. ;)

A first question I have would be about those drum sound samples. Are they freely shareable?
There are a lot a free drum samples around the web,they are plain audio files. My initial thought would be to use the SFZ format (http://www.cakewalk.com/DevXchange/article.aspx?aid=108) because there are many drum sample packs that allow for variable hi hat sounds,positional sensing on the snare and more cool stuff. So basically there will be a need to parse the SFZ file from the SD card and from there we have the midi notes and associated audio files,all mapped in a standard way.

I still don't quite understand if the teensy should output the analog audio or if it would be better to delegate the audio playback for a dedicated codec and dac. If the second option is the best one than what will be done by the teensy? Reading from the SD card and parsing the SFZ and simply output midi for the codec? Or should the teensy read the SD card,parse wav file,mix them for polyphony and output trough i2s for the external DAC?
 
Or should the teensy read the SD card,parse wav file,mix them for polyphony and output trough i2s for the external DAC?

This.

I thinking of a fairly simple example that just plays audio clips when events are detected.

Actually, at the moment I'm working on a small program that will convert WAV to arrays of data to be copied directly into program, and then another player that will play them. The remaining 200-230K of flash inside the chip isn't a lot, but if your samples are short and/or lower sample rates, you can fit quite a few. The huge advantage of playing from the internal flash is speed. Reading the internal memory takes virtually no CPU time.

Yesterday I measured WAV file playing using about 12% CPU. In previous testing, before the SD library speedup, it was 40%. I did play 2 files simultaneously at 40% each, so it is possible. Hopefully 6 or 7 can play now, but it also will depend if a SD card is able to keep with with the non-sequential requests. The software mixer also take a little CPU time, so 8 streams is very unlikely, unless the SD library gets faster (which might happen someday....)

There's also a place to solder a 16 Mbyte SPI flash memory chip on the audio board. It will be faster than a SD card, but not nearly as fast as direct access to the internal flash. So far, there's no code at all for that chip, but I do want to add it at some point.
 
So Paul, are we looking at a simple Teensy sequencer, Teensy drum, Teensy synth suite using the audio board in the future?

Well, in my dream world, where I have infinite time to write code and documentation, I'd like the audio library to provide pretty much everything you need to easily build all these things and much more.

Reality is going to fall short of that ideal, but I'm going to try...
 
However, I do not see myself writing a SFZ parser anytime soon. Code contributions are certainly welcome, if anyone wants to take this on.
 
And what about an external sram / dram that is loaded with the samples from the SD card when the board is powered up? This way we could simply play those samples from the ram instead of reading them from the SD card.

Main problem I see is the low number of multiple sounds playing together that feels not enough for drumming where you may have 5 cymbals that sustain their sound for some seconds while the payer is doing a fill on toms and kicking the bass drum and might even be playing the hi hat pedal.

The other problem is the quality of the samples, better = bigger..

I'm waiting for my teensy to arrive and I'll try to code the SFZ parser,just need to end some projects that I have in hands.
 
Last edited:
Status
Not open for further replies.
Back
Top