Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
plugin-GUI
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
yehaojie
plugin-GUI
Commits
0ea6e47f
Commit
0ea6e47f
authored
11 years ago
by
Caleb Kemere
Browse files
Options
Downloads
Patches
Plain Diff
Noise gate implemented. Scaling is still suspect, but sounds reasonable with sample data.
parent
f369bf7d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Source/Processors/AudioNode.cpp
+14
-9
14 additions, 9 deletions
Source/Processors/AudioNode.cpp
Source/Processors/AudioNode.h
+1
-1
1 addition, 1 deletion
Source/Processors/AudioNode.h
with
15 additions
and
10 deletions
Source/Processors/AudioNode.cpp
+
14
−
9
View file @
0ea6e47f
...
...
@@ -140,8 +140,7 @@ void AudioNode::setParameter(int parameterIndex, float newValue)
else
if
(
parameterIndex
==
2
)
{
// noiseGateLevel level
noiseGateLevel
=
newValue
*
0.01
f
;
// not sure about this scaling???
std
::
cout
<<
"Changed noiseGateLevel: "
<<
noiseGateLevel
<<
std
::
endl
;
noiseGateLevel
=
newValue
;
// in microVolts
}
else
if
(
parameterIndex
==
100
)
...
...
@@ -294,6 +293,10 @@ void AudioNode::process(AudioSampleBuffer& buffer,
}
// copying buffer
gain
=
volume
/
(
float
(
0x7fff
)
*
channelPointers
[
i
-
2
]
->
bitVolts
);
// - Maximum of "volume" is 10 (100 * 0.1)
// - float(0x7fff) is the maximum value that comes out of the preamp (15 bits of 1's)
// - bitVolts is the number of microvolts per bit - why are we dividing by this???
// So, maximum gain applied to maximum data would be 10/bitVolts
int
remainingSamples
=
numSamplesExpected
-
samplesToCopy
;
...
...
@@ -353,15 +356,17 @@ void AudioNode::process(AudioSampleBuffer& buffer,
}
//
HERE IS WHERE WE NEED TO NOISE GATE
//
Simple implementation of a "noise gate" on audio output
float
*
leftChannelData
=
buffer
.
getSampleData
(
0
);
float
*
rightChannelData
=
buffer
.
getSampleData
(
1
);
float
gateLevel
=
noiseGateLevel
/
(
float
(
0x7fff
));
for
(
int
i
=
0
;
i
<
buffer
.
getNumSamples
();
i
++
)
{
if
(
abs
(
leftChannelData
[
i
])
<
gateLevel
)
leftChannelData
[
i
]
=
0
;
if
(
abs
(
rightChannelData
[
i
])
<
gateLevel
)
rightChannelData
[
i
]
=
0
;
// float gateLevel = (noiseGateLevel / channelPointers[i-2]->bitVolts) * gain; // uVolts scaled by gain
float
gateLevel
=
noiseGateLevel
*
gain
;
// bits scaled by gain
for
(
int
m
=
0
;
m
<
buffer
.
getNumSamples
();
m
++
)
{
if
(
fabs
(
leftChannelData
[
m
])
<
gateLevel
)
leftChannelData
[
m
]
=
0
;
if
(
fabs
(
rightChannelData
[
m
])
<
gateLevel
)
rightChannelData
[
m
]
=
0
;
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Source/Processors/AudioNode.h
+
1
−
1
View file @
0ea6e47f
...
...
@@ -103,7 +103,7 @@ private:
Array
<
int
>
leftChan
;
Array
<
int
>
rightChan
;
float
volume
;
float
noiseGateLevel
;
float
noiseGateLevel
;
// in microvolts
/** An array of pointers to the channels that feed into the AudioNode. */
Array
<
Channel
*>
channelPointers
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment