• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java FFT类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中ddf.minim.analysis.FFT的典型用法代码示例。如果您正苦于以下问题:Java FFT类的具体用法?Java FFT怎么用?Java FFT使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



FFT类属于ddf.minim.analysis包,在下文中一共展示了FFT类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: setup

import ddf.minim.analysis.FFT; //导入依赖的package包/类
public void setup() {
	super.setup();

	height3 = height/3;
	height23 = 2*height/3;

	minim = new Minim(this);
	in = minim.getLineIn();

	fftLin = new FFT(in.bufferSize(), in.sampleRate());		  
	// calculate the averages by grouping frequency bands linearly. use 30 averages.
	fftLin.linAverages( 32 );

	// create an FFT object for calculating logarithmically spaced averages
	fftLog = new FFT( in.bufferSize(), in.sampleRate() );

	// calculate averages based on a miminum octave width of 22 Hz
	// split each octave into three bands
	// this should result in 30 averages
	fftLog.logAverages( 200, 3 );

	rectMode(CORNERS);
}
 
开发者ID:cacheflowe,项目名称:haxademic,代码行数:24,代码来源:MinimLogAvgsTest.java


示例2: run

import ddf.minim.analysis.FFT; //导入依赖的package包/类
@Override
public void run() {
    while (!Thread.interrupted()) {
        FFT fft = Amperfi.playbackController.getPlayerAPI().getFFT();
        AudioPlayer currentPlayer = Amperfi.playbackController.getPlayerAPI().getCurrentPlayer();
        if (activeVisualizer != null && fft != null && currentPlayer != null && Amperfi.playbackController.getStatus() == PlayerAPI.PlayerStatus.PLAYING) {
            fft.forward(currentPlayer.left);
            Platform.runLater(() -> activeVisualizer.drawVisualizerFFT(fft));
        }
        try {
            Thread.sleep(17);
        } catch (InterruptedException e) {
            return;
        }
    }
}
 
开发者ID:MolaynoxX,项目名称:amperfi,代码行数:17,代码来源:VisualizerView.java


示例3: setup

import ddf.minim.analysis.FFT; //导入依赖的package包/类
public void setup() {
		super.setup();
		minim = new Minim(this);
		in = minim.getLineIn();

		fft = new FFT(in.bufferSize(), in.sampleRate());
		spectrumDampened = new float[in.bufferSize()];
		spectrumDb = new float[in.bufferSize()];
		for(int i = 0; i < fft.specSize(); i++) {
			spectrumDampened[i] = 0;
			spectrumDb[i] = 0;
		}

		windowName = "Rectangular Window";

		// a beat detection object song SOUND_ENERGY mode with a sensitivity of 10 milliseconds
		beat = new BeatDetect();
		beat.setSensitivity(300);
		ellipseMode(RADIUS);
		eRadius = 20;
		
		
//		in.shiftGain(0, -60f, 5000);
	}
 
开发者ID:cacheflowe,项目名称:haxademic,代码行数:25,代码来源:MinimAudioInputTest.java


示例4: AudioInputMinim

import ddf.minim.analysis.FFT; //导入依赖的package包/类
public AudioInputMinim() {
	minim = new Minim( P.p );
	audioInput = minim.getLineIn();
	
	fft = new FFT(audioInput.bufferSize(), audioInput.sampleRate());
	fft.linAverages( averages );
	spectrumAvgDampened = new float[averages];
	spectrumDampened = new float[audioInput.bufferSize()];
	spectrum = new float[audioInput.bufferSize() / 2];
	spectrumDb = new float[audioInput.bufferSize()];
	for(int i = 0; i < fft.specSize(); i++) {
		spectrumDampened[i] = 0;
		if(i < spectrum.length) spectrum[i] = 0;
		spectrumDb[i] = 0;
	}

	// a beat detection object song SOUND_ENERGY mode with a sensitivity of 300 milliseconds
	beatDetection = new BeatDetect();
	beatDetection.detectMode(BeatDetect.SOUND_ENERGY);
	beatDetection.setSensitivity(300);
}
 
开发者ID:cacheflowe,项目名称:haxademic,代码行数:22,代码来源:AudioInputMinim.java


示例5: sampleRateChanged

import ddf.minim.analysis.FFT; //导入依赖的package包/类
protected void sampleRateChanged()
{
	m_audioFFT = new FFT( m_windowSize, sampleRate() );
	m_audioFFT.window( FFT.HAMMING );
	m_modulatorFFT = new FFT( m_windowSize, sampleRate() );
	m_modulatorFFT.window( FFT.HAMMING );
}
 
开发者ID:JacobRoth,项目名称:romanov,代码行数:8,代码来源:Vocoder.java


