Skip to content

Instantly share code, notes, and snippets.

View HajimeKawahara's full-sized avatar
😀

Hajime Kawahara HajimeKawahara

😀
View GitHub Profile
@HajimeKawahara
HajimeKawahara / interpolation_test.ipynb
Last active January 8, 2016 04:42
example of interpolation for Julia
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@HajimeKawahara
HajimeKawahara / complex_arrays.ipynb
Last active January 4, 2016 14:54
complex array
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@HajimeKawahara
HajimeKawahara / 0-indexing to 1-indexing.ipynb
Last active January 4, 2016 14:55
0 based and 1 based indexings
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@HajimeKawahara
HajimeKawahara / gcc.py
Created January 4, 2016 14:13
generalized Coltrane Changes
#!/usr/bin/python
import argparse
import numpy as np
import sound_driver as sd
import pyaudio
import wave
def generalized_coltrane_change(n,n0,t,nsamp=12):
sg={0:"C",1:"Db",2:"D",3:"Eb",4:"E",5:"F",6:"Gb",7:"G",8:"Ab",9:"A",10:"Bb",11:"B"}
print "GCC: for","n_k=",n,"and","t_k=",t
@HajimeKawahara
HajimeKawahara / sound_driver.py
Last active January 4, 2016 14:16
sound_driver for GCC
#!/usr/bin/python
import numpy as np
import pyaudio
import sys
import matplotlib
import matplotlib.pyplot as plt
import pylab
def harmony(freq, length, rate, tone):
samp=(2*np.pi)*freq/rate
@HajimeKawahara
HajimeKawahara / testf.f90
Created January 5, 2016 07:43
module for a simple julia wrapper of fortran90
module testf
contains
subroutine printint(i)
implicit none
integer, intent(in) :: i
write(*,*) i
end subroutine printint
end module testf
@HajimeKawahara
HajimeKawahara / wrap_ftest.jl
Created January 5, 2016 07:44
simple julia wrapper of fortran 90
#simple julia wrapper of fortran 90 subroutine printint in testf module
function calltestf(ia)
ia = Int32[ia]
product = ccall((:__testf_MOD_printint, "testf.so"),Int32,(Ptr{Int32},),ia)
return product
end
calltestf(7)
@HajimeKawahara
HajimeKawahara / gist:4746a7bdfe9dbb68e417
Last active January 5, 2016 08:37
simple interface of f90->jl for in,out
function call_ioint(ia)
ia = Int32[ia]
ib = Int32[0]
product = ccall((:__testf_MOD_ioint, "testf.so"),Int32,(Ptr{Int32},Ptr{Int32}),ia,ib)
println(ia)
println(ib)
return product
end
@HajimeKawahara
HajimeKawahara / gist:4700e7b1e40ce21ae76f
Last active January 5, 2016 08:37
example 2 for f90->jl
subroutine ioint(i,j)
implicit none
integer, intent(in) :: i
integer, intent(out) :: j
j=i+3
end subroutine ioint