- ticesnd: USB Audio library for TI-84+ CE
- 29 Oct 2018 01:25:30 am
- Last edited by JackMacWindows on 01 Nov 2018 06:55:45 pm; edited 2 times in total
I have created a USB sound card system for the TI-84+ CE that uses the serial drivers to communicate with an Arduino. It supports sending square wave tones as well as PCM audio samples. To send frequencies, the calculator simply sends 0xFF and then a 16-bit value (little endian) that specifies the frequency, and the Arduino plays it until the next tone is sent. Sending a frequency of 0 stops the audio.
To send PCM audio, the calculator sends 0xFFFEFE, which triggers it to switch to PCM mode. It will then send a 0 to get a sync signal. Once the sync is received the audio data stream is sent, though it will have to be regulated on the calculator. You must send over only unsigned 8-bit audio at 8000 Hz, as this is what the Arduino is expecting.
To use this, you will need a TI-84+ CE (obviously), an Arduino (I used an Uno but others should work), some sort of speaker you can plug into the Arduino, a USB power supply to plug into the Arduino headers (I used a USB->Serial adapter which provides 5v), and a USB OTG cable to connect the Arduino to the calculator. You can get the source code here: https://github.com/MCJack123/ticesnd.
To run one of the examples, cd to the example, make, and send to the calculator. Next, copy the contents of src/arduino/soundcard.c into a new Arduino sketch and send the sketch to the Arduino. Lastly, connect the speaker to pins 11 & ground, the calculator USB into the Arduino USB, and a 5v power source into Vin/ground or a 9v power supply to the power in jack (if applicable) on the Arduino (required as the calculator doesn't supply enough current). You can use playTone(tone, length) in your own programs to play sound. You can also play PCM audio by running switchToPCM() and then sendPCMAudio(data, size). I hope to turn this into a full audio player in the future.
See README.md on GitHub for more information on how to use the library.
Here is the demo program playing "Mary Had A Little Lamb" with the tone mode:
Also, here is a PCM demo with the first 8 seconds of the Portal radio loop:
To send PCM audio, the calculator sends 0xFFFEFE, which triggers it to switch to PCM mode. It will then send a 0 to get a sync signal. Once the sync is received the audio data stream is sent, though it will have to be regulated on the calculator. You must send over only unsigned 8-bit audio at 8000 Hz, as this is what the Arduino is expecting.
To use this, you will need a TI-84+ CE (obviously), an Arduino (I used an Uno but others should work), some sort of speaker you can plug into the Arduino, a USB power supply to plug into the Arduino headers (I used a USB->Serial adapter which provides 5v), and a USB OTG cable to connect the Arduino to the calculator. You can get the source code here: https://github.com/MCJack123/ticesnd.
To run one of the examples, cd to the example, make, and send to the calculator. Next, copy the contents of src/arduino/soundcard.c into a new Arduino sketch and send the sketch to the Arduino. Lastly, connect the speaker to pins 11 & ground, the calculator USB into the Arduino USB, and a 5v power source into Vin/ground or a 9v power supply to the power in jack (if applicable) on the Arduino (required as the calculator doesn't supply enough current). You can use playTone(tone, length) in your own programs to play sound. You can also play PCM audio by running switchToPCM() and then sendPCMAudio(data, size). I hope to turn this into a full audio player in the future.
See README.md on GitHub for more information on how to use the library.
Here is the demo program playing "Mary Had A Little Lamb" with the tone mode:
Also, here is a PCM demo with the first 8 seconds of the Portal radio loop: