comparison src/app/waveform/waveform.component.ts @ 129:161af71c80d4

Module for spectrogram stuff. Consume the WavesSpectrogramLayer in Waveform... of course.
author Lucas Thompson <dev@lucas.im>
date Thu, 16 Mar 2017 10:35:53 +0000
parents 3e19908d4c8b
children 38abcb4830f1
comparison
equal deleted inserted replaced
128:576e7e0246cb 129:161af71c80d4
13 FixedSpacedFeatures, SimpleResponse 13 FixedSpacedFeatures, SimpleResponse
14 } from "piper/HigherLevelUtilities"; 14 } from "piper/HigherLevelUtilities";
15 import {toSeconds} from "piper"; 15 import {toSeconds} from "piper";
16 import {FeatureList, Feature} from "piper/Feature"; 16 import {FeatureList, Feature} from "piper/Feature";
17 import * as Hammer from 'hammerjs'; 17 import * as Hammer from 'hammerjs';
18 import {WavesSpectrogramLayer} from "../spectrogram/Spectrogram";
18 19
19 type Timeline = any; // TODO what type actually is it.. start a .d.ts for waves-ui? 20 type Timeline = any; // TODO what type actually is it.. start a .d.ts for waves-ui?
20 type Layer = any; 21 type Layer = any;
21 type Track = any; 22 type Track = any;
22 type Colour = string; 23 type Colour = string;
377 378
378 renderSpectrogram(buffer: AudioBuffer): void { 379 renderSpectrogram(buffer: AudioBuffer): void {
379 const height: number = this.trackDiv.nativeElement.getBoundingClientRect().height / 2; 380 const height: number = this.trackDiv.nativeElement.getBoundingClientRect().height / 2;
380 const gridTrack = this.timeline.getTrackById('grid'); 381 const gridTrack = this.timeline.getTrackById('grid');
381 382
382 const spectrogramLayer = new wavesUI.helpers.SpectrogramLayer(buffer, { 383 const spectrogramLayer = new WavesSpectrogramLayer(buffer, {
383 top: height * 0.05, 384 top: height * 0.05,
384 height: height * 0.9, 385 height: height * 0.9,
385 stepSize: 512, 386 stepSize: 512,
386 fftSize: 1024, 387 blockSize: 1024,
387 normalise: 'none', 388 normalise: 'none',
388 mapper: this.sunsetMapper() 389 mapper: this.sunsetMapper()
389 }); 390 });
390 this.addLayer(spectrogramLayer, gridTrack, this.timeline.timeContext); 391 this.addLayer(spectrogramLayer, gridTrack, this.timeline.timeContext);
391 392