示例6: analyze

import ddf.minim.analysis.FFT; //导入依赖的package包/类
private void analyze(FFT fft, float[] src)
{
	// copy the previous windowSize samples into our analysis window
	for ( int i = m_index - m_windowSize, j = 0; i < m_index; ++i, ++j )
	{
		m_analysisSamples[j] = ( i < 0 ) ? src[src.length + i] : src[i];
	}
	fft.forward( m_analysisSamples );
}
 
开发者ID:JacobRoth,项目名称:romanov,代码行数:10,代码来源:Vocoder.java


示例7: startPlayback

import ddf.minim.analysis.FFT; //导入依赖的package包/类
private void startPlayback() {
    setStatus(PlayerStatus.PLAYING);
    currentPlayer = minim.loadFile(currentPlaylist.get(currentIndex).getPath());
    currentPlayer.play();
    currentPlayer.setGain(-80 * (1 - volume));

    fft = new FFT(currentPlayer.bufferSize(), currentPlayer.sampleRate());

    playbackUpdater = new Thread(new PlaybackUpdater(currentPlayer, this::afterPlayback, this));
    playbackUpdater.setDaemon(true);
    playbackUpdater.start();
}
 
开发者ID:MolaynoxX,项目名称:amperfi,代码行数:13,代码来源:PlayerAPI.java


示例8: PluginHandler

import ddf.minim.analysis.FFT; //导入依赖的package包/类
public PluginHandler( BeatDetect beat, FFT fft )
{
    this.beat = beat;
    this.fft = fft;

    instantiateLEDs( Settings.NUM_LEDS );
}
 
开发者ID:uPaymeiFixit,项目名称:Processing-Arduino-Light-Controller,代码行数:8,代码来源:PluginHandler.java


示例9: init

import ddf.minim.analysis.FFT; //导入依赖的package包/类
public void init() {
		_minim = new Minim( p );
		_audioInput = _minim.getLineIn();
		
		_fft = new FFT(_audioInput.bufferSize(), _audioInput.sampleRate());
		_fft.linAverages( _averages );
		spectrumAvgDampened = new float[_averages];
		spectrumDampened = new float[_audioInput.bufferSize()];
		spectrumDb = new float[_audioInput.bufferSize()];
		for(int i = 0; i < _fft.specSize(); i++) {
			spectrumDampened[i] = 0;
			spectrumDb[i] = 0;
		}

		windowName = "Rectangular Window";

		// a beat detection object song SOUND_ENERGY mode with a sensitivity of 300 milliseconds
		_beatDetection = new BeatDetect();
//		_beatDetection.detectMode(BeatDetect.FREQ_ENERGY);
		_beatDetection.setSensitivity(300);

		// TODO: move this into a sketch so audio and renderer are separate
		// listen realtime if not rendering
		// P.println("AudioInputWrapper._isRendering = "+_isRendering);
		if( _isRendering == false ) {
			// _myInput.start();
		}

		_gain = _audioInput.getGain();
		setGain(_gain);
	}
 
开发者ID:cacheflowe,项目名称:haxademic,代码行数:32,代码来源:AudioInputWrapperMinim.java


示例10: AudioPlayerMinim

import ddf.minim.analysis.FFT; //导入依赖的package包/类
public AudioPlayerMinim(Minim m, String audioFile) {
	minim = m;

	player = minim.loadFile(audioFile, 512);
	player.loop();

	fft = new FFT( player.bufferSize(), player.sampleRate() );
	spectrum = new float[player.bufferSize() / 2];
	
	beatDetection = new BeatDetect();
	beatDetection.detectMode(BeatDetect.SOUND_ENERGY);
	beatDetection.setSensitivity(300);
}
 
开发者ID:cacheflowe,项目名称:haxademic,代码行数:14,代码来源:AudioPlayerMinim.java


示例11: SoundControl

import ddf.minim.analysis.FFT; //导入依赖的package包/类
public SoundControl(String s) throws IOException
{
	MinimObject minimObj = new MinimObject();
	minim = new Minim(minimObj);
	maxBass = Constants.MAX_PLAYER_SIZE;
	frame = Constants.FRAME_TO_GENERATE_ENEMIES;
	fftThreshold = Constants.FFT_THRESHOLD;
	fftLeftThreshold = Constants.FFT_LEFT_THRESHOLD;
	consecFramesGenned= 0;
	
	song = minim.loadFile(s);
	songLength = song.length();
	songOver = false;
	
	fadeEnter = false;

	fft = new FFT(song.bufferSize(), song.sampleRate());
	fft.linAverages(bands);
	setFftLog(new FFT(song.bufferSize(), song.sampleRate()));
	getFftLog().logAverages(22,12);
	
	fftPrev = new float[bands];
	fftDiff = new float[bands];
	groupings = new int[120];
	beats = new boolean[120];
			
	beat = new BeatDetect(song.bufferSize(), song.sampleRate());
	beat.setSensitivity(10);
	
	bl = new BeatListener(beat, song);

}
 
