Module: WSK::FFT
- Included in:
- Actions::CutFirstSignal, Actions::FFT, Actions::NoiseGate, Actions::SilenceRemover
- Defined in:
- lib/WSK/FFT.rb
Overview
Module including helper methods using FFT processes. This module uses C methods declared in FFTUtils.
Defined Under Namespace
Classes: FFTComputing
Constant Summary collapse
- FREQINDEX_FIRST =
Frequencies used to compute FFT profiles. !!! When changing these values, all fft.result files generated are invalidated
-59
- FREQINDEX_LAST =
79- FFTDIST_MAX =
Scale used to measure FFT values
10000000000000- FFTSAMPLE_FREQ =
Frequency of the FFT samples to take (Hz) !!! If changed, all fft.result files generated are invalidated
10- FFTNBRSAMPLES_HISTORY =
Number of FFT buffers needed to detect a constant Moving Average. !!! If changed, all fft.result files generated are invalidated
5- FFT_SAMPLES_PREFETCH =
Number of samples to prefetch from the disk when reading. This should reflect the average number of FFT samples read when getNextFFTSample is invoked once. !!! If changed, all fft.result files generated are invalidated
30- FFTDISTANCE_MAX_HISTORY_TOLERANCE_PC =
Added tolerance percentage of distance between the maximal history distance and the average silence distance
20.0- FFTDISTANCE_AVERAGE_HISTORY_TOLERANCE_PC =
Added tolerance percentage of distance between the average history distance and the average silence distance
0.0
Instance Method Summary collapse
-
#getNextFFTSample(iIdxFirstSample, iFFTProfile, iInputData, iMaxFFTDistance, iThresholds, iBackwardsSearch, iIdxLastPossibleSample) ⇒ Object
Get the next sample that has an FFT buffer similar to a given FFT profile.
-
#getNextNonSilentSample(iInputData, iIdxStartSample, iSilenceThresholds, iSilenceFFTProfile, iMaxFFTDistance, iBackwardsSearch) ⇒ Object
Get the next non silent sample from an input data.
-
#getNextSilentSample(iInputData, iIdxStartSample, iSilenceThresholds, iMinSilenceSamples, iSilenceFFTProfile, iMaxFFTDistance, iBackwardsSearch) ⇒ Object
Get the next silent sample from an input data.
-
#getSampleBeyondThresholds(iRawBuffer, iThresholds, iNbrBitsPerSample, iNbrChannels, iNbrSamples, iLastSample) ⇒ Object
Get the sample index that exceeds a threshold in a raw buffer.
Instance Method Details
#getNextFFTSample(iIdxFirstSample, iFFTProfile, iInputData, iMaxFFTDistance, iThresholds, iBackwardsSearch, iIdxLastPossibleSample) ⇒ Object
Get the next sample that has an FFT buffer similar to a given FFT profile
- Parameters
-
iIdxFirstSample (Integer): First sample we are trying from
-
iFFTProfile ([Integer,Integer,list<list<Integer>>]): The FFT profile
-
iInputData (InputData): The input data to read
-
iMaxFFTDistance (Integer): Maximal acceptable distance with the FFT. Above this distance we don’t consider averaging.
-
iThresholds (list< [Integer,Integer] >): The thresholds that should contain the signal we are evaluating.
-
iBackwardsSearch (Boolean): Do we search backwards ?
-
iIdxLastPossibleSample (Integer): Index of the sample marking the limit of the search
- Return
-
Integer: Meaning of the given sample:
-
0: The sample has been found correctly and returned
-
1: The sample could not be found because thresholds were hit: the first sample hitting the thresholds is returned
-
2: The sample could not be found because the limit of search was hit before. The returned sample can be ignored.
-
-
Integer: Index of the sample (can be 1 after the end)
148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 |
# File 'lib/WSK/FFT.rb', line 148 def getNextFFTSample(iIdxFirstSample, iFFTProfile, iInputData, iMaxFFTDistance, iThresholds, iBackwardsSearch, iIdxLastPossibleSample) rResultCode = 0 rCurrentSample = iIdxFirstSample if (iBackwardsSearch) log_debug "== Looking for the previous sample matching FFT before #{iIdxFirstSample}, with a limit on sample #{iIdxLastPossibleSample} and a FFT distance of #{iMaxFFTDistance} ..." else log_debug "== Looking for the next sample matching FFT after #{iIdxFirstSample}, with a limit on sample #{iIdxLastPossibleSample} and a FFT distance of #{iMaxFFTDistance} ..." end # Object that will create the FFT lFFTComputing = FFTComputing.new(true, iInputData.Header) # Create the C FFT Profile lFFTUtils = FFTUtils::FFTUtils.new lReferenceFFTProfile = lFFTUtils.createCFFTProfile(iFFTProfile) # Historical values of FFT diffs to know when it is stable # This is the implementation of the Moving Average algorithm. # We are just interested in the difference of 2 different Moving Averages. Therefore comparing the oldest history value with the new one is enough. # Cycling buffer of size FFTNBRSAMPLES_HISTORY # list< Integer > lHistory = [] lIdxOldestHistory = 0 # The sum of all the history entries: used to compare with the maximal average distance lSumHistory = 0 lSumMaxFFTDistance = (iMaxFFTDistance*FFTNBRSAMPLES_HISTORY*(1+FFTDISTANCE_AVERAGE_HISTORY_TOLERANCE_PC/100)).to_i lMaxHistoryFFTDistance = (iMaxFFTDistance*(1+FFTDISTANCE_MAX_HISTORY_TOLERANCE_PC/100)).to_i lContinueSearching = nil if (iBackwardsSearch) lContinueSearching = (rCurrentSample >= iIdxLastPossibleSample) else lContinueSearching = (rCurrentSample <= iIdxLastPossibleSample) end while (lContinueSearching) # Compute the number of samples needed to have a valid FFT. # Modify this number if it exceeds the range we have lNbrSamplesFFTMax = iInputData.Header.SampleRate/FFTSAMPLE_FREQ lIdxBeginFFTSample = nil lIdxEndFFTSample = nil if (iBackwardsSearch) lIdxBeginFFTSample = rCurrentSample-lNbrSamplesFFTMax+1 lIdxEndFFTSample = rCurrentSample if (lIdxBeginFFTSample <= iIdxLastPossibleSample-1) lIdxBeginFFTSample = iIdxLastPossibleSample end else lIdxBeginFFTSample = rCurrentSample lIdxEndFFTSample = rCurrentSample+lNbrSamplesFFTMax-1 if (lIdxEndFFTSample >= iIdxLastPossibleSample+1) lIdxEndFFTSample = iIdxLastPossibleSample end end lNbrSamplesFFT = lIdxEndFFTSample-lIdxBeginFFTSample+1 # Load an FFT buffer of this lFFTBuffer = '' lIdxCurrentSample = rCurrentSample if (iBackwardsSearch) iInputData.each_reverse_raw_buffer(lIdxBeginFFTSample, lIdxEndFFTSample, :nbr_samples_prefetch => lNbrSamplesFFTMax*FFT_SAMPLES_PREFETCH ) do |iInputRawBuffer, iNbrSamples, iNbrChannels| # First, check that we are still in the thresholds lIdxBufferSampleOut = getSampleBeyondThresholds(iInputRawBuffer, iThresholds, iInputData.Header.NbrBitsPerSample, iNbrChannels, iNbrSamples, iBackwardsSearch) if (lIdxBufferSampleOut != nil) # Cancel this FFT search: the signal is out of the thresholds rCurrentSample = lIdxCurrentSample-iNbrSamples+1+lIdxBufferSampleOut rResultCode = 1 break end lFFTBuffer.insert(0, iInputRawBuffer) lIdxCurrentSample -= iNbrSamples end else iInputData.each_raw_buffer(lIdxBeginFFTSample, lIdxEndFFTSample, :nbr_samples_prefetch => lNbrSamplesFFTMax*FFT_SAMPLES_PREFETCH) do |iInputRawBuffer, iNbrSamples, iNbrChannels| # First, check that we are still in the thresholds lIdxBufferSampleOut = getSampleBeyondThresholds(iInputRawBuffer, iThresholds, iInputData.Header.NbrBitsPerSample, iNbrChannels, iNbrSamples, iBackwardsSearch) if (lIdxBufferSampleOut != nil) # Cancel this FFT search: the signal is out of the thresholds rCurrentSample = lIdxCurrentSample+lIdxBufferSampleOut rResultCode = 1 break end lFFTBuffer.concat(iInputRawBuffer) lIdxCurrentSample += iNbrSamples end end if (rResultCode == 1) lContinueSearching = false else # Compute its FFT profile lFFTComputing.resetData lFFTComputing.completeFFT(lFFTBuffer, lNbrSamplesFFT) lDist = lFFTUtils.distFFTProfiles(lReferenceFFTProfile, lFFTUtils.createCFFTProfile(lFFTComputing.getFFTProfile), FFTDIST_MAX).abs lHistoryMaxDistance = lHistory.sort[-1] log_debug "FFT distance computed with FFT sample [#{lIdxBeginFFTSample} - #{lIdxEndFFTSample}]: #{lDist}. Sum of history: #{lSumHistory} <? #{lSumMaxFFTDistance}. Max distance of history: #{lHistoryMaxDistance} <? #{lMaxHistoryFFTDistance}" # Detect if the Moving Average is going up and is below the maximal distance if ((lHistory.size == FFTNBRSAMPLES_HISTORY) and (lSumHistory < lSumMaxFFTDistance) and (lHistoryMaxDistance < lMaxHistoryFFTDistance) and (lHistory[lIdxOldestHistory] < lDist)) # We got it lContinueSearching = false else # Check next FFT sample if (iBackwardsSearch) rCurrentSample = lIdxBeginFFTSample - 1 lContinueSearching = (rCurrentSample >= iIdxLastPossibleSample) else rCurrentSample = lIdxEndFFTSample + 1 lContinueSearching = (rCurrentSample <= iIdxLastPossibleSample) end if (lContinueSearching) # Update the history with the new diff if (lHistory[lIdxOldestHistory] == nil) lSumHistory += lDist else lSumHistory += lDist - lHistory[lIdxOldestHistory] end lHistory[lIdxOldestHistory] = lDist lIdxOldestHistory += 1 if (lIdxOldestHistory == FFTNBRSAMPLES_HISTORY) lIdxOldestHistory = 0 end end end end end if ((rResultCode == 0) and (((iBackwardsSearch) and (rCurrentSample == iIdxLastPossibleSample-1)) or ((!iBackwardsSearch) and (rCurrentSample == iIdxLastPossibleSample+1)))) # Limit was hit rResultCode = 2 end case rResultCode when 0 if (iBackwardsSearch) log_debug "== Previous sample matching FFT before #{iIdxFirstSample} was found at #{rCurrentSample}." else log_debug "== Next sample matching FFT after #{iIdxFirstSample} was found at #{rCurrentSample}." end when 1 if (iBackwardsSearch) log_debug "== Previous sample matching FFT before #{iIdxFirstSample} could not be found because a sample exceeded thresholds meanwhile: #{rCurrentSample}." else log_debug "== Next sample matching FFT after #{iIdxFirstSample} could not be found because a sample exceeded thresholds meanwhile: #{rCurrentSample}." end when 2 if (iBackwardsSearch) log_debug "== Previous sample matching FFT before #{iIdxFirstSample} could not be found before hitting limit of #{iIdxLastPossibleSample}." else log_debug "== Next sample matching FFT after #{iIdxFirstSample} could not be found before hitting limit of #{iIdxLastPossibleSample}." end else log_err "Unknown result code: #{rResultCode}" end return rResultCode, rCurrentSample end |
#getNextNonSilentSample(iInputData, iIdxStartSample, iSilenceThresholds, iSilenceFFTProfile, iMaxFFTDistance, iBackwardsSearch) ⇒ Object
Get the next non silent sample from an input data
- Parameters
-
iInputData (WSK::Model::InputData): The input data
-
iIdxStartSample (Integer): Index of the first sample to search from
-
iSilenceThresholds (list< [Integer,Integer] >): The silence thresholds specifications
-
iSilenceFFTProfile ([Integer,Integer,list<list<Integer>>]): The silence FFT profile, or nil if none
-
iMaxFFTDistance (Integer): Max distance to consider with the FFT (ignored and can be nil if no FFT).
-
iBackwardsSearch (Boolean): Do we search backwards ?
- Return
-
Integer: Index of the next non silent sample, or nil if none
-
Integer: Index of the next sample getting above thresholds, or nil if none
432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 |
# File 'lib/WSK/FFT.rb', line 432 def getNextNonSilentSample(iInputData, iIdxStartSample, iSilenceThresholds, iSilenceFFTProfile, iMaxFFTDistance, iBackwardsSearch) rIdxSampleOut = nil rIdxSampleOutThresholds = nil if (iBackwardsSearch) log_debug "=== Looking for the previous signal sample before #{iIdxStartSample} ..." else log_debug "=== Looking for the next signal sample after #{iIdxStartSample} ..." end # Find the next sample getting out of the silence thresholds lIdxCurrentSample = iIdxStartSample if (iBackwardsSearch) iInputData.each_reverse_raw_buffer(0, iIdxStartSample) do |iInputRawBuffer, iNbrSamples, iNbrChannels| lIdxBufferSampleOut = getSampleBeyondThresholds(iInputRawBuffer, iSilenceThresholds, iInputData.Header.NbrBitsPerSample, iNbrChannels, iNbrSamples, iBackwardsSearch) if (lIdxBufferSampleOut != nil) # We found it rIdxSampleOutThresholds = lIdxCurrentSample-iNbrSamples+1+lIdxBufferSampleOut break end lIdxCurrentSample -= iNbrSamples end else iInputData.each_raw_buffer(iIdxStartSample) do |iInputRawBuffer, iNbrSamples, iNbrChannels| lIdxBufferSampleOut = getSampleBeyondThresholds(iInputRawBuffer, iSilenceThresholds, iInputData.Header.NbrBitsPerSample, iNbrChannels, iNbrSamples, iBackwardsSearch) if (lIdxBufferSampleOut != nil) # We found it rIdxSampleOutThresholds = lIdxCurrentSample+lIdxBufferSampleOut break end lIdxCurrentSample += iNbrSamples end end if (rIdxSampleOutThresholds == nil) log_debug("Thresholds matching did not find any signal starting at sample #{iIdxStartSample}.") else log_debug("Thresholds matching found a signal starting at sample #{iIdxStartSample}, beginning at sample #{rIdxSampleOutThresholds}.") # If we want to use FFT to have a better result, do it here if (iSilenceFFTProfile == nil) rIdxSampleOut = rIdxSampleOutThresholds else # Check FFT # We search in the reverse direction to find the silence, knowing that we can't have a sample getting past our initial search sample lFFTResultCode = nil lIdxFFTSample = nil if (iBackwardsSearch) lFFTResultCode, lIdxFFTSample = getNextFFTSample(rIdxSampleOutThresholds+1, iSilenceFFTProfile, iInputData, iMaxFFTDistance, iSilenceThresholds, false, iIdxStartSample) else lFFTResultCode, lIdxFFTSample = getNextFFTSample(rIdxSampleOutThresholds-1, iSilenceFFTProfile, iInputData, iMaxFFTDistance, iSilenceThresholds, true, iIdxStartSample) end case lFFTResultCode when 0 # We found the real one log_debug("FFT matching found a silence starting at sample #{rIdxSampleOutThresholds}, beginning at sample #{lIdxFFTSample}.") rIdxSampleOut = lIdxFFTSample when 1 # Here is a bug log_err("FFT matching found a new signal beyond thresholds starting at sample #{rIdxSampleOutThresholds}, beginning at sample #{lIdxFFTSample}. This should never happen here: the previous search using thresholds should have already returned this sample.") raise RuntimeError.new("FFT matching found a new signal beyond thresholds starting at sample #{rIdxSampleOutThresholds}, beginning at sample #{lIdxFFTSample}. This should never happen here: the previous search using thresholds should have already returned this sample.") when 2 log_debug("FFT matching could not find a silence starting at sample #{rIdxSampleOutThresholds}. This means that the signal is present from the start.") rIdxSampleOut = iIdxStartSample else raise RuntimeError.new("Unknown result code: #{lFFTResultCode}") end end end if (iBackwardsSearch) log_debug "=== Previous signal sample before #{iIdxStartSample} was found at #{rIdxSampleOut}, with a sample beyond thresholds at #{rIdxSampleOutThresholds}." else log_debug "=== Next signal sample after #{iIdxStartSample} was found at #{rIdxSampleOut}, with a sample beyond thresholds at #{rIdxSampleOutThresholds}." end return rIdxSampleOut, rIdxSampleOutThresholds end |
#getNextSilentSample(iInputData, iIdxStartSample, iSilenceThresholds, iMinSilenceSamples, iSilenceFFTProfile, iMaxFFTDistance, iBackwardsSearch) ⇒ Object
Get the next silent sample from an input data
- Parameters
-
iInputData (WSK::Model::InputData): The input data
-
iIdxStartSample (Integer): Index of the first sample to search from
-
iSilenceThresholds (list< [Integer,Integer] >): The silence thresholds specifications
-
iMinSilenceSamples (Integer): Number of samples minimum to identify a silence
-
iSilenceFFTProfile ([Integer,Integer,list<list<Integer>>]): The silence FFT profile, or nil if none
-
iMaxFFTDistance (Integer): Max distance to consider with the FFT (ignored and can be nil if no FFT).
-
iBackwardsSearch (Boolean): Do we make a backwards search ?
- Return
-
Integer: Index of the next silent sample, or nil if none
-
Integer: Silence length (computed only if FFT profile was provided)
-
Integer: Index of the next sample after the silence that is beyond thresholds (computed only if FFT profile was provided)
320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 |
# File 'lib/WSK/FFT.rb', line 320 def getNextSilentSample(iInputData, iIdxStartSample, iSilenceThresholds, iMinSilenceSamples, iSilenceFFTProfile, iMaxFFTDistance, iBackwardsSearch) rNextSilentSample = nil rSilenceLength = nil rNextSignalAboveThresholds = nil if (iBackwardsSearch) log_debug "=== Looking for the previous silent sample before #{iIdxStartSample}, of minimal length #{iMinSilenceSamples} ..." else log_debug "=== Looking for the next silent sample after #{iIdxStartSample}, of minimal length #{iMinSilenceSamples} ..." end lIdxSearchSample = iIdxStartSample lContinueSearching = true while (lContinueSearching) # We search starting at lIdxSearchSample lContinueSearching = false # First find using thresholds only require 'WSK/SilentUtils/SilentUtils' rNextSilentSample = SilentUtils::SilentUtils.new.getNextSilentInThresholds(iInputData, lIdxSearchSample, iSilenceThresholds, iMinSilenceSamples, iBackwardsSearch) if (rNextSilentSample == nil) log_debug("Thresholds matching did not find any silence starting at sample #{iIdxStartSample}.") else log_debug("Thresholds matching found a silence starting at sample #{iIdxStartSample}, beginning at sample #{rNextSilentSample}.") # If we want to use FFT to have a better result, do it here if (iSilenceFFTProfile != nil) # Check FFT if (iBackwardsSearch) lFFTResultCode, lIdxFFTSample = getNextFFTSample(rNextSilentSample, iSilenceFFTProfile, iInputData, iMaxFFTDistance, iSilenceThresholds, iBackwardsSearch, 0) else lFFTResultCode, lIdxFFTSample = getNextFFTSample(rNextSilentSample, iSilenceFFTProfile, iInputData, iMaxFFTDistance, iSilenceThresholds, iBackwardsSearch, iInputData.NbrSamples-1) end case lFFTResultCode when 0 # Check that the silence lasts at least iMinSilenceSamples lIdxNextSignal = nil lIdxNextSignalAboveThresholds = nil lSilenceLength = nil if (iBackwardsSearch) lIdxNextSignal, lIdxNextSignalAboveThresholds = getNextNonSilentSample(iInputData, lIdxFFTSample-1, iSilenceThresholds, iSilenceFFTProfile, iMaxFFTDistance, iBackwardsSearch) if (lIdxNextSignal == nil) # No signal was found further. lSilenceLength = lIdxFFTSample else lSilenceLength = lIdxFFTSample - lIdxNextSignal - 1 end else lIdxNextSignal, lIdxNextSignalAboveThresholds = getNextNonSilentSample(iInputData, lIdxFFTSample+1, iSilenceThresholds, iSilenceFFTProfile, iMaxFFTDistance, iBackwardsSearch) if (lIdxNextSignal == nil) # No signal was found further. lSilenceLength = iInputData.NbrSamples - 1 - lIdxFFTSample else lSilenceLength = lIdxNextSignal - 1 - lIdxFFTSample end end if (lSilenceLength >= iMinSilenceSamples) # We found the real one log_debug("FFT matching found a silence starting at sample #{rNextSilentSample}, beginning at sample #{lIdxFFTSample}.") rNextSilentSample = lIdxFFTSample rSilenceLength = lSilenceLength rNextSignalAboveThresholds = lIdxNextSignalAboveThresholds elsif (lIdxNextSignal == nil) # We arrived at the end. The silence is not long enough. log_debug("FFT matching found a silence starting at sample #{rNextSilentSample}, beginning at sample #{lIdxFFTSample}, but its length (#{lSilenceLength}) is too small (minimum required is #{iMinSilenceSamples}). End of file reached.") rNextSilentSample = nil else # We have to continue log_debug("FFT matching found a silence starting at sample #{rNextSilentSample}, beginning at sample #{lIdxFFTSample}, but its length (#{lSilenceLength}) is too small (minimum required is #{iMinSilenceSamples}). Looking further.") lIdxSearchSample = lIdxNextSignalAboveThresholds lContinueSearching = true rNextSilentSample = nil end when 1 # We have to search further, begin with thresholds matching log_warn("FFT matching found a new signal beyond thresholds starting at sample #{rNextSilentSample}, beginning at sample #{lIdxFFTSample}. Maybe clip ?") if (iBackwardsSearch) lIdxSearchSample = lIdxFFTSample - 1 else lIdxSearchSample = lIdxFFTSample + 1 end lContinueSearching = true rNextSilentSample = nil when 2 log_debug("FFT matching could not find a silence starting at sample #{rNextSilentSample}.") rNextSilentSample = nil else raise RuntimeError.new("Unknown result code: #{lFFTResultCode}") end end end end if (iBackwardsSearch) log_debug "=== Previous silent sample before #{iIdxStartSample} was found at #{rNextSilentSample} with a length of #{rSilenceLength}, and a signal before it above thresholds at #{rNextSignalAboveThresholds}." else log_debug "=== Next silent sample after #{iIdxStartSample} was found at #{rNextSilentSample} with a length of #{rSilenceLength}, and an signal after it above thresholds at #{rNextSignalAboveThresholds}." end return rNextSilentSample, rSilenceLength, rNextSignalAboveThresholds end |
#getSampleBeyondThresholds(iRawBuffer, iThresholds, iNbrBitsPerSample, iNbrChannels, iNbrSamples, iLastSample) ⇒ Object
Get the sample index that exceeds a threshold in a raw buffer.
- Parameters
-
iRawBuffer (String): The raw buffer
-
iThresholds (list< [Integer,Integer] >): The thresholds
-
iNbrBitsPerSample (Integer): Number of bits per sample
-
iNbrChannels (Integer): Number of channels
-
iNbrSamples (Integer): Number of samples
-
iLastSample (Boolean): Are we looking for the last sample ?
- Return
-
Integer: Index of the first sample exceeding thresholds, or nil if none
520 521 522 523 |
# File 'lib/WSK/FFT.rb', line 520 def getSampleBeyondThresholds(iRawBuffer, iThresholds, iNbrBitsPerSample, iNbrChannels, iNbrSamples, iLastSample) require 'WSK/SilentUtils/SilentUtils' return SilentUtils::SilentUtils.new.getSampleBeyondThresholds(iRawBuffer, iThresholds, iNbrBitsPerSample, iNbrChannels, iNbrSamples, iLastSample) end |