Raspberry Pi Pico with stereo sound!

As a rule the Console Mode editions of BBC BASIC do not support graphics or sound, but the Raspberry Pi Pico version is potentially an exception because with the addition of only half-a-dozen passive components it can output quite high quality stereo audio (alternatively, if you don't fancy soldering, the VGA Demo Board for the Pico comes pre-equipped with the audio output on a 3.5mm stereo jack).

I've recently been working on this, with a view to it being incorporated in the next release. Here's a YouTube video of Pico BBC BASIC running the widor.bbc program, as supplied with BBC BASIC for SDL 2.0:


  • Most impressive!

    I now have a Pico, but try as I might, I have no success in building my own stuff for it, even the example CMakeFiles need to be modified to get anywhere.

  • Soruk wrote: »
    I now have a Pico, but try as I might, I have no success in building my own stuff for it

    If you want to try out my sound features, I've updated the UF2 file downloadable from my web site to incorporate them.

    You should find that it's highly compatible with BBCSDL - it uses virtually the same code - and it has the *TEMPO, *VOICE and *STEREO commands exactly like BBCSDL too. The programs 'tocfugue.bbc' and 'widor.bbc' from any of the GUI editions will run with just the trivial omission of statements like *FONT.

    You can also play WAV files using the code below, although they need to be 16-bit stereo with a 16 kHz sampling rate:
       10 REM Set raw WAV mode:
       20 @flags% AND= &FFFFFF00
       40 B% = PAGE - &D00
       50 C% = (160 * 4 * 3) DIV 2
       60 D% = C% * 2
       70 F% = OPENIN("prague.wav")
       90 ON ERROR PROCsilence : PRINT REPORT$ " at line ";ERL : END
      110 REPEAT
      120   PTR#F% = 44
      130   WHILE NOT EOF#F%
      140     w$ = GET$#F% BY C%
      150     REPEAT UNTIL @hwo% >= D%
      160     SYS "memcpy", B%, PTR(w$), C%
      170     w$ = GET$#F% BY C%
      180     REPEAT UNTIL @hwo% < D%
      190     SYS "memcpy", B%+C%, PTR(w$), C%
      200   ENDWHILE
      210 UNTIL FALSE
      220 END
      240 DEF PROCsilence
      250 SYS "memset", B%, 0, D%
      260 *TEMPO 69
      270 ENDPROC
  • Here's another demo, this time of Scott Joplin's Ragtime classic 'The Entertainer'. This particularly illustrates the capabilities of BBC BASIC's ENVELOPE statement in simulating a piano-like sound, with Attack, Decay, Sustain and Release phases. The transcription for computer music was by Phil Wheeler and Tina Parkhouse in August 1982.

Sign In or Register to comment.