BMOW title
Floppy Emu banner

Mozart’s Credit Card

Mozart's Credit CardNot long ago, I picked up an old point-of-sale terminal at an electronics surplus store. After discovering a cool little Z-80 based computer inside, and reverse-engineering the hardware, I decided to reprogram it to unlock the music hidden inside magnetic stripe cards. I call this wonder Mozart’s Credit Card.

The hardware is a Tranz 330 POS terminal from VeriFone, dating from the 1980’s. The 330 and its cousins are great for electronics tinkerers. They’re self-contained 8-bit computers with lots of intersting I/O interfaces, and retro-style vacuum-fluorescent displays. They use the same microprocessor as the TRS-80 and ZX Spectrum, so handy software routines from those computers can be reused. The terminals are commonly available from surplus stores or eBay for around $10.

Documentation for the 330 is readily available online, but it only addresses how to use the POS features, with very little hardware information. The Z-80, its support chips, and the other components like the display driver and real-time clock are all well-documented, but to use them, it was necessary to reverse-engineer the terminal’s hardware design. I needed to know how the I/O interfaces were mapped into the address space, which chips were connected to which port pins, and what timing and communication protocol requirements existed. Through a combination of tracking the signal traces by “beeping out” the board, and examining the disassembly of the POS software in the terminal’s ROM, I was able to learn what I needed. I’ll be posting lots more techincal data about the Tranz 330 soon in a separate post, so anyone with one of these little wonder-boxes can reprogram them for creative new purposes.

After due consideration (and a couple of beers), I decided to make a demo that reads data from magnetic stripe cards, and uses it to play music. What song does your Visa play? How about your driver’s license? Ooh, that library card’s got a nice rhythm. Check the video to see Mozart’s Credit Card in action:

Mozart’s Credit Card is a custom program written in Z-80 assembly language. I burned the program to a Flash ROM, and swapped the new ROM for the terminal’s original ROM. Fortunately the 330’s ROM is in a socket, making replacement easy. When a card is swiped, the card reader returns the ISO 7813 Track 2 data, which is up to 40 BCD characters, with 4 data bits and 1 parity bit per character. The raw data uses F2F encoding, in which all bit intervals are the same duration, but a logical 1 has a low-to-high or high-to-low transition during the bit interval, and a logical 0 has the same polarity during the whole bit interval. This F2F signal must be converted into binary data in software.

Once the card data has been read, a rule-based system is used to turn it into semi-acceptable music. Converting the card digits directly to notes only generates random beeping, so a more complex system based on the ideas from the Melisma Stochastic Melody Generator was used. The Mozart music engine generates random melodies with a given key, mode, length, tempo, interval size range, and other parameters from music theory. The parameters are used to construct a set of probability tables, which are then multiplied to construct the final table used to randomly select the next note.

The choice of major or minor mode is determined by the card’s year of expiration. If the card expires soon, it plays a minor melody – spooky! The key – F, B-flat, whatever – is determined by the month of expiration. There are twelve months in a year, and twelve semi-tones in an octave, so it was a perfect fit. The number of data bytes on the card determines how many measures of music are played. A credit card will play a longer melody than a grocery club card. The tempo, rhythm, interval sizes, and actual notes come from a random number generator, whose seed is the card’s account number.

Post your ideas for Mozart improvements in the comments. Thanks!

Read 9 comments and join the conversation 

9 Comments so far

  1. Joe - May 6th, 2011 6:10 pm

    Hello again Steve fantastic work, I wouldn’t call it pointless, I wish I had thought of it!!!

    I like how you exploited the monthssemitones, quite clever. I no doubt would have missed that and not just re-invented the wheel, but the ground to go with it!

    I think you did an excellent job with both the project itself and the demonstration. You clearly explained the concept so, while others may not have the code, the idea is out there now in the ether. Who knows, you may have just salted inspiration for the next evolution of music.

    Such a simple concept that shows the flexibility of the 330, I bet the designers never had that in mind when they made it.

    Ideas to improve Mozart:
    Take the date relationship further by exploiting the on-board RTC!

    The program could check the RTC and see what date it is and then ‘manipulate’ some aspect of the playback algorithm or the note data itself.

    Special days (holiday, birthday, etc) could have a specific song it plays but using the note data from the card. (I think this one could be really fun)

    Heck, on Opposite Day (April 27th) play everything backwards (or just endian swap note data, that will mess with them)

    I am starting to ramble so I best end here. Again, glorious idea, thank you ever so much for sharing.

    Supreme respect,

  2. Jonno - May 8th, 2011 12:22 am

    most excellent, dude.

    My suggestion is – use the modem to add a rhythm track.

  3. […] was browsing around at a local electronics surplus store when he spotted an old Tranz 330 point-of-sale terminal that seemed pretty interesting. He took it home and after disassembling it, found that it contained a Z-80 based computer. Because […]

  4. DIY Credit Card Reader Mozart Music Maker! - May 8th, 2011 8:37 am

    […] Chamberlin has created an awesome DIY credit card reader that plays mozart music when you swipe any kind of credit card. He reverse engineered the Z-80 […]

  5. Johannes - May 8th, 2011 12:32 pm

    Wow this is incredible, this is just the kind of hacks i love 🙂

  6. Steve - May 8th, 2011 9:26 pm

    Thanks for all the feedback! I’m going to tie off a few loose ends, then post all the technical info I’ve collected on the Tranz 330.

  7. bill williams - October 26th, 2011 8:38 am

    Is there a data logger to connect to this terminal i need to back up credit card dat in case of power outage! Please respond in desperate need of information

  8. Per Jensen - December 15th, 2012 1:08 am

    Hi. Great project there! Fortunately i’ve come across a Tranz 330 with attached PrintPak 300 printer, and i’d like to reprogram the 330 with your Mozart program to amuse visitors at the local hackerspace ( – But i cannot seem to find a .HEX or .BIN file anywhere on your website. I have access to old fashion Eprom’s and Eprom programmer, so if you could share the file for the Eprom, that would be sweet! – Thanks for sharing this amazing idea of repurposing the 330! – TIA, Per.

  9. Steve Allen - June 4th, 2014 5:31 am

    FanTasTic job, this is pure genius. Looking for a Tranz 330 and joining the “Band Wagon”. Thank you for posting all the information that you gathered. Wow that’s a ton of research you did. Would it be impossible to emulate a TRS-80 with this critter? Run a rough Basic program?
    I’ll be in the basement making room for the “New” best Thing EVER —
    Thanks Steve

Leave a reply. For customer support issues, please use the Customer Support link instead of writing comments.