|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141 |
- // 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
- }
- }
|