Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
10 changed files
with
79 additions
and
79 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
10 changes: 5 additions & 5 deletions
10
plugins/DubyFilta/DubyFilta.rb → plugins/MirahFilta/MirahFilta.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
plugins/DubyFilta/DubyTools.mirah → plugins/MirahFilta/MirahTools.mirah
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
class DubyTools | ||
class MirahTools | ||
def not_below(val:float,min:float) | ||
val < min ? min : val | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Work in progress of filter implemented in JRuby + Mirah |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 37 additions & 37 deletions
74
plugins/DubyFreeComp/DubyFreeCompTools.mirah → ...ns/MirahFreeComp/MirahFreeCompTools.mirah
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,38 @@ | ||
class DubyFreeCompTools | ||
def initialize | ||
@final_gain = 1.0 | ||
@env = 0.0 | ||
end | ||
|
||
def slider(threshold:float,ratio:float,attack:float,release:float,output:float,sample_rate:int) | ||
@env_rel = Math.exp(-1/(0.25*release*sample_rate)) | ||
@thresh = Math.pow(10,threshold/20.0) | ||
@transA = (1/ratio) - 1 | ||
@transB = Math.pow(10,output/20.0) * Math.pow(@thresh,1-(1/ratio)) | ||
@output_gain = Math.pow(10,output/20.0) | ||
@att_coef = Math.exp(-1 / (attack/1000.0*sample_rate)) | ||
@rel_coef = Math.exp(-1 / (release/1000.0*sample_rate)) | ||
end | ||
|
||
def sample(spl0:float) | ||
det = Math.abs(spl0) # instead of [spl0.abs, spl1.abs].max | ||
det += float(Math.pow(10,-29)) # cannot use 10e-30 currently | ||
|
||
@env = det >= @env ? det : float(det+@env_rel*(@env-det)) | ||
gain = @env > @thresh ? Math.pow(@env,@transA)*@transB : @output_gain | ||
|
||
@final_gain = float(gain < @final_gain ? gain+@att_coef*(@final_gain-gain) : gain+@rel_coef*(@final_gain-gain)) | ||
spl0 *= float(@final_gain) | ||
#spl1 *= final_gain | ||
#[spl0, spl1] | ||
spl0 | ||
end | ||
|
||
def process(inBuffer:float[], outBuffer:float[], sampleFrames:int) | ||
i = 0 | ||
while i < sampleFrames | ||
outBuffer[i] = sample(inBuffer[i]) | ||
i += 1 | ||
end | ||
end | ||
class MirahFreeCompTools | ||
def initialize | ||
@final_gain = 1.0 | ||
@env = 0.0 | ||
end | ||
|
||
def slider(threshold:float,ratio:float,attack:float,release:float,output:float,sample_rate:int) | ||
@env_rel = Math.exp(-1/(0.25*release*sample_rate)) | ||
@thresh = Math.pow(10,threshold/20.0) | ||
@transA = (1/ratio) - 1 | ||
@transB = Math.pow(10,output/20.0) * Math.pow(@thresh,1-(1/ratio)) | ||
@output_gain = Math.pow(10,output/20.0) | ||
@att_coef = Math.exp(-1 / (attack/1000.0*sample_rate)) | ||
@rel_coef = Math.exp(-1 / (release/1000.0*sample_rate)) | ||
end | ||
|
||
def sample(spl0:float) | ||
det = Math.abs(spl0) # instead of [spl0.abs, spl1.abs].max | ||
det += float(Math.pow(10,-29)) # cannot use 10e-30 currently | ||
|
||
@env = det >= @env ? det : float(det+@env_rel*(@env-det)) | ||
gain = @env > @thresh ? Math.pow(@env,@transA)*@transB : @output_gain | ||
|
||
@final_gain = float(gain < @final_gain ? gain+@att_coef*(@final_gain-gain) : gain+@rel_coef*(@final_gain-gain)) | ||
spl0 *= float(@final_gain) | ||
#spl1 *= final_gain | ||
#[spl0, spl1] | ||
spl0 | ||
end | ||
|
||
def process(inBuffer:float[], outBuffer:float[], sampleFrames:int) | ||
i = 0 | ||
while i < sampleFrames | ||
outBuffer[i] = sample(inBuffer[i]) | ||
i += 1 | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
include_class Java::MirahGainTools | ||
|
||
class MirahGain < OpazPlug | ||
plugin "MirahGain", "Opaz", "LoGeek" | ||
can_do "1in1out", "plugAsChannelInsert", "plugAsSend" | ||
unique_id "MGaN" | ||
|
||
param :gain, "Gain", 1.0, "dB" | ||
|
||
def process(inputs, outputs, sampleFrames) | ||
MirahGainTools.process(inputs[0], outputs[0], sampleFrames, gain) | ||
end | ||
end |
18 changes: 9 additions & 9 deletions
18
plugins/DubyGain/DubyGainTools.mirah → plugins/MirahGain/MirahGainTools.mirah
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
class DubyGainTools | ||
def self.process(inBuffer:float[], outBuffer:float[], sampleFrames:int, gain:float) | ||
i = 0 | ||
while i < sampleFrames | ||
outBuffer[i] = inBuffer[i] * gain | ||
i += 1 | ||
end | ||
end | ||
end | ||
class MirahGainTools | ||
def self.process(inBuffer:float[], outBuffer:float[], sampleFrames:int, gain:float) | ||
i = 0 | ||
while i < sampleFrames | ||
outBuffer[i] = inBuffer[i] * gain | ||
i += 1 | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
Example of Mirah+JRuby plugin. | ||
|
||
see http://www.mirah.org | ||
|
||
Mirah must be installed first: | ||
|
||
jgem install mirah | ||
|
||
Example of Mirah+JRuby plugin. | ||
see http://www.mirah.org | ||
Mirah must be installed first: | ||
jgem install mirah | ||
.mirah files are compiled to .java then .class automatically. |