Join the discussion

Write your take first — we'll ask for email only when you're ready to publish.

  • Hacker News
  • Programmers made 8 bit micros talk in the 1970s, using nothing but square wave pulses sent to the speaker.
  • I am The Voice from Muse!
  • > I considered a few encoding options for compressing the audio.

    The presentation of this part seems extremely padded out to me, ironically enough.

  • I saw another audio project on the same microcontroller (family) posted a few days ago: ModPlayRISCV It plays a tracker MOD. using PWM with a low-pass filter. It resamples/scales all samples at varying rate/volume into a ring buffer which gets fed to the PWM comparator by DMA.

    https://github.com/cpldcpu/ModPlayRISCV

  • It would need to be ported, but the Talkie library for the AVR / STM / SAMD / ESP, with its roots dating back to the TI speak and spell toy, gets a phenome engine with a good vocabulary into less than 8k. It’s not musical though lol.

    The pwm on the CH32v003 is pretty similar to the STM32 implementation, so porting might not take much.

    It would be really cool to have phenome/text based vocabulary like talkie on that little chip! Since it uses text/phenomes it can have a large vocabulary for such a tiny chip. It would be possible to have about 1500 words in an 8k dictionary, 2k for code, and 4K for the phenome engine and still fit in the 16k of flash it comes with.

    Incidentally, there is another riscV from WCH that also features BLE, 200K+ of flash, and 18K of RAM in an ESSOP-10 package (same size as the SOP8 but only 4 GPIO). It’s around $0.41 in Q1. The vocabulary with that would be 20k plus words with 100k left for code lol.

    It’s just nuts what a dollar will get you these days in that space.

  • Could hang an i2c flash chip off that thing for more storage and still have enough IO pins for serial coms and a spare IO pin.
  • Interesting, though before clicking I thought the headline might be referring to a very poorly paid presentation about Marvel movies.
  • Ha, seconded. I hate how acronyms get repeated between domains. Makes for very confusing reading if you're not part of the in-group.
  • Even easier is the 1-bit DPCM codec used on the NES. Go up or down one step each sample depending on the next bit. You can't get a square wave out of it, only a triangle, but it has a nostalgic quality.
  • The NES DPCM runs at up to 33kHz, so it actually has double the bitrate of the 2-bit 8kHz encoding used in the article. If you run it at 16kHz to match the bitrate, it will sound much worse.
  • That would be just an integrator connected to a digital pulse signal ("square wave"), wouldn't it? Like https://tinyurl.com/28tcwwqc?
  • You should be able to do it all on-device, check out SAM, the Software Automatic Mouth. The actual data in the *_tabs files:

    https://github.com/ctoth/SAM/tree/master/src

  • The sound in the video seems more sophisticated than TTS. It seems more like the result of analyzing a clip of digital audio, and turning it into a series of TTS phonemes.

    Assuming SAM is a faithful port of the original, it converts text into phonemes according to a bunch of pronunciation rules.

  • Nice work. Especially referencing the TI prior art of the Speak and Spell. This kind of synthesis was quite prevalent in the early 80s - school BBC Micros had a ROM which let you "*SAY" a phrase. Classic Macs had MacinTalk.

    Another codec which might be interesting to try but is considerably more complicated is AMR, from GSM: https://en.wikipedia.org/wiki/Adaptive_Multi-Rate_audio_code...

  • This is great. Missed opportunity for a low-pass RC filter on the speaker circuit - if you know you're driving an 8kHz sample rate, you can design your filter with that cutoff, and it'll sound way better (it'll get rid of the buzzy quality).
  • This may be essential if you're connecting it to an audio amplifier. I learned this the hard way by burning out someone else's very expensive tweeters with 31.25kHz PWM.
  • It's probably worth mentioning the 2400bps (300 bytes per second) LPC10 codec built into SoX. If you have SoX installed, try

        rec -t lpc10 speech.lpc
    
    and then speaking into your microphone for ten or fifteen seconds before you ^C it. Then play it back with

        play speech.lpc
    
    It will sound very robotic but pretty comprehensible, at least with an adult male voice in English, and it preserves a lot of the prosody and enunciation that is so hard to get out of speech-synthesis packages.

    12KiB of data at 300 bytes per second would be 41 seconds of recorded speech.

    Decoding the LPC10 data on the CH32V003 might be tricky. On amd64, running `make CFLAGS=-Os` followed by `ld -r -o tmp.o *.o` inside sox-14.4.2+git20190427/lpc10 yields a tmp.o with 25243 bytes of text (including .rodata, etc.) and 356 bytes of data. I'm not optimistic that RISC-V would compress that to fit inside the CH32's flash. And I find the code in that directory inscrutable; it's Fortran that's been compiled to C.

    Still, it seems plausible that you could massage the LPC10 data into a format that something like Talkie would understand.

  • These CH32 mikrocontrollers are great and dirt cheap. I've build a small DC motor controller with them to control a toy robot: https://github.com/h0lad/MiniSpeedController

    The bigger ones have PHYs for USB HS, USB-C (5Gbps) and 10/100M Ethernet integrated (!). And their development environment (Mounriver Studio) isn't too bad - I didn't had the immediate urge to port everything to CMake/VSCode.

    But they need some kind of pin planning tool. It's awful to use the datasheet and find the correct pin functionalities and their mutual exclusions... STM32 mastered this with their STM32CubeIDE tool: select a feature (like USART1) and the right pins light up - alternate pins are easy to locate.

    They also should clean up their license mess on OpenWCH (their GitHub page). Lots (all?) of their HALs are Opensource - but the right version with right SPDX tags are often a bit hidden.

  • Can you change the polarity (direction) of the DC motors with this board?
  • The more recent MounRiver releases are so clearly VSCode with the serial numbers filed off.

    Older ones were Eclipse with the serial numbers filed off.

  • The pin mapping barrier was quite off-putting to me. However I've been tracking progress in the Zephyr RTOS project and the whole line is getting better support by the day
  • Nothing irks me more than "check out my neat-o PCB design" and there's no schematic.
  • A pin planner- without the code gen of STM32Cube- would be doable as a website.

    I made a basic one for the RP2350- https://rp2350b.pinout.xyz/

    Though STM32Cube has a very different approach, handles lots of mutually exclusive features and peripherals and a bunch of extra stuff for controlling code gen IIRC.