I'm trying to get this lua package to work in mushclient so I can play musical tones, I copy the .dll to the mushclient folder, and try the scale.lua script, and it seems to error on the 'require' saying it can't find the module.
Here's the link to the package:
http://viremo.eludi.net/proteaAudio/index.html
Could anybody tell me what I'm doing wrong? Is the package not compatible with mushclient's version of lua? Or is it something that I might actually fix?
Edit: Failing to find a solution, can anybody recommend another package that would allow this? I'm basically trying to emulate the PLAY command from old versions of BASIC.
Here is the script I'm using:
-- function creating a sine wave sample:
function sampleSine(freq, duration, sampleRate)
local data = { }
for i = 1,duration*sampleRate do
data = math.sin( (i*freq/sampleRate)*math.pi*2)
end
return proAudio.sampleFromMemory(data, sampleRate)
end
-- plays a sample shifted by a number of halftones for a definable period of time
function playNote(sample, pitch, duration, volumeL, volumeR, disparity)
local scale = 2^(pitch/12)
local sound = proAudio.soundLoop(sample, volumeL, volumeR, disparity, scale)
proAudio.sleep(duration)
proAudio.soundStop(sound)
end
-- create an audio device using default parameters and exit in case of errors
require("proAudioRt")
if not proAudio.create() then os.exit(1) end
-- generate a sample:
local sample = sampleSine(440, 0.5, 88200)
-- play scale (a major):
local duration = 0.5
for i,note in ipairs({ 0, 2, 4, 5, 7, 9, 11, 12 }) do
playNote(sample, note, duration)
end
-- cleanup
proAudio.destroy()
It seems to find the file, but it says it can't find the module, I'm not sure what this means. |