Unix/Linux Go Back    


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.

OS X (Apple)


Reply    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 1 Week Ago   -   Original Discussion by wisecracker
wisecracker's Unix or Linux Image
wisecracker wisecracker is offline
Registered User
 
Join Date: Jan 2013
Last Activity: 13 November 2017, 2:52 PM EST
Location: Loughborough
Posts: 1,224
Thanks: 367
Thanked 323 Times in 253 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...
Attached Thumbnails
FFT for the AMIGA through ksh88 shell.-fs-uae-fft-jpeg  
Sponsored Links
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux 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 09:23 AM
FTP script in ksh88 smile689 Shell Programming and Scripting 4 07-07-2013 09:28 AM
Substring in ksh88 ? vilius Shell Programming and Scripting 2 01-29-2010 04:58 AM
ksh88 or ksh93 Nestor Shell Programming and Scripting 3 03-13-2009 11:33 AM
ksh88 - curses IMTheNachoMan Shell Programming and Scripting 0 05-05-2008 12:18 PM



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