Schematic for USB thumb drive recorder?

GroupDIY Audio Forum

Help Support GroupDIY Audio Forum:

This site may earn a commission from merchant affiliate links, including eBay, Amazon, and others.

Mbira

Well-known member
Joined
Jun 4, 2004
Messages
2,422
Location
Austin, TX
Hi folks,
I am wanting to design a novel concept of an 8 track recorder that records on to a thumb drive.  Can anyone recommend where I can look for schematics for something like this?  This will be a very simple design with one pre-determined sampling rate (44.1/16 .wav) and it would record all 8 tracks all the time with the push of a button starting the recording and another stopping the recording.  A new recording would just start a new folder. 

Any advice on who to talk to or where to look for ideas would be most helpful! 
 
J7XsNmC.jpg
  there is some people turning a raspberry pi in to a 8track.  ;D

but seriously it could be a good alternative. there is people building 4 track loopers and similar things so it could be a good start.

Rafael
 
I'm hoping to keep the circuit as small as possible, so I don't think a Raspberry Pi will do what I need.  I was thinking using something like an ARM chip (But I don't know anything about the capabilities).  I'm assuming I need to know what A/D can handle converting 8 channels of (mono) 44/16 and then what I need to do to send that into the Thumb drive...
 
Mbira said:
I'm hoping to keep the circuit as small as possible, so I don't think a Raspberry Pi will do what I need.  I was thinking using something like an ARM chip (But I don't know anything about the capabilities).  I'm assuming I need to know what A/D can handle converting 8 channels of (mono) 44/16 and then what I need to do to send that into the Thumb drive...
A Raspberry Pi is a higher-end ARM chip with video and USB added. You can get "smaller" boards like the STM32F4 Discovery board (though they have less electronics they're actually a little larger to bring out all the pins to 0.1" headers). They'll handle a stereo channel of 16/44, but I don't know if they have the throughput for reading four of them and writing a flash drive. Total is 700k bytes per second, but you need buffering and overhead...

It's surely doable on the latest RPi3, or the RPi Zero (smaller form factor but missing some features the others have), and there's a decent amount of resources to help you put the building blocks together. If you want the circuitry "as small and simple as possible" you'll need more development time for the code and/or FPGA programming.

To write to a thumb drive (I presume you want it readable as-is on a PC or MAC - your "new folder" and .wav comments mean this) you need "file system" software, which is available pretty much off-the-shelf, but ... have you done this sort of thing ... it's not just connecting chips together with wires, you're connecting software blocks together with system calls and interrupt handlers and stuff.
 
Thanks for the info!
... have you done this sort of thing ...

I have written sketches in Arduino for some projects I've built and I have experience with the actual flashing aspect of ARM chips (but not actually writing the code for those), so it will definitely be a learning curve, but it is one that I am willing to overcome in order to bring this project to life. 

I was talking with a friend tonight who has more software experience and though he doesn't know how to accomplish this he does have a spare RPi that he said I could borrow and I was thinking maybe it is a good idea to get a prototype working on the RPi first and then I could move it to a separate circuit if needed.  Does that sound like a good plan to you?
 
I would love to see a stand alone multitrack recorder that is just like a basic reel-to-reel with input select, record, play and so on. No EQ, aux sends, faders, digital FX, etc. That's what outboard gear is for. And I don't like recording to the computer. Fussing with the computer kinda ruins the vibe.

Anyways, ... if I were doing this I would investigate the feasibility of using a conventional flash memory chip (w/ SPI interface) and write/read data directly between the flash chip and the codec. As long as the codec / ADC / DAC sends PCM data just like in a WAV file and the chips are clocked in the same way, there's no reason why it shouldn't be possible to read/write directly. This would greatly increase the performance possibilities and a relatively low powered uC could be used (an Arduino).

For example, to record, the uC writes a header to flash and makes a note of the data position. Then send clock to both the flash chip AND to the codec / ADC to send data to the share data bus. The flash chip won't be able to tell the difference. When the user presses "Stop", the uC uses the clock cycle count to determine the amount of data written.

Of course this doesn't handle writing a wav file to a fat32 USB drive but doing that as a secondary operation should be a relatively simple matter.

At any rate, the point is it could be quite fast not sending data needlessly through the uC in which case it is more likely to be faster, have less jitter, cost less and take up less space.

Just a thought!
 
The data will have to travel from ADCs to some sort of storage anyway, through some sort of MCU bus, so I don't think there's much efficiency to be gained by writing raw streams to Flash. Having a possibly timestamped set of files will also be quite handy. Instead of having to 'play' the audio out of raw storage into a formatted output, possibly mixing up the channel assignments or time offsets, you can just copy the files out of the filesystem intact, as they were recorded.

My feeling is that there's an excess of processor speed and memory speed to allow this formatting to be done during recording. Also, given the large block oriented write requirements of Flash, using the proven, buffered filesystem libraries is likely to be faster, and should cause leas wear to the Flash device. You can't just write a byte or two to Flash, you have to write a block. So, you're buffering it going in, until you fill a block, or reading the current block, adding a handful of samples, and re-writing the block. Without any optimization, that means writing the same block many times over, which is slow and tends to wear out the flash device.

The modern Flash filesystem libraries do wear leveling and a lot of nice stuff, and I suspect they're better than what one could whip up trying this the first time around.
 
Monte McGuire said:
The data will have to travel from ADCs to some sort of storage anyway, through some sort of MCU bus, so I don't think there's
It does? Why can't the ADC serial data out pin simply be connected directly to the flash chip data in pin?

Monte McGuire said:
much efficiency to be gained by writing raw streams to Flash. Having a possibly timestamped set of files will also be quite handy. Instead of having to 'play' the audio out of raw storage into a formatted output, possibly mixing up the channel assignments or time offsets, you can just copy the files out of the filesystem intact, as they were recorded.
I don't understand why reading/writing flash directly would have anything to do with "mixing up the channel" assignments. That would just be bad code.

Monte McGuire said:
My feeling is that there's an excess of processor speed and memory speed to allow this formatting to be done during recording.
I don't know a ton about ADCs but I suppose this depends on if data is read in chunks or if it's streamed. I was under the impression that it was streamed. If the data sent by the ADC is simply the state of the ADC at the moment the clock latches, then your uC will have to dedicate itself to reading from the ADC whilst recording. Or does the ADC buffer data?

Monte McGuire said:
Also, given the large block oriented write requirements of Flash, using the proven, buffered filesystem libraries is likely to be faster, and should cause leas wear to the Flash device. You can't just write a byte or two to Flash, you have to write a block. So,
Writing a "block" is still written one byte at a time. This would be true even if the flash chip was a parallel interface instead of SPI.

Monte McGuire said:
you're buffering it going in, until you fill a block, or reading the current block, adding a handful of samples, and re-writing the block. Without any optimization, that means writing the same block many times over, which is slow and tends to wear out the flash device.

The modern Flash filesystem libraries do wear leveling and a lot of nice stuff, and I suspect they're better than what one could whip up trying this the first time around.
Wear leveling  could be an issue. Sure. But I don't think it would be that hard to do it and in  a much better application specific way. For example I could just write all new data to a fresh part of the flash chip and then just update the index. The index would contain channel info, timestamps and pointers/size of relevant flash segments and so that would need to be moved once in a while to prevent wear. So yeah.
 
squarewave said:
It does? Why can't the ADC serial data out pin simply be connected directly to the flash chip data in pin?

I guess you're talking about just blasting the entire SPI output into memory and then taking it apart later. Not such a bad idea, but as I seem to understand it, SPI is a master slave protocol where, for example, the master can ask the ADC for the data from channel N of the ADC the last time it was sampled, repeat that for all channels, and then wait until a new set of samples have been generated, and repeat. So, there's no stream of samples pouring out of an ADC via SPI to be blindly stuffed into memory - it's a serial bidirectional interface that a master could use to read samples out of the ADC, synchronous to the sampling.

You're extracting samples from the ADC manually anyway, so you might as well pack them into something like a WAV format, collect blocks of those files, and tell some code to write those formatted blocks to files using filesystem code that someone already wrote.

There's also the issue of erasing flash. This is where the block nature of flash comes about. You can write a zero anywhere, but to write a one over a zero, you need to erase the entire block, creating all ones, and then re-write the zeros you wanted to keep in that block. So, in the general case, it's far easier to do everything in blocks. When you ask the filesystem to write a page to a file, it will get a free block from the free list of the flash device, erase that, and then copy your data to the erased page. So, just using a FA32 format will allow a lot of pleasant things to happen, at the price of using a micro that you probably want anyway - board space, chips, and placement cost are expensive, and micros are cheap.

To keep it simple, you could start with a raw, block addressed chunk of flash memory, make your own format up, and pre-erase it, sort of like formatting a digital tape. You will at this point have only channels and a starting block for each recording, or maybe just one recording per piece of media starting at zero. From this, you could 'write the zeros' in and pretty menially write audio sample data directly to flash. However, you still need to do the basic SPI extraction from the ADC, assemble the data into a block, or at least a stream, and then use SPI to tell the flash to write your block to the chosen address. AFAIK, there is no auto-magic way to just connect the ADC and flash to the same SPI bus and watch the two record. You need a third thing to act as a SPI master to alternately drive the ADC and then the flash.

I could be wrong though, so if you can get it to work the way you propose, it'd be interesting to hear about the details!
 
Monte McGuire said:
So, there's no stream of samples pouring out of an ADC via SPI to be blindly stuffed into memory
Actually it looks like that is pretty much how they work. I just scanned over datasheets for TI PCM4420 and Cirrus CS5340. My initial impression is that these chips are the clock master (this is optional but for the purposes of this discussion one would be the clock master). So you just setup the chip, initialize some registers, take it out of reset and then samples start pouring out. Normally a separate DSP micro would be listening to this and deciphering the frames which are in various formats but both of these chips use a LRCK or "left/right clock" that switches the SPI output between samples from the left channel versus samples for the right channel that are time aligned (meaning when LRCK is high the data is for L and when low the data is for R). There is also TDM format which is basically an extension of LRCK in that multiple streams are encoded into frames.

So recording / playing raw LRCK / TDM data into / from flash could be problematic since the data is effectively coded into two data streams (the LRCK indicates which channel the data is L or R and TDM has a similar FSYNC to indicate the beginning of a frame) on different pins. Short of using multiple separate flash chips I don't see how it's possible.

And because one of the ADCs would be the master digital audio clock, the uC could not act on what it sees in the stream because you cannot stop at some clock cycle, do something else and then resume the data (such as to separate channel data).
 
So to bring this thread back down to my neophyte understanding....will the new RPi have the bandwidth to be able to record 8 mono 44/16 .wav files onto a thumb drive? 
 
The newest RPi3 is still hampered by the same problem:

All data from/to USB, Ethernet and the SD card pass over the same USB2 bus.

It might work with 8 channels, but there's no guarantee.  If you could use ISP to get the audio data to the bus, it stands a fair chance of working.

If you try to pull the data off USB and send it to the SD card, it will probably not be very reliable.

Someone in Germany reverse-engineered Dante on an RPi3, but he's only doing 2 in, 2 out. There are plans for more channels, on different hardware.

Over the years, I've seen several 8 channel HAT's for the RPi. None of them lasted long. I have no idea why. Market too small? Technical problems? Chips supply?
 
Another option is to use one of the integrated chips or "audio processors".

For example, AD1940 is the sort of chip that might be right for this job. In practice a recorder should be able to record and play tracks simultaneously so that you can "bounce" tracks and overdub. And you need to be able to monitor or listen to the results mixed. If the chip has a DSP it can do the mixing. The AD1940 does not include ADCs / DACs but it understands the aforementioned TDM streams so I actually like that the ADCs / DACs are separate but easily integrated. Analog Devices seems to have a grip on this part of the market. If I were doing this I might play with one of their SigmaDSP evaluation boards and maybe ask questions on an analog.com forum.
 
squarewave said:
Another option is to use one of the integrated chips or "audio processors".

For example, AD1940 is the sort of chip that might be right for this job. In practice a recorder should be able to record and play tracks simultaneously so that you can "bounce" tracks and overdub. And you need to be able to monitor or listen to the results mixed. If the chip has a DSP it can do the mixing. The AD1940 does not include ADCs / DACs but it understands the aforementioned TDM streams so I actually like that the ADCs / DACs are separate but easily integrated. Analog Devices seems to have a grip on this part of the market. If I were doing this I might play with one of their SigmaDSP evaluation boards and maybe ask questions on an analog.com forum.

I don't need to playback, or monitor.  This is literally only to record 8 mono signals onto a thumbdrive.  That's it.  For my need I do not need more functionality.
 

Latest posts

Back
Top