Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 10 of 10

Thread: Request for Advice on a Maybe-Project (MP3 Player)

  1. #1
    Junior Member
    Join Date
    Nov 2020
    Posts
    6

    Request for Advice on a Maybe-Project (MP3 Player)

    Background: I love eBay "mini clip MP3 players", the ones with no display. Dirt cheap, simple, and effective... and if you use them right (it's not hard) they actually have a few advantages over the 2nd Gen iPod Shuffle that they're knockoffs of. But there's a few features I'd like to add, that aren't there.

    I also love my Rio500 player, being a retrotech kinda guy, but keeping a 20y/o device of that sort running is at this point a bit of a challenge...

    The Project: I also have a Teensy LC. I got it for use with the QMK keyboard firmware but AFAICT that particular featureset no longer works. I really don't have funds right now for additional hardware but I've got passives and a few eBay Arduino Pro Micros lying around... and a few other bits and bobs. I'd like to make a player if I can.

    Here's the featuresrt I'm looking for off-the-bat...

    - SD/MicroSD support via SPI, for -HC cards (-XC can wait)
    - Support for FAT32 filesystem, tracks play in alphabetical order by filename - symbols then numerals then A-Z; ID3 tags and non-MP3-format files ignored
    - On-Teensy MP3 Decoding. That's the doozy, I bet!
    - Simple PWM output. If it's genuinely easier to offload PWM gen to a 32u4 I don't mind, I have that.
    - Output via simple amp, something like an "LM386 + single big cap + trim pot" type circuit
    - The usual buttons for media control, a repeat-current-track mode, and a shuffle mode... playback automatically loops endlessly
    - Drives standard amplified speakers and standard headphones
    - Power via 3xAAA batteries, with a low-batt detection (I tend to buy Dollar Tree 'Sunbeam' cells for everything that doesn't have a motor in it somewhere... they aren't alkaline*)
    - Simple LEDs for power (blink for playback, maybe bicolor for power/playback/error, eg steady green for on-but-paused, blinking green for playing, steady red for no/unreadable/blank card, blinking red for all files corrupt/unreadable/non-MP3) and for a Low Batt alert.

    Future Expansion Ideas: I'd ultimately like to add a character LCD -- or one of those tiny SPI TFT things -- and folder support, along with corresponding new playback modes (repeat within folder, play through folder then stop, etc) and eventually folder-within-folder support for eg "Disc 1" "Disc 2" within albums. The aforementioned hint about SDXC support would go here as well USB drive support would be nice at some point as well. TBH, that's actually about it.

    Concerns and such: I generally have a fairly poor idea of what a given uC is capable of... and I'm uhm pretty bad with programming. The concepts I generally understand, abstractly, if the person talking uses the right words (most of the jargon lands me in r/whoosh!) but doing the actual coding... well... imagine someone learned BASIC on a C64C around the time Monkey Island first came out, and although they learned it pretty well and remember most of it (supposedly), they haven't written a line of code since. That's basically where I am. I can sort of read bash scripts and Arduino Sketches well enough to get a vaguely reasonable idea of what does what where, but so far I'm really barely half-decent at cobbling together disparate bits of code to do something (think Lego set) and writing something from scratch has me instantly lost. I'm better with hardware; I can kind of think in glue logic.

    I'm not saying "I can't" -- I'm saying, "I want you guys and gals to collectively hold my hand while I cannonball into the deep end, because I know I can do this (hardware willing lol) if I have a motivating and challenging, big, rewarding project and a bunch of community support -- and *only* then -- and this is a thing that's been bugging me about myself for literally years."

    Besides, I've done this sort of thing before. When I was ten, Mom handed me a textbook Cambridge University had published in the 1970s (this was about 1997 or so) for a one-semester introductory Latin course, immersion-style... I hit the back cover three weeks later and was quite capable at that point of writing decent one-page short stories.

    The $6,000,000.00 Question: Can I do this with the Teensy LC, and can you folks help me do it?

    * TBH if I had to guess what's inside... sawdust, spit, and bits of rust. The metal they use for the housing can is so thin it dents when you squeeze it! They *do* put electrons in there, the things are great for eg LED flashlights, but the one time I dropped a pair in my electric toothbrush to see how they'd do (Crest Spinbrush, just FTR) it just all went kind of sad.

  2. #2
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    7,065
    The problem is, the Teensy LC has not enough RAM to decode MP3. You'll need a Teensy 3.2 minimum, or an external decoder chip.

  3. #3
    Junior Member
    Join Date
    Nov 2020
    Posts
    6
    OK, fair... 8k does sound a bit low! (I hadn't looked.)) I remember one Arduino project I *did* get working (and then never used, and recently began dismantling) was a thing called a Zorkduino, and part of the way the dude who worked that out, did so in ~2k of memory when the Z-Machine emulator alone required about twice that, was to implement a pagefile on the SD card.

    Obviously MP3s and text adventures are very very different things, but is SPI-type SD card access fast enough for this application?

  4. #4
    Junior Member
    Join Date
    Nov 2020
    Posts
    6
    Sorry for 2nd post in a row ("double post")... but I meant to mention, you posted literally about 5sec after I checked wondering if I'd gotten any replies... and saw there weren't any yet.

  5. #5
    Junior Member
    Join Date
    Nov 2020
    Posts
    6
    3rd post in a row... sorry again, I'll stop and wait after this, I promise!

    Is it OK to discuss multiple potential projects in a thread, here, that are only related because they involve Teensies? Because I have another project that I'm about 90% certain would be PERFECT for a Teensy 4.1 and I'm kind of looking for an excuse to get one, and if it's not stupidly overpowered for this (particularly including the "maybe later" stuff) in the sense of using a RasPi Zero W where an Arduino Nano would've been fine -- heck, I'll buy two and do both.

  6. #6
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    7,065
    Sd is not fast enough to buffer the RAM while decoding MP3.
    Maybe you can add a RAM Chip, but this would require to rewrite much of the MP3/AAC code. Its not worth to try that...
    Go for a Teensy - best with inbuilt SD Slot.
    You'll need a cheap Audio-DAC, too.
    Teensy 4.1 is perfect.

  7. #7
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    7,065
    T41 is nearly as fast as the RasPi. But don't has the OS overhead.

  8. #8
    Junior Member
    Join Date
    Nov 2020
    Posts
    6
    Well the other project is a homemade portable word processor... something in between eg one of the higher-end Smith Corona portable jobs and an early laptop, eg my Toshiba T3400CT, dedicated by its owner to like Word 95 or something. I don't need color, but I do need proper WP and not just a text editor. Something on the level of WordPad, and with an equally common file format (F|OSS is good but I'm not militantly vehement about it or anything, so RTF works if MS isn't gonna sue me for thinking about it lol... some companies will, some won't, I dunno where they fall exactly...) would suffice. IDK what I can run on a 600MHz ARM box that can't MMU, except Not Linux (I've been told that quite loudly, although I still don't see why just simply hardcoding a quantity of RAM in there and telling it how to address the stuff wouldn't suffice to deal with the foundations of the usual problems cited about that) but I have a 7in SVGA LCD out of a horrible tablet, it's got a fairly standard parallel interface... if that's too much, I have a *very* old LCD in the closet that a pal of mine worked out how to control, it's from an era when that stuff's all shift registers and whatnot. It's one of two I have that are really weird, really old monochrome LCDs... this is the one that's physically 640x240 but logically 1280x120, not kidding. The other is literally from a Smith Corona PWP and the same dude figured out how to drive it without the originally-intended chip for that, some absolutely ancient Sanyo thing, it's 640x400 but it's a DSTN so it's two 640x200 screens somehow.

    I also have two plasma panels and an EL LCD, all 640x400, all DSTN-style (aka "flat panel protocol" i.e. 1bpp, 8 bits per Pixel-Clock strobe (for the current line and the current+200 line), and you need HSync VSync and PxClk signals brought out... except one of the plasma panels has an undocumented pinout because it's from a vintage Compaq that can't be fixed and the other uses a very slight modification of that scheme where it doesn't split the screen in half, it's one 640x400 screen not two 640x200 screens and it knows it lol -- so it only takes four bits per strobe, period.

    ...but, yeah, any of those, a PS/2 or USB keyboard (I have both!) and support for a FAT32 USB drive with minimal disk ops (save/load/rename, reject wrong-format-files) would be great. Thinking a bit grandiosely... lol... if there's need for minimal mouse support, I have the PERFECT PS/2 keyboard, not kidding, it's an IBM M13. Something that was reasonably close to a standalone LibreOffice Writer would be *AMAZING*, especially if it could save in Word97/etc *.doc format, which is (like it or not) my preference... mostly because familiar and trusted... you know, the whole tested-known-good thing That and the EL display, I have the datasheet for it... attached.
    Attached Files Attached Files

  9. #9
    Senior Member+ MichaelMeissner's Avatar
    Join Date
    Nov 2012
    Location
    Ayer Massachussetts
    Posts
    3,883
    While the Teensy-LC is underpowered for MP3 decoding, it should be powerful enough to connect to one of the external MP3 players, to provide the interface etc. For example, dfrobot came up with a product called 'dfplayer', that either can be hooked to simple buttons, or it can be hooked to a serial port for more control. It also includes an amplifier so you can hook up a single speaker directly, or if you want stereo output, you can hook up headphones or speakers (you will need amplifiers for the stereo speakers):



    Note, there are now various clone versions of 'dfplayer' out there. Some work, perhaps some do not.

  10. #10
    Junior Member
    Join Date
    Nov 2020
    Posts
    6
    OK fair. But I'd just drop an eBay Arduino Pro Micro on top of that... the Hackaday comments will tell me to get a 555 Timer and they will (for once) almost have a point... actually, I could literally do it with a 6502 type setup (remember the retrotech thing? )... I might do that, I've been meaning to learn it as well.

    Probably better if the other Teensy project I mentioned waited a bit, that's kind of advanced, isn't it...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •