Showing posts with label Hardware. Show all posts
Showing posts with label Hardware. Show all posts

Friday, December 24, 2010

How to write an emulator?

Well i was just thinking to write a NES emulator since 2008 but that time i could not start due to my game engine. But now after learning these tutorials i must say anyone can make emulators who understands Microprocessors.

Please go through these tutorials to learn emulation. The tutorial is well written, small and very understandable. I will also write tutorials the way i feel simple once i do my NSF player.

Link: http://codeslinger.co.uk/pages/blog/wordpress/

Thursday, January 15, 2009

Output audio through serial port. Serial Port Player v0.1

Serial port player – serialplayer
This software lets us play audio through serial port.
Hardware requirement: (below values are for USB-to-serial chip)

  • female com port connector

  • resistors - 1k

  • capacitors 4.4 uF
For laptop, i used this hardware:-

  • USB serial converter. I am using Nokia 6600 pc data cable. Which is nothing but a prolific PL2303 usb-to-serial chip with cable utilizing only its TX, RX and GND pins.
Software requirement:

  • A Linux distro with gcc (GNU's compiler collection) for source compilation.

  • serialportplayer – binary OR source code.
[Illustration of project]
Raw audio data => serialportplayer => serial port => low pass filter => speaker(s).
Processing:
The software collects raw audio data and processes it according to serial port data transfer speed. The processed data is then output through serial port's TX pin. The processing includes oversampling and modulation (sigma-delta is recommended but current version of program doesn't uses it purely).
Raw data:
The data is raw audio. This raw audio data is extracted from audio files using audacity software as -

  • Run audacity

  • Open any audio file

  • Export that file into raw format.

  • the raw format must be :- unsigned 8 bit / sample, mono(1channel).
Please note down the samplerate of the original audio file and use it during serial play.
Using serialportplayer:

  • start your shell – e.g. Konsole, xterm

  • execute su command and give root's password.

  • Run serial port player as:- ./tplay OR ./serialportplayer

  • e.g. ./tplay humdum.raw 16000
if your system can't run the binary you can compile it from source:
cc –o serialplayer serialplayer.c
The following where the sources using which i accomplished the project:
Any interested person must read about 1 bit audio and sigma-delta modulation.
Please connect 1k resistor to TX pin and capacitor in parallel to TX and GND pins. These values are for USB-to-Serial adapter. Use appropriate values for normal serial port at back of desktop pcs.

Download link: This link has tplay source and binary of ttyUSB, it uses USB-to-Serial device as serial port.

Download :serialportplayer.rar
Password: serialportplayer_homelabs