signal is nil after require
htoyryla opened this issue · 2 comments
htoyryla commented
Have installed with luarocks as described, install finished successfully. However in luajit
th>require "signal"
...
th> tf = signal.fft(a)
stdin:1: attempt to index global 'signal' (a nil value)
th> print(signal)
nil
Other modules work fine
th> require "audio"
th> print (audio)
table: 0x401638c0
th> a = audio.load("/home/hannu/nn-audio/own/y.wav")
th>
Luarocks show gives for signal:
$ luarocks show signal
signal scm-1 - A signal processing toolbox for Torch-7
A signal processing toolbox for Torch-7
License: RWTFPL
Homepage: https://github.com/soumith/torch-signal
Installed in: /home/hannu/torch/install
Modules:
libsignal (/home/hannu/torch/install/lib/lua/5.1/libsignal.so)
signal (/home/hannu/torch/install/share/lua/5.1/signal/init.lua)
signal.complex (/home/hannu/torch/install/share/lua/5.1/signal/complex.lua)
signal.convolution (/home/hannu/torch/install/share/lua/5.1/signal/convolution.lua)
signal.extramath (/home/hannu/torch/install/share/lua/5.1/signal/extramath.lua)
signal.ffi (/home/hannu/torch/install/share/lua/5.1/signal/ffi.lua)
signal.fft (/home/hannu/torch/install/share/lua/5.1/signal/fft.lua)
signal.wavelet (/home/hannu/torch/install/share/lua/5.1/signal/wavelet.lua)
Depends on:
cwrap
torch
paths
fftw3
htoyryla commented
After having a look at your test cases, I also tried the following, but signal is still nil.
th> require 'audio'
th> require 'image'
th> local signal = require 'signal'
th>
th> torch.setdefaulttensortype('torch.FloatTensor')
th>
th> inp = audio.samplevoice():float():squeeze()
th> print(#(inp))
417024
[torch.LongStorage of size 1]
th> stft = signal.stft(inp, 1024, 512, 'hamming')
stdin:1: attempt to index global 'signal' (a nil value)
htoyryla commented
Hmmm... when I run your test.lua from a file it works:
The problem was in how I was using it in luajit interactively.
signal = require("signal")
works fine. Sorry about this, I am not too familiar with lua etc yet.