开发者ID:Jrokisky,项目名称:Sonance,代码行数:33,代码来源:SoundControl.java


示例12: uGenerate

import ddf.minim.analysis.FFT; //导入依赖的package包/类
protected void uGenerate(float[] out)
{
	m_audioSamples[m_index] = audio.getLastValue();
	m_modulatorSamples[m_index] = modulator.getLastValue();
	++m_index;
	--m_triggerCount;
	if ( m_index == m_audioSamples.length )
	{
		m_index = 0;
	}

	// we reached the end of our window. analyze and synthesize!
	if ( m_triggerCount == 0 )
	{
		analyze( m_audioFFT, m_audioSamples );
		analyze( m_modulatorFFT, m_modulatorSamples );

		for ( int i = 0; i < m_audioFFT.specSize(); ++i )
		{
			m_audioFFT.scaleBand( i, m_modulatorFFT.getBand( i ) );
		}

		// synthesize
		m_audioFFT.inverse( m_analysisSamples );

		// window
		FFT.HAMMING.apply( m_analysisSamples );

		// accumulate
		for ( int a = 0; a < m_windowSize; ++a )
		{
			int outIndex = m_outputIndex + a;
			if ( outIndex >= m_outputSamples.length )
			{
				outIndex -= m_outputSamples.length;
			}
			m_outputSamples[outIndex] += m_analysisSamples[a] * m_outputScale;
		}

		m_triggerCount = m_windowSpacing;
	}

	for ( int i = 0; i < out.length; ++i )
	{
		out[i] = m_outputSamples[m_outputIndex];
	}
	// eat it.
	m_outputSamples[m_outputIndex] = 0.f;
	// next!
	++m_outputIndex;
	if ( m_outputIndex == m_outputSamples.length )
	{
		m_outputIndex = 0;
	}
}
 
开发者ID:JacobRoth,项目名称:romanov,代码行数:56,代码来源:Vocoder.java


示例13: getFFT

import ddf.minim.analysis.FFT; //导入依赖的package包/类
public FFT getFFT() {
    return fft;
}
 
开发者ID:MolaynoxX,项目名称:amperfi,代码行数:4,代码来源:PlayerAPI.java


示例14: drawVisualizerFFT

import ddf.minim.analysis.FFT; //导入依赖的package包/类
@Override
public void drawVisualizerFFT(FFT fftData) {
    long frameTime = System.currentTimeMillis() - lastExec;
    lastExec = System.currentTimeMillis();

    getGraphicsContext2D().clearRect(0, 0, this.getWidth(), this.getHeight());

    // Calculation
    double centerX = this.getWidth() / 2;
    double centerY = this.getHeight() / 2;

    double bass = 0;
    for (int i = 0; i < fftData.specSize() / 5; i++) {
        double a = fftData.getBand(i) / 4.7;
        bass += Math.pow(a, 2);
    }

    double volume = 0;
    for (int i = fftData.specSize() / 5; i < fftData.specSize(); i++) {
        volume += fftData.getBand(i);
    }
    volume = volume / fftData.specSize();

    volume = 0.95D / (1 + 10 * Math.exp(-1.25 * volume)) + 0.05;

    bass = volume * (175 / (1 + 50 * Math.exp(-0.014 * bass)));

    //bass = bass;
    double r = Math.min(this.getWidth() / 3, this.getHeight() / 3) + 0.5 * bass;

    // Particles
    double newParticles = (1 + rand.nextInt(3)) * (bass * 0.005);
    for (int i = 0; i < newParticles; i++) {
        particles.add(new Particle(1, Math.random() * this.getHeight(), 1 + rand.nextInt(3), 1 + (Math.random()) * 3, (0.5 - Math.random()) * 2, Color.WHITE.deriveColor(0, 1, 1 - (Math.random() / 2), 1)));
    }
    if (newParticles < 1 && rand.nextInt(12) == 0) {
        for (int i = 0; i < rand.nextInt(2); i++) {
            particles.add(new Particle(1, Math.random() * this.getHeight(), 1 + rand.nextInt(3), 1 + (Math.random()) * 3, (0.5 - Math.random()) * 2, Color.WHITE.deriveColor(0, 1, 1 - (Math.random() / 2), 1)));
        }
    }

    Iterator<Particle> itParticle = particles.iterator();
    while (itParticle.hasNext()) {
        Particle p = itParticle.next();
        p.update(bass * 0.025);
        if (!p.draw(this.getGraphicsContext2D())) {
            itParticle.remove();
        }
    }

    // Circle
    double offsetX = (Math.random() - 0.5) * (bass * 0.5) * 0.6;
    double offsetY = (Math.random() - 0.5) * (bass * 0.5) * 0.6;
    centerX += offsetX;
    centerY += offsetY;

    motionBlur.setAngle(Math.atan2(offsetX, offsetY) * 180 / Math.PI);
    motionBlur.setRadius(Math.max(10, 15 * (((Math.abs(offsetX) + Math.abs(offsetY)) / 2))));

    this.getGraphicsContext2D().setEffect(motionBlur);

    RadialGradient circle = new RadialGradient(90, 0, 0.5, 0.5, 1, true, CycleMethod.NO_CYCLE, new Stop(0, radialInner.deriveColor(1, bass * 0.01, bass * 0.01, 1)), new Stop(1, radialOuter));

    this.getGraphicsContext2D().setFill(circle);

    this.getGraphicsContext2D().fillOval(centerX - r, centerY - r, r * 2, r * 2);

    this.getGraphicsContext2D().setEffect(null);

    this.getGraphicsContext2D().setFill(Color.RED);
    this.getGraphicsContext2D().fillText("FPS: " + (1000 / frameTime) + "\n" + "Particles: " + particles.size(), 0, 10);
}
 
