FFT for the AMIGA through ksh88 shell.


 
Thread Tools Search this Thread
Operating Systems OS X (Apple) FFT for the AMIGA through ksh88 shell.
# 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-fftjpeg
This User Gave Thanks to wisecracker For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. OS X (Apple)

Slow FFT in ksh93 and awk.

Well i set myself a challenge to have an FFT function using nothing but ksh93 and awk. It took some serious jiggery pokery and concentration with all the brackets and '$' characters but here is the result. It is RADIX 2 only, but hey, show me another UNIX shell script that does it. It IS SLOW but... (17 Replies)
Discussion started by: wisecracker
17 Replies

2. OS X (Apple)

FFT for Python 2.0.x to 3.7.0.

Hi guys... This is code that was originally designed to work on an upgraded AMIGA A1200 using Python 2.0.x. Unfortunately it broke inside much later versions, NOT because of the print statement/function but other minor subtleties. So this is the final result tested on various machines including... (0 Replies)
Discussion started by: wisecracker
0 Replies

3. News, Links, Events and Announcements

GCC for tha AMIGA...

Hi guys... For the AMIGA fans out there... Not sure if this is the right forum but someone has done a successful working port of gcc for the classic AMIGA A1200. It contains a very large subset of *NIX commands and now AMIGA fanatics like me can include another platform, within the... (0 Replies)
Discussion started by: wisecracker
0 Replies

4. Shell Programming and Scripting

FTP script in ksh88

Hi I tried the following code to FTP the files from test server to dev #!/bin/ksh DST=/home/files cd $DST ftp -inv 'test_serv101' << EOF quote USER test quote PASS test # File Path on test server cd /etc/home/Or_Files ascii mget curMonth* $DST quit EOF when i try the above code it... (4 Replies)
Discussion started by: smile689
4 Replies

5. Shell Programming and Scripting

Comparing Strings in ksh88

Hi I tried the following string comparison script in Ksh88 #!/bin/ksh str1='aC' str2='ABC' if then echo "Equal" else echo "Not Equal" fi Though str1 and str2 are not equal the script output says Equal . Please correct me Thanks (2 Replies)
Discussion started by: smile689
2 Replies

6. Shell Programming and Scripting

namerefs alternative for KSH88

I have to use KSH88, so going to BASH, perl etc. is not an option. Below is a much simplified verison of what I am doing (aka ignore my cut command and i not increasing) :) i=1 BIGSTRING="one two three four five six seven eight" while ]; do typeset "STRING$i=`echo $BIGSTRING| cut -d' '... (8 Replies)
Discussion started by: nitrobass24
8 Replies

7. Shell Programming and Scripting

Download AT&T ksh88 ?

Hello, I need ksh88 for my linux system - and I don't want pdksh. Possible to get original ksh 88 binaries or source ? (I don't need ksh93 which is available) thanks Vilius (1 Reply)
Discussion started by: vilius
1 Replies

8. Shell Programming and Scripting

Substring in ksh88 ?

Hello, ksh88 doesn't support ${var:x:y}. Any alternatives to get substring ? thanks Vilius (2 Replies)
Discussion started by: vilius
2 Replies

9. Shell Programming and Scripting

ksh88 or ksh93

Hi all! Does anybody know how can I check if any UNIX installation has implemented ksh88 or ksh93? Thanks in advance. Néstor. (3 Replies)
Discussion started by: Nestor
3 Replies

10. Shell Programming and Scripting

ksh88 - curses

I was wondering if there is anyway to use the curses library with ksh88. I saw Shell Curses function library which says I can use /usr/local/functions/shellcurses on ksh93 but I am on ksh88. I am on a HP-UX box. (0 Replies)
Discussion started by: IMTheNachoMan
0 Replies
Login or Register to Ask a Question