OS X (Apple)

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

FFT for the AMIGA through ksh88 shell.

👤 Login to reply

    #1  
Old 11-10-2017
wisecracker's Unix or Linux Image
wisecracker wisecracker is offline
Registered User
 
Join Date: Jan 2013
Last Activity: 21 July 2018, 12:14 AM EDT
Location: Loughborough
Posts: 1,296
Thanks: 388
Thanked 353 Times in 278 Posts
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  

Sponsored Links
👤 Login to reply

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
GCC for tha AMIGA... wisecracker News, Links, Events and Announcements 0 03-28-2015 08:23 AM
FTP script in ksh88 smile689 Shell Programming and Scripting 4 07-07-2013 08:28 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 01:20 PM.

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





Not a Forum Member?
Forgot Password?