开发者ID:MolaynoxX,项目名称:amperfi,代码行数:73,代码来源:SphereVisualizer.java


示例15: FFTListener

import ddf.minim.analysis.FFT; //导入依赖的package包/类
public FFTListener( FFT fft, AudioInput source )
{
    this.source = source;
    this.source.addListener( this );
    this.fft = fft;
}
 
开发者ID:uPaymeiFixit,项目名称:Processing-Arduino-Light-Controller,代码行数:7,代码来源:FFTListener.java


示例16: keyReleased

import ddf.minim.analysis.FFT; //导入依赖的package包/类
public void keyReleased()
{
	if ( key == ',' ) {
		in.setGain( -20.f );
		P.println(in.getGain());
	} else if ( key == '.' ) {
		in.setGain( -90.f );
		P.println(in.getGain());
	}
	
	
	
	WindowFunction newWindow = FFT.NONE;

	if ( key == '1' ) 
	{
		newWindow = FFT.BARTLETT;
	}
	else if ( key == '2' )
	{
		newWindow = FFT.BARTLETTHANN;
	}
	else if ( key == '3' )
	{
		newWindow = FFT.BLACKMAN;
	}
	else if ( key == '4' )
	{
		newWindow = FFT.COSINE;
	}
	else if ( key == '5' )
	{
		newWindow = FFT.GAUSS;
	}
	else if ( key == '6' )
	{
		newWindow = FFT.HAMMING;
	}
	else if ( key == '7' )
	{
		newWindow = FFT.HANN;
	}
	else if ( key == '8' )
	{
		newWindow = FFT.LANCZOS;
	}
	else if ( key == '9' )
	{
		newWindow = FFT.TRIANGULAR;
	}

	fft.window( newWindow );
	windowName = newWindow.toString();
}
 
开发者ID:cacheflowe,项目名称:haxademic,代码行数:55,代码来源:MinimAudioInputTest.java


示例17: initAudioAnalysisForAudioFile

import ddf.minim.analysis.FFT; //导入依赖的package包/类
public void initAudioAnalysisForAudioFile() {
	_fft = new FFT(_audioPlayer.bufferSize(), _audioPlayer.sampleRate());
}
 
开发者ID:cacheflowe,项目名称:haxademic,代码行数:4,代码来源:AudioLoopPlayer.java


示例18: getFftLog

import ddf.minim.analysis.FFT; //导入依赖的package包/类
public FFT getFftLog() {
	return fftLog;
}
 
开发者ID:Jrokisky,项目名称:Sonance,代码行数:4,代码来源:SoundControl.java


示例19: setFftLog

import ddf.minim.analysis.FFT; //导入依赖的package包/类
public void setFftLog(FFT fftLog) {
	this.fftLog = fftLog;
}
 
开发者ID:Jrokisky,项目名称:Sonance,代码行数:4,代码来源:SoundControl.java


示例20: drawVisualizerFFT

import ddf.minim.analysis.FFT; //导入依赖的package包/类
public abstract void drawVisualizerFFT(FFT fftData); 
开发者ID:MolaynoxX,项目名称:amperfi,代码行数:2,代码来源:AbstractVisualizer.java



注:本文中的ddf.minim.analysis.FFT类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java TrackingIndexWriter类代码示例发布时间:2022-05-22
下一篇:
Java Link类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap