TinySDDA v1.0 - SDcard sector R/W + stereo music + sound effects in one cog and (almost) no Hub RAM

Wuerfel_21Wuerfel_21 Posts: 805
edited 2020-08-06 - 18:00:25 in Propeller 1
So here's another one of these somewhat under-cooked objects...

What it does:
- Allow sector-level access to the SD card (both SDSC and SDHC/SDXC should work, but the former hasn't been tested yet)
- Allow partial sector reads and writes (partial writes will overwrite the non-written part of the sector with $FF, not super useful)
- Play signed 16 bit stereo audio from the SD card on the "music channel"
- Play A-law compressed mono audio from the SD card on the "effect channel"
- Play either at up to ~48 kHZ or both together at up to ~32 kHZ (sample rate is specified at startup, failure to keep up is graceful)
- Emit """subcode""" data - the first long (=left/right sample pair) of every music block (256 bytes) is written to Hub - the bottom 8 bits of either sample can be replaced with data without too much distortion...

What it doesn't (yet?):
- Use more than 5 longs of Hub RAM after startup :)
- Any sort of file-system operation (I think I could hack some version of FSRW onto it... haven't tried yet)
- Play audio from fragmented files
- SD card initialization - the card needs to be ready in SPI mode at startup (I've seen some pure-Spin SD init code somewhere (some version of FSRW also?), might dig that up)
- Properly support cards larger than 512GB (SFX stored above that limit won't work right due to address overflow)
- HiFi sound - aside from the fair amount of sampling jitter, the low speed SD read seems to generate an unusual amount of background noise


NOTE: A new version (v1.0) has been released! Scroll down to find it!

I've attached threw up on MEGA the object and a quick demo I tossed together - load the provided audio files (and SDDAWR.txt) onto your SD card, push some keys on your serial terminal, be amazed.

(A ZIP without any example audio files has been attached, aswell)

Comments

  • Nice...got this working on a Quickstart w/HIB...not an audophile by any means, but it sounds good to me. The sfx playback is snappy too - holding down an sfx key for many seconds while the music is playing doesn't produce any perceivable choppiness in the music, the sfx repeats fast and doesn't have any "queuing" effect, where it keeps going after the key is released.
    Oh, btw...it seems to work fine on an old non-HD/XD (1GB) Sandisk card.

    Cheers
  • Wuerfel_21Wuerfel_21 Posts: 805
    edited 2020-08-02 - 00:33:24
    avsa242 wrote: »
    Nice...got this working on a Quickstart w/HIB...not an audophile by any means, but it sounds good to me.

    For me it's significantly quieter and noisier than the real good stuff (aka NCOWAV.spin as found in PropPlay)... Then again, my board has a kinda decent filter(with those pretentious gold audio grade capacitors), some of the Parallax boards... don't... not sure about the HIB


    avsa242 wrote: »
    The sfx playback is snappy too - holding down an sfx key for many seconds while the music is playing doesn't produce any perceivable choppiness in the music, the sfx repeats fast and doesn't have any "queuing" effect, where it keeps going after the key is released.
    It will catch the chops if you change the sample rate (last arg to sdda.start) to 44_100 and play sfx+music at the same time, if you want to witness that.
    avsa242 wrote: »
    Oh, btw...it seems to work fine on an old non-HD/XD (1GB) Sandisk card.
    Good to know
  • Wuerfel_21Wuerfel_21 Posts: 805
    edited 2020-08-06 - 17:58:03
    I think this object is now stable enough for a non-preview release, so here it is.

    The main changes:
    - SFX channel is now a bit louder
    - mono output is supported - just set the right pin to -1 and it will automagically patch itself to downmix the stereo audio to mono

    MEGA Download with example files
Sign In or Register to comment.