Color Computer cassette port Input used as game controller
I've begun experimenting with using the Color Computer cassette port as a game controller input. The idea is based on the late, great Steve Bjork's Audio Spectrum Analyzer (1981). First of all, a big shout-out goes to Chet Simpson for his work disassembling and posting the code with notes on GitHub (CoCo-AudioSpectrumAnalyzer). Thanks Chet.
I reduced the code to a subroutine that can be used to sample the cassette audio input, measure the width of the frequency, compare to a table and return a frequency value.
The following demo is an example of how I envision using this subroutine:
Inspiration for the Speed Racer demo: Speed Racer - Button Tutorial
Examples of an electric keyboard, instead of the phone APP, being used as sound inputs:
I wrote the APP in Swift on Xcode (https://developer.apple.com/xcode/). Xcode is a free to download from Apple. You can develop an APP and 'test' it on your phone without having to upload it to the Appstore and go thru all of the Apple requirements. Warning, Xcode is huge.
Being that I am not a seasoned Swift programmer, I took advantage of the imbedded GPT-5 to develop most of the code. For example, I asked GPT-5 to "make an APP that outputs sound tones (200 hz and 800 hz) when the phone is tilted left and right"
My setup:
CoCo1
iPhone 13
APP written on Xcode 26.1.1
Lightning to 3.5mm Earphone adapter
APP written on Xcode 26.1.1
Lightning to 3.5mm Earphone adapter
For the Demo, I used three frequency ranges to control the car:
< 200 hz: Move Left
> 200 hz and < 400 hz: Jump
> 800 hz: Move Right
The general idea is that this input type could allow for many discrete inputs, like the ~15 different frequencies displayed on the Audio Spectrum Analyzer.
For example, the basic strategy of using the 'SampleAudio' subroutine in the Speed Racer demo is: (See demo code for the DAC setup and constants/variables required- DM or email me for a copy).
For example, the basic strategy of using the 'SampleAudio' subroutine in the Speed Racer demo is: (See demo code for the DAC setup and constants/variables required- DM or email me for a copy).
JSR SampleAudio ; Call subroutine to Sample Freq's
LDD FREQMEASURED ; Load returned Freq Measured
CMPD #$009B ; Compare to 200hz (address in PulseWidthTable)
BLO > ; Skip if > 200hz (lower # on Table)
LBRA MOVELFTSR ; Bra to Move Car Left
PulseWidthTable FDB $03D1 ; C093: - 31.5hz
FDB $02F8 ; C095: - 40hz
FDB $026D ; C097: - 50hz
FDB $01E8 ; C099: - 63hz
FDB $017C ; C09B: - 80hz
FDB $0136 ; C09D: - 100hz
FDB $00F4 ; C09F: - 125hz
FDB $00BE ; C0A1: - 160hz
FDB $009B ; C0A3: - 200hz
FDB $007A ; C0A5: - 250hz
FDB $005F ; C0A7: - 315hz
FDB $004D ; C0A9: - 400hz
FDB $003D ; C0AB: - 500hz
FDB $002F ; C0AD: - 630hz
FDB $0026 ; C0AF: - 800hz
FDB $001E ; C0B1: - 1000hz
FDB $0017 ; C0B3: - 1250hz
FDB $0013 ; C0B5: - 1600hz
FDB $000F ; C0B7: - 2000hz
FDB $000B ; C0B9: - 2500hz
FDB $0009 ; C0BB: - 3150hz
FDB $0007 ; C0BD: - 4000hz
FDB $0005 ; C0BF: - 5000hz
FDB $0004 ; C0C1: - 6300hz
FDB $0003 ; C0C3: - 8000hz
FDB $0002 ; C0C5: - 10000hz
FDB $0001 ; C0C7: - 12500hz
Comments
Post a Comment