Home Man
Search
Today's Posts
Register

OS X is a line of Unix-based graphical operating systems developed, marketed, and sold by Apple.

FFT for the AMIGA through ksh88 shell.

Tags
amiga, fft, ksh88, oscilloscope, osx

Login to Reply

 
Thread Tools Search this Thread
# 1  
Old 11-10-2017
FFT for the AMIGA through ksh88 shell.

I don't know if anyone is interested but I have been meddling with FFT for the AMIGA.
(Sadly we AMIGAns don't have these luxuries through any scripting language.
Below is a Python snippet that uses the builtin 'cmath' module to work with the lowly
Python 2.0.1 for the AMIGA. It is part of a greater script that is a KSH shell script.

To get all of this working was not easy.

The image is OSX 10.13.0 running the AMIGA emulator, FS-UAE, booting into a window,
(purely for this upload, I normally use full-screen mode), of my A1200 setup. From the
default AMIGA shell, ADE, the UNIX emulator, is run up with KSH88 running on top of the
AMIGA shell. There is a KSH shell script launched that creates this Python code on the fly,
launches python and the code, and the spectrum of a 2 cycle, 64 sample square wave is
produced and then plotted to this window.

The Python code actually works on the default python 2.7.x in OSX 10.13.0 also but does
not work in Python 3.x.x at all as it was primarily aimed at Python 2.0.1.

Code:
# Python 2.0 (#1, Oct 29 2000, 23:53:20)  (SAS/C 6.x] on amiga
# Type "copyright", "credits" or "license" for more information.

# The line below is for progress info ONLY.
print("\033[23;1fNow running the Python FFT function...")

import sys
import cmath
def fft(DATA):
        N=len(DATA)
        if N<=1: return DATA
        EVEN=fft([DATA[K] for K in range(0,N,2)])
        ODD=fft([DATA[K] for K in range(1,N,2)])
        L=[EVEN[K]+cmath.exp(-2j*cmath.pi*K/N)*ODD[K] for K in range(N/2)]
        R=[EVEN[K]-cmath.exp(-2j*cmath.pi*K/N)*ODD[K] for K in range(N/2)]
        return L+R

FFT_LIST=[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,\
 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,\
 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.0,\
 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]

FFT=fft(FFT_LIST)
# print(FFT)
LENGTH=len(FFT)
STDOUT=sys.stdout
sys.stdout=open("DATA.txt", "w")
for FFT_LISTING in range(0,LENGTH,1): print("%i" % (int(abs(FFT[FFT_LISTING]))))
sys.stdout=STDOUT
sys.exit()

Have fun...
FFT for the AMIGA through ksh88 shell.-fs-uae-fft-jpeg  

The Following User Says Thank You to wisecracker For This Useful Post:
Neo (3 Weeks Ago)
Login to Reply

« Previous Thread | Next Thread »
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
GIF Anim of my AMIGA real Oscilloscope. wisecracker What is on Your Mind? 4 09-20-2016 05:13 PM
GCC for tha AMIGA... wisecracker News, Links, Events and Announcements 0 03-28-2015 08:23 AM
Ah, the AMIGA, (another poem I wrote in 2005). wisecracker What is on Your Mind? 0 07-24-2014 10:10 AM
FTP script in ksh88 smile689 Shell Programming and Scripting 4 07-07-2013 08:28 AM
Zip size is different though files are same in ksh88 smile689 Shell Programming and Scripting 1 07-03-2013 04:13 AM
A journey down memory lane - AMIGA... wisecracker What is on Your Mind? 2 01-15-2013 01:03 PM
Download AT&T ksh88 ? vilius Shell Programming and Scripting 1 01-30-2010 10:39 AM
Substring in ksh88 ? vilius Shell Programming and Scripting 2 01-29-2010 03:58 AM
ksh88 or ksh93 Nestor Shell Programming and Scripting 3 03-13-2009 10:33 AM
ksh88 - curses IMTheNachoMan Shell Programming and Scripting 0 05-05-2008 11:18 AM


All times are GMT -4. The time now is 11:07 AM.

Unix & Linux Forums Content Copyright©1993-2018. All Rights Reserved.
UNIX.COM Login
Username:
Password:  
Show Password