|
- // tonalisa - software to look at overtone-structures
- // Copyright (C) 2016 Dominik Schmidt-Philipp
- //
- // This program is free software: you can redistribute it and/or modify
- // it under the terms of the GNU General Public License as published by
- // the Free Software Foundation, either version 3 of the License, or
- // (at your option) any later version.
- //
- // This program is distributed in the hope that it will be useful,
- // but WITHOUT ANY WARRANTY; without even the implied warranty of
- // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- // GNU General Public License for more details.
- //
- // You should have received a copy of the GNU General Public License
- // along with this program. If not, see <http://www.gnu.org/licenses/>.
- //
- import QtQuick 2.3
- import QtQuick.Dialogs 1.2
- import QtQuick.Controls 1.2
-
- import art.freakaria.ton 1.0
-
-
- Item {
- id:root
-
- property alias audio:activeAudioFile
-
- AudioFile {
- id:activeAudioFile
- }
-
- Peaks {
- id: peakCalculator
- fftData: activeAudioFile.spectrum
- sampleRate:activeAudioFile.sampleRate
- windowIndex:activeAudioFile.windowIndex
- windowSize:activeAudioFile.windowSize
-
- onPeaksChanged: {
- buffer.spectrumF0 = peaks
- var tmp=[]
- for(var i=0;i<peaks.length;i++){
- if(i%2)
- tmp.push(peaks[i])
- else
- tmp.push(peaks[i]/peaks[0])
-
- }
- buffer.spectrumR1 = tmp
- }
- }
-
- FileDialog {
- id:fileDialog
- title:"choose a sound file"
- //folder: shortcuts.home
- onAccepted: {
- activeAudioFile.path = fileDialog.fileUrl
- }
- onRejected: {
- // console.log("cancelled")
- }
- }
-
- Waveform {
- id:audioDisplay
- height:70;width:parent.width
- }
-
- Column {
- y:audioDisplay.height
- spacing: 2
- Row {
- Button {
- id: openFileButton
-
- focus:true
- text: "open"
- onClicked: { fileDialog.open() }
- }
- }
- Row {
- ComboBox {
- id:transformSizeSelect
- width:70;
- currentIndex:3;
- property var sizes:[512,1024,2048,4096,8192,16384,32768]
- onCurrentIndexChanged: {
- activeAudioFile.npts = sizes[currentIndex]
- windowSizeInput.update_position();
- activeAudioFile.calculateFFT()
- }
- model:sizes
- }
- ComboBox {
- id:windowSelect
- width: 150
- model: ["Rectangular", "Hann", "Welch", "Parzen", "Bartlett", "Hamming", "Blackman2", "Blackman3", "Blackman4", "Exponential", "Riemann", "Kaiser", "Cauchy", "Poisson", "Gaussian", "Tukey", "Dolph-Chebyshev", "Hann-Poisson", "Connes", "Samaraki", "Ultraspherical", "Bartlett-Hann", "Bohman", "Flat-top", "Blackman5", "Blackman6", "Blackman7", "Blackman8", "Blackman9", "Blackman10", "Rife-Vincent2", "Rife-Vincent3", "Rife-Vincent4", "MLT Sine", "Papoulis", "DPSS (Slepian)", "Sinc"]
- currentIndex:1;
- onCurrentIndexChanged: {
- activeAudioFile.windowIndex = currentIndex
- activeAudioFile.calculateFFT()
- }
- }
- Slider {
- y:14
- id:windowSizeInput
- value:0
- onValueChanged: {
- activeAudioFile.windowSize = value * activeAudioFile.npts;//* 40000 + 100;
- }
- function update_position(){
- value = activeAudioFile.windowSize / activeAudioFile.npts;
- console.log(value)
- }
- }
- Text {
- property real samples: activeAudioFile.windowSize;
- text:"window Size: "+ samples +" samples"
- }
-
-
- } // end Transform options row
- Row {
- id:peakFinding
- Text {
- property real thresh: Math.floor(peakCalculator.threshold)
- text: "Threshold: "+thresh+"dB"
- }
- Slider {
- y:14
- id:peakThresholdcontrol
- value:0
- onValueChanged: {
- peakCalculator.threshold = -value*100
- }
- }
- } // end Peakfinding Row
- }
- }
|