mirror of
https://gitlab.com/then-try-this/samplebrain.git
synced 2025-05-12 10:37:20 +00:00
window shapes
This commit is contained in:
parent
4eff545ab2
commit
37eba6d3e1
@ -7,6 +7,7 @@ SRCS := src/fft.cpp \
|
||||
src/main.cpp \
|
||||
src/mfcc.cpp \
|
||||
src/renderer.cpp \
|
||||
src/window.cpp \
|
||||
src/aquila/filter/MelFilterBank.cpp \
|
||||
src/aquila/filter/MelFilter.cpp \
|
||||
src/aquila/transform/Dct.cpp \
|
||||
|
@ -31,7 +31,7 @@
|
||||
<attribute name="title">
|
||||
<string>search</string>
|
||||
</attribute>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_15">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_8">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
@ -307,7 +307,7 @@
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_9">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_6">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_16">
|
||||
<property name="font">
|
||||
@ -410,6 +410,76 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="3" column="0">
|
||||
<widget class="QRadioButton" name="radioButton_bartlettTarget">
|
||||
<property name="text">
|
||||
<string>bartlett</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QRadioButton" name="radioButton_blackmanTarget">
|
||||
<property name="text">
|
||||
<string>blackman</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QRadioButton" name="radioButton_gaussianTarget">
|
||||
<property name="text">
|
||||
<string>gaussian</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QRadioButton" name="radioButton_hammingTarget">
|
||||
<property name="text">
|
||||
<string>hamming</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QRadioButton" name="radioButton_hannTarget">
|
||||
<property name="text">
|
||||
<string>hann</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QRadioButton" name="radioButton_flattopTarget">
|
||||
<property name="text">
|
||||
<string>flat top</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QRadioButton" name="radioButton_dodgyTarget">
|
||||
<property name="text">
|
||||
<string>dodgy</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QRadioButton" name="radioButton_rectangleTarget">
|
||||
<property name="text">
|
||||
<string>rectangle</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_14">
|
||||
<property name="text">
|
||||
<string>window shape</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButtonGenerateTarget">
|
||||
<property name="font">
|
||||
@ -445,7 +515,7 @@
|
||||
<attribute name="title">
|
||||
<string>brain</string>
|
||||
</attribute>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_8">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
@ -523,23 +593,72 @@
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Comic Sans MS</family>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="3" column="0">
|
||||
<widget class="QRadioButton" name="radioButton_bartlett">
|
||||
<property name="text">
|
||||
<string>fft spectrum size</string>
|
||||
<string>bartlett</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="spinBoxSpectSize"/>
|
||||
<item row="2" column="0">
|
||||
<widget class="QRadioButton" name="radioButton_dodgy">
|
||||
<property name="text">
|
||||
<string>dodgy</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QRadioButton" name="radioButton_blackman">
|
||||
<property name="text">
|
||||
<string>blackman</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QRadioButton" name="radioButton_gaussian">
|
||||
<property name="text">
|
||||
<string>gaussian</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QRadioButton" name="radioButton_hamming">
|
||||
<property name="text">
|
||||
<string>hamming</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QRadioButton" name="radioButton_hann">
|
||||
<property name="text">
|
||||
<string>hann</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QRadioButton" name="radioButton_flattop">
|
||||
<property name="text">
|
||||
<string>flat top</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QRadioButton" name="radioButton_rectagle">
|
||||
<property name="text">
|
||||
<string>rectangle</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>window shape</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
@ -597,7 +716,7 @@
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
<height>508</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
@ -873,22 +992,6 @@
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>spinBoxSpectSize</sender>
|
||||
<signal>valueChanged(int)</signal>
|
||||
<receiver>MainWindow</receiver>
|
||||
<slot>fft_spectrum_size(int)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>188</x>
|
||||
<y>171</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>399</x>
|
||||
<y>301</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>pushButtonGenerate</sender>
|
||||
<signal>released()</signal>
|
||||
@ -1017,6 +1120,262 @@
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>radioButton_bartlett</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>MainWindow</receiver>
|
||||
<slot>window_bartlett(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>75</x>
|
||||
<y>232</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>361</x>
|
||||
<y>301</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>radioButton_blackman</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>MainWindow</receiver>
|
||||
<slot>window_blackman(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>75</x>
|
||||
<y>261</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>361</x>
|
||||
<y>301</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>radioButton_dodgy</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>MainWindow</receiver>
|
||||
<slot>window_dodgy(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>75</x>
|
||||
<y>203</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>361</x>
|
||||
<y>301</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>radioButton_flattop</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>MainWindow</receiver>
|
||||
<slot>window_flattop(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>75</x>
|
||||
<y>290</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>361</x>
|
||||
<y>301</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>radioButton_gaussian</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>MainWindow</receiver>
|
||||
<slot>window_gaussian(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>188</x>
|
||||
<y>203</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>361</x>
|
||||
<y>301</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>radioButton_hamming</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>MainWindow</receiver>
|
||||
<slot>window_hamming(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>188</x>
|
||||
<y>232</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>361</x>
|
||||
<y>301</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>radioButton_hann</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>MainWindow</receiver>
|
||||
<slot>window_hann(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>188</x>
|
||||
<y>261</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>361</x>
|
||||
<y>301</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>radioButton_rectagle</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>MainWindow</receiver>
|
||||
<slot>window_rectangle(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>188</x>
|
||||
<y>290</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>361</x>
|
||||
<y>301</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>radioButton_bartlettTarget</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>MainWindow</receiver>
|
||||
<slot>window_target_bartlett(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>449</x>
|
||||
<y>290</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>361</x>
|
||||
<y>301</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>radioButton_blackmanTarget</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>MainWindow</receiver>
|
||||
<slot>window_target_blackman(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>449</x>
|
||||
<y>319</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>361</x>
|
||||
<y>301</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>radioButton_dodgyTarget</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>MainWindow</receiver>
|
||||
<slot>window_target_dodgy(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>449</x>
|
||||
<y>261</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>361</x>
|
||||
<y>301</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>radioButton_flattopTarget</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>MainWindow</receiver>
|
||||
<slot>window_target_flattop(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>449</x>
|
||||
<y>348</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>361</x>
|
||||
<y>301</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>radioButton_gaussianTarget</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>MainWindow</receiver>
|
||||
<slot>window_target_gaussian(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>619</x>
|
||||
<y>261</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>361</x>
|
||||
<y>301</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>radioButton_hammingTarget</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>MainWindow</receiver>
|
||||
<slot>window_target_hamming(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>619</x>
|
||||
<y>290</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>361</x>
|
||||
<y>301</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>radioButton_hannTarget</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>MainWindow</receiver>
|
||||
<slot>window_target_hann(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>619</x>
|
||||
<y>319</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>361</x>
|
||||
<y>301</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>radioButton_rectangleTarget</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>MainWindow</receiver>
|
||||
<slot>window_target_rectangle(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>619</x>
|
||||
<y>348</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>361</x>
|
||||
<y>301</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
<slots>
|
||||
<slot>play_slot()</slot>
|
||||
@ -1042,5 +1401,21 @@
|
||||
<slot>generate_target_blocks()</slot>
|
||||
<slot>clear_brain()</slot>
|
||||
<slot>restart_audio()</slot>
|
||||
<slot>window_dodgy(bool)</slot>
|
||||
<slot>window_bartlett(bool)</slot>
|
||||
<slot>window_blackman(bool)</slot>
|
||||
<slot>window_flattop(bool)</slot>
|
||||
<slot>window_gaussian(bool)</slot>
|
||||
<slot>window_hamming(bool)</slot>
|
||||
<slot>window_hann(bool)</slot>
|
||||
<slot>window_rectangle(bool)</slot>
|
||||
<slot>window_target_dodgy(bool)</slot>
|
||||
<slot>window_target_bartlett(bool)</slot>
|
||||
<slot>window_target_blackman(bool)</slot>
|
||||
<slot>window_target_flattop(bool)</slot>
|
||||
<slot>window_target_gaussian(bool)</slot>
|
||||
<slot>window_target_hamming(bool)</slot>
|
||||
<slot>window_target_hann(bool)</slot>
|
||||
<slot>window_target_rectangle(bool)</slot>
|
||||
</slots>
|
||||
</ui>
|
||||
|
@ -3,8 +3,10 @@
|
||||
|
||||
#include <iostream>
|
||||
#include <lo/lo.h>
|
||||
#include "window.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace spiralcore;
|
||||
|
||||
class MainWindow : public QMainWindow
|
||||
{
|
||||
@ -71,6 +73,24 @@ private slots:
|
||||
}
|
||||
void restart_audio() { lo_send(m_audio_address,"/restart_audio",""); }
|
||||
|
||||
void window_dodgy(bool s) { if (s) lo_send(m_process_address,"/window_type","i",window::DODGY); }
|
||||
void window_bartlett(bool s) { if (s) lo_send(m_process_address,"/window_type","i",window::BARTLETT); }
|
||||
void window_blackman(bool s) { if (s) lo_send(m_process_address,"/window_type","i",window::BLACKMAN); }
|
||||
void window_flattop(bool s) { if (s) lo_send(m_process_address,"/window_type","i",window::FLAT_TOP); }
|
||||
void window_gaussian(bool s) { if (s) lo_send(m_process_address,"/window_type","i",window::GAUSSIAN); }
|
||||
void window_hamming(bool s) { if (s) lo_send(m_process_address,"/window_type","i",window::HAMMING); }
|
||||
void window_hann(bool s) { if (s) lo_send(m_process_address,"/window_type","i",window::HANN); }
|
||||
void window_rectangle(bool s) { if (s) lo_send(m_process_address,"/window_type","i",window::RECTANGLE); }
|
||||
|
||||
void window_target_dodgy(bool s) { if (s) lo_send(m_process_address,"/target_window_type","i",window::DODGY); }
|
||||
void window_target_bartlett(bool s) { if (s) lo_send(m_process_address,"/target_window_type","i",window::BARTLETT); }
|
||||
void window_target_blackman(bool s) { if (s) lo_send(m_process_address,"/target_window_type","i",window::BLACKMAN); }
|
||||
void window_target_flattop(bool s) { if (s) lo_send(m_process_address,"/target_window_type","i",window::FLAT_TOP); }
|
||||
void window_target_gaussian(bool s) { if (s) lo_send(m_process_address,"/target_window_type","i",window::GAUSSIAN); }
|
||||
void window_target_hamming(bool s) { if (s) lo_send(m_process_address,"/target_window_type","i",window::HAMMING); }
|
||||
void window_target_hann(bool s) { if (s) lo_send(m_process_address,"/target_window_type","i",window::HANN); }
|
||||
void window_target_rectangle(bool s) { if (s) lo_send(m_process_address,"/target_window_type","i",window::RECTANGLE); }
|
||||
|
||||
private:
|
||||
Ui_MainWindow m_Ui;
|
||||
lo_address m_audio_address;
|
||||
|
@ -59,10 +59,10 @@ void audio_thread::process(sample &s, sample &s2) {
|
||||
}
|
||||
if (name=="/restart_audio") {
|
||||
start_audio();
|
||||
}
|
||||
if (name=="/volume") {
|
||||
m_renderer->set_volume(cmd.get_float(0)*10);
|
||||
}
|
||||
}
|
||||
if (name=="/volume") {
|
||||
m_renderer->set_volume(cmd.get_float(0)*10);
|
||||
}
|
||||
}
|
||||
|
||||
s.zero();
|
||||
|
@ -1,14 +1,14 @@
|
||||
/********************************************************************************
|
||||
** Form generated from reading UI file 'samplebrainHz5241.ui'
|
||||
** Form generated from reading UI file 'samplebrainSB4993.ui'
|
||||
**
|
||||
** Created: Sat Jul 11 20:24:05 2015
|
||||
** Created: Sat Jul 18 19:57:06 2015
|
||||
** by: Qt User Interface Compiler version 4.8.1
|
||||
**
|
||||
** WARNING! All changes made in this file will be lost when recompiling UI file!
|
||||
********************************************************************************/
|
||||
|
||||
#ifndef SAMPLEBRAINHZ5241_H
|
||||
#define SAMPLEBRAINHZ5241_H
|
||||
#ifndef SAMPLEBRAINSB4993_H
|
||||
#define SAMPLEBRAINSB4993_H
|
||||
|
||||
#include <QtCore/QVariant>
|
||||
#include <QtGui/QAction>
|
||||
@ -16,12 +16,14 @@
|
||||
#include <QtGui/QButtonGroup>
|
||||
#include <QtGui/QDial>
|
||||
#include <QtGui/QDoubleSpinBox>
|
||||
#include <QtGui/QGridLayout>
|
||||
#include <QtGui/QHBoxLayout>
|
||||
#include <QtGui/QHeaderView>
|
||||
#include <QtGui/QLabel>
|
||||
#include <QtGui/QListWidget>
|
||||
#include <QtGui/QMainWindow>
|
||||
#include <QtGui/QPushButton>
|
||||
#include <QtGui/QRadioButton>
|
||||
#include <QtGui/QSpacerItem>
|
||||
#include <QtGui/QSpinBox>
|
||||
#include <QtGui/QStatusBar>
|
||||
@ -38,7 +40,7 @@ public:
|
||||
QHBoxLayout *horizontalLayout;
|
||||
QTabWidget *tabWidget;
|
||||
QWidget *controlTab;
|
||||
QHBoxLayout *horizontalLayout_15;
|
||||
QHBoxLayout *horizontalLayout_8;
|
||||
QVBoxLayout *verticalLayout_3;
|
||||
QLabel *label_19;
|
||||
QHBoxLayout *horizontalLayout_12;
|
||||
@ -68,7 +70,7 @@ public:
|
||||
QHBoxLayout *horizontalLayout_17;
|
||||
QDial *dialVolume;
|
||||
QPushButton *pushButtonRestartAudio;
|
||||
QVBoxLayout *verticalLayout_9;
|
||||
QVBoxLayout *verticalLayout_6;
|
||||
QLabel *label_16;
|
||||
QLabel *label_15;
|
||||
QPushButton *pushButtonLoadTarget;
|
||||
@ -78,10 +80,20 @@ public:
|
||||
QHBoxLayout *horizontalLayout_14;
|
||||
QLabel *label_18;
|
||||
QDoubleSpinBox *doubleSpinBoxBlockOverlapTarget;
|
||||
QGridLayout *gridLayout_2;
|
||||
QRadioButton *radioButton_bartlettTarget;
|
||||
QRadioButton *radioButton_blackmanTarget;
|
||||
QRadioButton *radioButton_gaussianTarget;
|
||||
QRadioButton *radioButton_hammingTarget;
|
||||
QRadioButton *radioButton_hannTarget;
|
||||
QRadioButton *radioButton_flattopTarget;
|
||||
QRadioButton *radioButton_dodgyTarget;
|
||||
QRadioButton *radioButton_rectangleTarget;
|
||||
QLabel *label_14;
|
||||
QPushButton *pushButtonGenerateTarget;
|
||||
QSpacerItem *verticalSpacer;
|
||||
QWidget *sampleTab;
|
||||
QHBoxLayout *horizontalLayout_8;
|
||||
QHBoxLayout *horizontalLayout_5;
|
||||
QVBoxLayout *verticalLayout_2;
|
||||
QLabel *label_3;
|
||||
QHBoxLayout *horizontalLayout_4;
|
||||
@ -90,9 +102,16 @@ public:
|
||||
QHBoxLayout *horizontalLayout_6;
|
||||
QLabel *label_2;
|
||||
QDoubleSpinBox *doubleSpinBoxBlockOverlap;
|
||||
QHBoxLayout *horizontalLayout_5;
|
||||
QGridLayout *gridLayout;
|
||||
QRadioButton *radioButton_bartlett;
|
||||
QRadioButton *radioButton_dodgy;
|
||||
QRadioButton *radioButton_blackman;
|
||||
QRadioButton *radioButton_gaussian;
|
||||
QRadioButton *radioButton_hamming;
|
||||
QRadioButton *radioButton_hann;
|
||||
QRadioButton *radioButton_flattop;
|
||||
QRadioButton *radioButton_rectagle;
|
||||
QLabel *label_4;
|
||||
QSpinBox *spinBoxSpectSize;
|
||||
QPushButton *pushButtonGenerate;
|
||||
QHBoxLayout *horizontalLayout_7;
|
||||
QPushButton *pushButtonLosdBrain;
|
||||
@ -125,8 +144,8 @@ public:
|
||||
tabWidget->setFont(font);
|
||||
controlTab = new QWidget();
|
||||
controlTab->setObjectName(QString::fromUtf8("controlTab"));
|
||||
horizontalLayout_15 = new QHBoxLayout(controlTab);
|
||||
horizontalLayout_15->setObjectName(QString::fromUtf8("horizontalLayout_15"));
|
||||
horizontalLayout_8 = new QHBoxLayout(controlTab);
|
||||
horizontalLayout_8->setObjectName(QString::fromUtf8("horizontalLayout_8"));
|
||||
verticalLayout_3 = new QVBoxLayout();
|
||||
verticalLayout_3->setObjectName(QString::fromUtf8("verticalLayout_3"));
|
||||
label_19 = new QLabel(controlTab);
|
||||
@ -306,27 +325,27 @@ public:
|
||||
verticalLayout_3->addLayout(horizontalLayout_17);
|
||||
|
||||
|
||||
horizontalLayout_15->addLayout(verticalLayout_3);
|
||||
horizontalLayout_8->addLayout(verticalLayout_3);
|
||||
|
||||
verticalLayout_9 = new QVBoxLayout();
|
||||
verticalLayout_9->setObjectName(QString::fromUtf8("verticalLayout_9"));
|
||||
verticalLayout_6 = new QVBoxLayout();
|
||||
verticalLayout_6->setObjectName(QString::fromUtf8("verticalLayout_6"));
|
||||
label_16 = new QLabel(controlTab);
|
||||
label_16->setObjectName(QString::fromUtf8("label_16"));
|
||||
label_16->setFont(font1);
|
||||
|
||||
verticalLayout_9->addWidget(label_16);
|
||||
verticalLayout_6->addWidget(label_16);
|
||||
|
||||
label_15 = new QLabel(controlTab);
|
||||
label_15->setObjectName(QString::fromUtf8("label_15"));
|
||||
label_15->setFont(font);
|
||||
|
||||
verticalLayout_9->addWidget(label_15);
|
||||
verticalLayout_6->addWidget(label_15);
|
||||
|
||||
pushButtonLoadTarget = new QPushButton(controlTab);
|
||||
pushButtonLoadTarget->setObjectName(QString::fromUtf8("pushButtonLoadTarget"));
|
||||
pushButtonLoadTarget->setFont(font);
|
||||
|
||||
verticalLayout_9->addWidget(pushButtonLoadTarget);
|
||||
verticalLayout_6->addWidget(pushButtonLoadTarget);
|
||||
|
||||
horizontalLayout_13 = new QHBoxLayout();
|
||||
horizontalLayout_13->setObjectName(QString::fromUtf8("horizontalLayout_13"));
|
||||
@ -344,7 +363,7 @@ public:
|
||||
horizontalLayout_13->addWidget(spinBoxBlockSizeTarget);
|
||||
|
||||
|
||||
verticalLayout_9->addLayout(horizontalLayout_13);
|
||||
verticalLayout_6->addLayout(horizontalLayout_13);
|
||||
|
||||
horizontalLayout_14 = new QHBoxLayout();
|
||||
horizontalLayout_14->setObjectName(QString::fromUtf8("horizontalLayout_14"));
|
||||
@ -363,26 +382,77 @@ public:
|
||||
horizontalLayout_14->addWidget(doubleSpinBoxBlockOverlapTarget);
|
||||
|
||||
|
||||
verticalLayout_9->addLayout(horizontalLayout_14);
|
||||
verticalLayout_6->addLayout(horizontalLayout_14);
|
||||
|
||||
gridLayout_2 = new QGridLayout();
|
||||
gridLayout_2->setObjectName(QString::fromUtf8("gridLayout_2"));
|
||||
radioButton_bartlettTarget = new QRadioButton(controlTab);
|
||||
radioButton_bartlettTarget->setObjectName(QString::fromUtf8("radioButton_bartlettTarget"));
|
||||
|
||||
gridLayout_2->addWidget(radioButton_bartlettTarget, 3, 0, 1, 1);
|
||||
|
||||
radioButton_blackmanTarget = new QRadioButton(controlTab);
|
||||
radioButton_blackmanTarget->setObjectName(QString::fromUtf8("radioButton_blackmanTarget"));
|
||||
|
||||
gridLayout_2->addWidget(radioButton_blackmanTarget, 4, 0, 1, 1);
|
||||
|
||||
radioButton_gaussianTarget = new QRadioButton(controlTab);
|
||||
radioButton_gaussianTarget->setObjectName(QString::fromUtf8("radioButton_gaussianTarget"));
|
||||
|
||||
gridLayout_2->addWidget(radioButton_gaussianTarget, 2, 1, 1, 1);
|
||||
|
||||
radioButton_hammingTarget = new QRadioButton(controlTab);
|
||||
radioButton_hammingTarget->setObjectName(QString::fromUtf8("radioButton_hammingTarget"));
|
||||
|
||||
gridLayout_2->addWidget(radioButton_hammingTarget, 3, 1, 1, 1);
|
||||
|
||||
radioButton_hannTarget = new QRadioButton(controlTab);
|
||||
radioButton_hannTarget->setObjectName(QString::fromUtf8("radioButton_hannTarget"));
|
||||
|
||||
gridLayout_2->addWidget(radioButton_hannTarget, 4, 1, 1, 1);
|
||||
|
||||
radioButton_flattopTarget = new QRadioButton(controlTab);
|
||||
radioButton_flattopTarget->setObjectName(QString::fromUtf8("radioButton_flattopTarget"));
|
||||
|
||||
gridLayout_2->addWidget(radioButton_flattopTarget, 5, 0, 1, 1);
|
||||
|
||||
radioButton_dodgyTarget = new QRadioButton(controlTab);
|
||||
radioButton_dodgyTarget->setObjectName(QString::fromUtf8("radioButton_dodgyTarget"));
|
||||
radioButton_dodgyTarget->setChecked(true);
|
||||
|
||||
gridLayout_2->addWidget(radioButton_dodgyTarget, 2, 0, 1, 1);
|
||||
|
||||
radioButton_rectangleTarget = new QRadioButton(controlTab);
|
||||
radioButton_rectangleTarget->setObjectName(QString::fromUtf8("radioButton_rectangleTarget"));
|
||||
|
||||
gridLayout_2->addWidget(radioButton_rectangleTarget, 5, 1, 1, 1);
|
||||
|
||||
label_14 = new QLabel(controlTab);
|
||||
label_14->setObjectName(QString::fromUtf8("label_14"));
|
||||
|
||||
gridLayout_2->addWidget(label_14, 1, 0, 1, 1);
|
||||
|
||||
|
||||
verticalLayout_6->addLayout(gridLayout_2);
|
||||
|
||||
pushButtonGenerateTarget = new QPushButton(controlTab);
|
||||
pushButtonGenerateTarget->setObjectName(QString::fromUtf8("pushButtonGenerateTarget"));
|
||||
pushButtonGenerateTarget->setFont(font);
|
||||
|
||||
verticalLayout_9->addWidget(pushButtonGenerateTarget);
|
||||
verticalLayout_6->addWidget(pushButtonGenerateTarget);
|
||||
|
||||
verticalSpacer = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding);
|
||||
|
||||
verticalLayout_9->addItem(verticalSpacer);
|
||||
verticalLayout_6->addItem(verticalSpacer);
|
||||
|
||||
|
||||
horizontalLayout_15->addLayout(verticalLayout_9);
|
||||
horizontalLayout_8->addLayout(verticalLayout_6);
|
||||
|
||||
tabWidget->addTab(controlTab, QString());
|
||||
sampleTab = new QWidget();
|
||||
sampleTab->setObjectName(QString::fromUtf8("sampleTab"));
|
||||
horizontalLayout_8 = new QHBoxLayout(sampleTab);
|
||||
horizontalLayout_8->setObjectName(QString::fromUtf8("horizontalLayout_8"));
|
||||
horizontalLayout_5 = new QHBoxLayout(sampleTab);
|
||||
horizontalLayout_5->setObjectName(QString::fromUtf8("horizontalLayout_5"));
|
||||
verticalLayout_2 = new QVBoxLayout();
|
||||
verticalLayout_2->setObjectName(QString::fromUtf8("verticalLayout_2"));
|
||||
label_3 = new QLabel(sampleTab);
|
||||
@ -428,21 +498,56 @@ public:
|
||||
|
||||
verticalLayout_2->addLayout(horizontalLayout_6);
|
||||
|
||||
horizontalLayout_5 = new QHBoxLayout();
|
||||
horizontalLayout_5->setObjectName(QString::fromUtf8("horizontalLayout_5"));
|
||||
gridLayout = new QGridLayout();
|
||||
gridLayout->setObjectName(QString::fromUtf8("gridLayout"));
|
||||
radioButton_bartlett = new QRadioButton(sampleTab);
|
||||
radioButton_bartlett->setObjectName(QString::fromUtf8("radioButton_bartlett"));
|
||||
|
||||
gridLayout->addWidget(radioButton_bartlett, 3, 0, 1, 1);
|
||||
|
||||
radioButton_dodgy = new QRadioButton(sampleTab);
|
||||
radioButton_dodgy->setObjectName(QString::fromUtf8("radioButton_dodgy"));
|
||||
radioButton_dodgy->setChecked(true);
|
||||
|
||||
gridLayout->addWidget(radioButton_dodgy, 2, 0, 1, 1);
|
||||
|
||||
radioButton_blackman = new QRadioButton(sampleTab);
|
||||
radioButton_blackman->setObjectName(QString::fromUtf8("radioButton_blackman"));
|
||||
|
||||
gridLayout->addWidget(radioButton_blackman, 4, 0, 1, 1);
|
||||
|
||||
radioButton_gaussian = new QRadioButton(sampleTab);
|
||||
radioButton_gaussian->setObjectName(QString::fromUtf8("radioButton_gaussian"));
|
||||
|
||||
gridLayout->addWidget(radioButton_gaussian, 2, 1, 1, 1);
|
||||
|
||||
radioButton_hamming = new QRadioButton(sampleTab);
|
||||
radioButton_hamming->setObjectName(QString::fromUtf8("radioButton_hamming"));
|
||||
|
||||
gridLayout->addWidget(radioButton_hamming, 3, 1, 1, 1);
|
||||
|
||||
radioButton_hann = new QRadioButton(sampleTab);
|
||||
radioButton_hann->setObjectName(QString::fromUtf8("radioButton_hann"));
|
||||
|
||||
gridLayout->addWidget(radioButton_hann, 4, 1, 1, 1);
|
||||
|
||||
radioButton_flattop = new QRadioButton(sampleTab);
|
||||
radioButton_flattop->setObjectName(QString::fromUtf8("radioButton_flattop"));
|
||||
|
||||
gridLayout->addWidget(radioButton_flattop, 5, 0, 1, 1);
|
||||
|
||||
radioButton_rectagle = new QRadioButton(sampleTab);
|
||||
radioButton_rectagle->setObjectName(QString::fromUtf8("radioButton_rectagle"));
|
||||
|
||||
gridLayout->addWidget(radioButton_rectagle, 5, 1, 1, 1);
|
||||
|
||||
label_4 = new QLabel(sampleTab);
|
||||
label_4->setObjectName(QString::fromUtf8("label_4"));
|
||||
label_4->setFont(font);
|
||||
|
||||
horizontalLayout_5->addWidget(label_4);
|
||||
|
||||
spinBoxSpectSize = new QSpinBox(sampleTab);
|
||||
spinBoxSpectSize->setObjectName(QString::fromUtf8("spinBoxSpectSize"));
|
||||
|
||||
horizontalLayout_5->addWidget(spinBoxSpectSize);
|
||||
gridLayout->addWidget(label_4, 1, 0, 1, 1);
|
||||
|
||||
|
||||
verticalLayout_2->addLayout(horizontalLayout_5);
|
||||
verticalLayout_2->addLayout(gridLayout);
|
||||
|
||||
pushButtonGenerate = new QPushButton(sampleTab);
|
||||
pushButtonGenerate->setObjectName(QString::fromUtf8("pushButtonGenerate"));
|
||||
@ -467,12 +572,12 @@ public:
|
||||
|
||||
verticalLayout_2->addLayout(horizontalLayout_7);
|
||||
|
||||
verticalSpacer_2 = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding);
|
||||
verticalSpacer_2 = new QSpacerItem(20, 508, QSizePolicy::Minimum, QSizePolicy::Expanding);
|
||||
|
||||
verticalLayout_2->addItem(verticalSpacer_2);
|
||||
|
||||
|
||||
horizontalLayout_8->addLayout(verticalLayout_2);
|
||||
horizontalLayout_5->addLayout(verticalLayout_2);
|
||||
|
||||
verticalLayout = new QVBoxLayout();
|
||||
verticalLayout->setObjectName(QString::fromUtf8("verticalLayout"));
|
||||
@ -511,7 +616,7 @@ public:
|
||||
verticalLayout->addLayout(horizontalLayout_2);
|
||||
|
||||
|
||||
horizontalLayout_8->addLayout(verticalLayout);
|
||||
horizontalLayout_5->addLayout(verticalLayout);
|
||||
|
||||
tabWidget->addTab(sampleTab, QString());
|
||||
|
||||
@ -535,7 +640,6 @@ public:
|
||||
QObject::connect(spinBoxBlockSizeTarget, SIGNAL(valueChanged(int)), MainWindow, SLOT(target_block_size(int)));
|
||||
QObject::connect(pushButtonGenerateTarget, SIGNAL(released()), MainWindow, SLOT(generate_target_blocks()));
|
||||
QObject::connect(spinBoxBlockSize, SIGNAL(valueChanged(int)), MainWindow, SLOT(block_size(int)));
|
||||
QObject::connect(spinBoxSpectSize, SIGNAL(valueChanged(int)), MainWindow, SLOT(fft_spectrum_size(int)));
|
||||
QObject::connect(pushButtonGenerate, SIGNAL(released()), MainWindow, SLOT(generate()));
|
||||
QObject::connect(pushButtonLoadSound, SIGNAL(released()), MainWindow, SLOT(load_sound()));
|
||||
QObject::connect(dialVolume, SIGNAL(sliderMoved(int)), MainWindow, SLOT(volume_slot(int)));
|
||||
@ -544,6 +648,22 @@ public:
|
||||
QObject::connect(pushButtonClearBrain, SIGNAL(released()), MainWindow, SLOT(clear_brain()));
|
||||
QObject::connect(pushButtonDeleteSound, SIGNAL(released()), MainWindow, SLOT(delete_sound()));
|
||||
QObject::connect(pushButtonRestartAudio, SIGNAL(released()), MainWindow, SLOT(restart_audio()));
|
||||
QObject::connect(radioButton_bartlett, SIGNAL(toggled(bool)), MainWindow, SLOT(window_bartlett(bool)));
|
||||
QObject::connect(radioButton_blackman, SIGNAL(toggled(bool)), MainWindow, SLOT(window_blackman(bool)));
|
||||
QObject::connect(radioButton_dodgy, SIGNAL(toggled(bool)), MainWindow, SLOT(window_dodgy(bool)));
|
||||
QObject::connect(radioButton_flattop, SIGNAL(toggled(bool)), MainWindow, SLOT(window_flattop(bool)));
|
||||
QObject::connect(radioButton_gaussian, SIGNAL(toggled(bool)), MainWindow, SLOT(window_gaussian(bool)));
|
||||
QObject::connect(radioButton_hamming, SIGNAL(toggled(bool)), MainWindow, SLOT(window_hamming(bool)));
|
||||
QObject::connect(radioButton_hann, SIGNAL(toggled(bool)), MainWindow, SLOT(window_hann(bool)));
|
||||
QObject::connect(radioButton_rectagle, SIGNAL(toggled(bool)), MainWindow, SLOT(window_rectangle(bool)));
|
||||
QObject::connect(radioButton_bartlettTarget, SIGNAL(toggled(bool)), MainWindow, SLOT(window_target_bartlett(bool)));
|
||||
QObject::connect(radioButton_blackmanTarget, SIGNAL(toggled(bool)), MainWindow, SLOT(window_target_blackman(bool)));
|
||||
QObject::connect(radioButton_dodgyTarget, SIGNAL(toggled(bool)), MainWindow, SLOT(window_target_dodgy(bool)));
|
||||
QObject::connect(radioButton_flattopTarget, SIGNAL(toggled(bool)), MainWindow, SLOT(window_target_flattop(bool)));
|
||||
QObject::connect(radioButton_gaussianTarget, SIGNAL(toggled(bool)), MainWindow, SLOT(window_target_gaussian(bool)));
|
||||
QObject::connect(radioButton_hammingTarget, SIGNAL(toggled(bool)), MainWindow, SLOT(window_target_hamming(bool)));
|
||||
QObject::connect(radioButton_hannTarget, SIGNAL(toggled(bool)), MainWindow, SLOT(window_target_hann(bool)));
|
||||
QObject::connect(radioButton_rectangleTarget, SIGNAL(toggled(bool)), MainWindow, SLOT(window_target_rectangle(bool)));
|
||||
|
||||
tabWidget->setCurrentIndex(0);
|
||||
|
||||
@ -571,12 +691,29 @@ public:
|
||||
pushButtonLoadTarget->setText(QApplication::translate("MainWindow", "load target", 0, QApplication::UnicodeUTF8));
|
||||
label_17->setText(QApplication::translate("MainWindow", "block size", 0, QApplication::UnicodeUTF8));
|
||||
label_18->setText(QApplication::translate("MainWindow", "block overlap", 0, QApplication::UnicodeUTF8));
|
||||
radioButton_bartlettTarget->setText(QApplication::translate("MainWindow", "bartlett", 0, QApplication::UnicodeUTF8));
|
||||
radioButton_blackmanTarget->setText(QApplication::translate("MainWindow", "blackman", 0, QApplication::UnicodeUTF8));
|
||||
radioButton_gaussianTarget->setText(QApplication::translate("MainWindow", "gaussian", 0, QApplication::UnicodeUTF8));
|
||||
radioButton_hammingTarget->setText(QApplication::translate("MainWindow", "hamming", 0, QApplication::UnicodeUTF8));
|
||||
radioButton_hannTarget->setText(QApplication::translate("MainWindow", "hann", 0, QApplication::UnicodeUTF8));
|
||||
radioButton_flattopTarget->setText(QApplication::translate("MainWindow", "flat top", 0, QApplication::UnicodeUTF8));
|
||||
radioButton_dodgyTarget->setText(QApplication::translate("MainWindow", "dodgy", 0, QApplication::UnicodeUTF8));
|
||||
radioButton_rectangleTarget->setText(QApplication::translate("MainWindow", "rectangle", 0, QApplication::UnicodeUTF8));
|
||||
label_14->setText(QApplication::translate("MainWindow", "window shape", 0, QApplication::UnicodeUTF8));
|
||||
pushButtonGenerateTarget->setText(QApplication::translate("MainWindow", "(re)generate blocks", 0, QApplication::UnicodeUTF8));
|
||||
tabWidget->setTabText(tabWidget->indexOf(controlTab), QApplication::translate("MainWindow", "search", 0, QApplication::UnicodeUTF8));
|
||||
label_3->setText(QApplication::translate("MainWindow", "brain parameters", 0, QApplication::UnicodeUTF8));
|
||||
label->setText(QApplication::translate("MainWindow", "block size", 0, QApplication::UnicodeUTF8));
|
||||
label_2->setText(QApplication::translate("MainWindow", "block overlap", 0, QApplication::UnicodeUTF8));
|
||||
label_4->setText(QApplication::translate("MainWindow", "fft spectrum size", 0, QApplication::UnicodeUTF8));
|
||||
radioButton_bartlett->setText(QApplication::translate("MainWindow", "bartlett", 0, QApplication::UnicodeUTF8));
|
||||
radioButton_dodgy->setText(QApplication::translate("MainWindow", "dodgy", 0, QApplication::UnicodeUTF8));
|
||||
radioButton_blackman->setText(QApplication::translate("MainWindow", "blackman", 0, QApplication::UnicodeUTF8));
|
||||
radioButton_gaussian->setText(QApplication::translate("MainWindow", "gaussian", 0, QApplication::UnicodeUTF8));
|
||||
radioButton_hamming->setText(QApplication::translate("MainWindow", "hamming", 0, QApplication::UnicodeUTF8));
|
||||
radioButton_hann->setText(QApplication::translate("MainWindow", "hann", 0, QApplication::UnicodeUTF8));
|
||||
radioButton_flattop->setText(QApplication::translate("MainWindow", "flat top", 0, QApplication::UnicodeUTF8));
|
||||
radioButton_rectagle->setText(QApplication::translate("MainWindow", "rectangle", 0, QApplication::UnicodeUTF8));
|
||||
label_4->setText(QApplication::translate("MainWindow", "window shape", 0, QApplication::UnicodeUTF8));
|
||||
pushButtonGenerate->setText(QApplication::translate("MainWindow", "(re)generate", 0, QApplication::UnicodeUTF8));
|
||||
pushButtonLosdBrain->setText(QApplication::translate("MainWindow", "load", 0, QApplication::UnicodeUTF8));
|
||||
pushButtonSaveBrain->setText(QApplication::translate("MainWindow", "save", 0, QApplication::UnicodeUTF8));
|
||||
@ -595,4 +732,4 @@ namespace Ui {
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // SAMPLEBRAINHZ5241_H
|
||||
#endif // SAMPLEBRAINSB4993_H
|
||||
|
@ -16,7 +16,8 @@ process_thread::process_thread() :
|
||||
m_source_overlap(0.75),
|
||||
m_target_block_size(3000),
|
||||
m_target_overlap(0.75),
|
||||
m_env(50)
|
||||
m_window_type(window::DODGY),
|
||||
m_target_window_type(window::DODGY)
|
||||
{
|
||||
m_brain_mutex = new pthread_mutex_t;
|
||||
pthread_mutex_init(m_brain_mutex,NULL);
|
||||
@ -35,9 +36,6 @@ void process_thread::process() {
|
||||
while (m_osc.get(cmd)) {
|
||||
string name = cmd.m_name;
|
||||
cerr<<name<<endl;
|
||||
if (name=="/init") {
|
||||
init_brain();
|
||||
}
|
||||
if (name=="/load_sample") {
|
||||
pthread_mutex_lock(m_brain_mutex);
|
||||
m_source.load_sound(cmd.get_string(0));
|
||||
@ -56,7 +54,8 @@ void process_thread::process() {
|
||||
}
|
||||
if (name=="/generate_brain") {
|
||||
pthread_mutex_lock(m_brain_mutex);
|
||||
m_source.init(m_source_block_size, m_source_overlap, m_env);
|
||||
cerr<<m_window_type<<endl;
|
||||
m_source.init(m_source_block_size, m_source_overlap, m_window_type);
|
||||
pthread_mutex_unlock(m_brain_mutex);
|
||||
}
|
||||
if (name=="/load_target") {
|
||||
@ -74,43 +73,18 @@ void process_thread::process() {
|
||||
}
|
||||
if (name=="/generate_target") {
|
||||
pthread_mutex_lock(m_brain_mutex);
|
||||
m_target.init(m_target_block_size, m_target_overlap, m_env);
|
||||
cerr<<m_target_window_type<<endl;
|
||||
m_target.init(m_target_block_size, m_target_overlap, m_target_window_type);
|
||||
pthread_mutex_unlock(m_brain_mutex);
|
||||
}
|
||||
if (name=="/window_type") {
|
||||
m_window_type=(window::type)cmd.get_int(0);
|
||||
}
|
||||
if (name=="/target_window_type") {
|
||||
m_target_window_type=(window::type)cmd.get_int(0);
|
||||
}
|
||||
|
||||
}
|
||||
usleep(500);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void process_thread::init_brain() {
|
||||
pthread_mutex_lock(m_brain_mutex);
|
||||
|
||||
cerr<<"starting"<<endl;
|
||||
// m_source.load_sound("../sound/source/shostakovich6.wav");
|
||||
m_source.load_sound("../../sound/source/808.wav");
|
||||
m_source.load_sound("../../sound/source/joey.wav");
|
||||
m_source.load_sound("../../sound/source/pw2.wav");
|
||||
m_source.load_sound("../../sound/source/pw3.wav");
|
||||
m_source.load_sound("../../sound/source/claps.wav");
|
||||
m_source.load_sound("../../sound/source/eagle.wav");
|
||||
// m_source.load_sound("../sound/source/sailingbybit.wav");
|
||||
|
||||
|
||||
//target.load_sound("../sound/source/sb-left.wav");
|
||||
m_target.load_sound("../../sound/source/apache.wav");
|
||||
cerr<<"loaded sounds"<<endl;
|
||||
cerr<<endl;
|
||||
u32 len=3000;
|
||||
m_source.init(len,len-len,50);
|
||||
m_target.init(len,len-len/8,50);
|
||||
cerr<<"ready..."<<endl;
|
||||
cerr<<"we have "<<m_source.get_num_blocks()<<" brain blocks ("<<m_source.get_num_blocks()*len/44100.0<<" secs)"<<endl<<endl;
|
||||
|
||||
pthread_mutex_unlock(m_brain_mutex);
|
||||
|
||||
//target.resynth_listen("shosta-dream-0.5.wav",source,0.5,a);
|
||||
|
||||
|
||||
}
|
||||
|
@ -9,7 +9,6 @@ namespace spiralcore {
|
||||
class process_thread {
|
||||
public:
|
||||
process_thread();
|
||||
void init_brain();
|
||||
|
||||
brain m_source, m_target;
|
||||
pthread_mutex_t* m_brain_mutex;
|
||||
@ -22,7 +21,8 @@ private:
|
||||
float m_source_overlap;
|
||||
u32 m_target_block_size;
|
||||
float m_target_overlap;
|
||||
float m_env;
|
||||
window::type m_window_type;
|
||||
window::type m_target_window_type;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -1,2 +1,2 @@
|
||||
MelFilter.o: src/aquila/filter/MelFilter.cpp \
|
||||
src/aquila/filter/MelFilter.h src/aquila/filter/../global.h
|
||||
src/aquila/filter/MelFilter.h src/aquila/filter/../global.h
|
||||
|
@ -1,3 +1,3 @@
|
||||
MelFilterBank.o: src/aquila/filter/MelFilterBank.cpp \
|
||||
src/aquila/filter/MelFilterBank.h src/aquila/filter/../global.h \
|
||||
src/aquila/filter/MelFilter.h
|
||||
src/aquila/filter/MelFilterBank.h src/aquila/filter/../global.h \
|
||||
src/aquila/filter/MelFilter.h
|
||||
|
@ -1,2 +1,2 @@
|
||||
Dct.o: src/aquila/transform/Dct.cpp src/aquila/transform/Dct.h \
|
||||
src/aquila/transform/../global.h
|
||||
src/aquila/transform/../global.h
|
||||
|
@ -10,16 +10,8 @@ Aquila::Mfcc *block::m_mfcc_proc;
|
||||
|
||||
static const int MFCC_FILTERS=12;
|
||||
|
||||
void enveloper(sample &s, u32 start, u32 end) {
|
||||
for(u32 i=0; i<start; ++i) {
|
||||
s[i]*=i/(float)start;
|
||||
}
|
||||
for(u32 i=0; i<end; ++i) {
|
||||
s[(s.get_length()-1)-i]*=i/(float)end;
|
||||
}
|
||||
}
|
||||
|
||||
block::block(const string &filename, const sample &pcm, u32 rate, u32 env, bool ditchpcm) :
|
||||
block::block(const string &filename, const sample &pcm, u32 rate, const window &w, bool ditchpcm) :
|
||||
m_pcm(pcm),
|
||||
m_fft(pcm.get_length()),
|
||||
m_mfcc(MFCC_FILTERS),
|
||||
@ -31,7 +23,7 @@ block::block(const string &filename, const sample &pcm, u32 rate, u32 env, bool
|
||||
assert(m_mfcc_proc!=NULL);
|
||||
assert(m_fftw!=NULL);
|
||||
|
||||
enveloper(m_pcm,env,env);
|
||||
w.run(m_pcm);
|
||||
|
||||
m_fftw->impulse2freq(m_pcm.get_non_const_buffer());
|
||||
|
||||
@ -112,8 +104,11 @@ bool block::unit_test() {
|
||||
for (u32 i=0; i<data.get_length(); i++) {
|
||||
data[i]=i/(float)data.get_length();
|
||||
}
|
||||
window w;
|
||||
w.init(data.get_length());
|
||||
w.set_current_type(window::RECTANGLE);
|
||||
|
||||
block bb("test",data,44100,0);
|
||||
block bb("test",data,44100,w);
|
||||
|
||||
assert(bb.m_pcm.get_length()==data.get_length());
|
||||
//assert(bb.m_fft.get_length()==data.get_length());
|
||||
@ -123,8 +118,7 @@ bool block::unit_test() {
|
||||
assert(bb.m_block_size==data.get_length());
|
||||
|
||||
search_params p(0,0,100,0,100);
|
||||
|
||||
block bb2("test",data,44100,0);
|
||||
block bb2("test",data,44100,w);
|
||||
assert(bb.compare(bb2,p)==0);
|
||||
p.m_ratio=1;
|
||||
assert(bb.compare(bb2,p)==0);
|
||||
@ -136,9 +130,9 @@ bool block::unit_test() {
|
||||
data[i]=i%10;
|
||||
}
|
||||
|
||||
block cpy("test",data,100,4);
|
||||
block cpy("test",data,100,w);
|
||||
{
|
||||
block bb3("test",data2,44100,4);
|
||||
block bb3("test",data2,44100,w);
|
||||
p.m_ratio=0.0;
|
||||
assert(bb.compare(bb3,p)!=0);
|
||||
assert(bb.compare(bb3,p)!=0);
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include "fft.h"
|
||||
#include "mfcc.h"
|
||||
#include "search_params.h"
|
||||
#include "window.h"
|
||||
|
||||
#ifndef BLOCK
|
||||
#define BLOCK
|
||||
@ -13,7 +14,7 @@ namespace spiralcore {
|
||||
class block {
|
||||
public:
|
||||
// runs analysis on pcm
|
||||
block(const std::string &filename, const sample &pcm, u32 rate, u32 env, bool ditchpcm=false);
|
||||
block(const std::string &filename, const sample &pcm, u32 rate, const window &w, bool ditchpcm=false);
|
||||
|
||||
// returns distance based on ratio of fft-mfcc values
|
||||
double compare(const block &other, const search_params ¶ms) const;
|
||||
|
@ -1,5 +1,6 @@
|
||||
#include <iostream>
|
||||
#include <sndfile.h>
|
||||
#include <jellyfish/audio.h>
|
||||
#include "brain.h"
|
||||
|
||||
using namespace std;
|
||||
@ -31,41 +32,28 @@ void brain::delete_sound(std::string filename) {
|
||||
}
|
||||
}
|
||||
|
||||
void save_sample(const string &filename, const sample s) {
|
||||
SF_INFO sfinfo;
|
||||
sfinfo.format=SF_FORMAT_WAV | SF_FORMAT_FLOAT;
|
||||
sfinfo.frames=s.get_length();
|
||||
sfinfo.samplerate=44100;
|
||||
sfinfo.channels=1;
|
||||
sfinfo.sections=1;
|
||||
sfinfo.seekable=0;
|
||||
SNDFILE* f=sf_open(filename.c_str(), SFM_WRITE, &sfinfo);
|
||||
if (!f) cerr<<"couldn't open "<<filename<<endl;
|
||||
u32 written = sf_writef_float(f, s.get_buffer(), s.get_length());
|
||||
if (written!=s.get_length()) cerr<<"error: wrote "<<written<<endl;
|
||||
sf_close(f);
|
||||
}
|
||||
|
||||
// rewrites whole brain
|
||||
void brain::init(u32 block_size, u32 overlap, u32 env, bool ditchpcm) {
|
||||
void brain::init(u32 block_size, u32 overlap, window::type t, bool ditchpcm) {
|
||||
m_blocks.clear();
|
||||
m_block_size = block_size;
|
||||
m_overlap = overlap;
|
||||
m_window.init(block_size);
|
||||
m_window.set_current_type(t);
|
||||
for (std::list<sound>::iterator i=m_samples.begin(); i!=m_samples.end(); ++i) {
|
||||
chop_and_add(i->m_sample, block_size, overlap, env, ditchpcm);
|
||||
chop_and_add(i->m_sample, ditchpcm);
|
||||
}
|
||||
}
|
||||
|
||||
void brain::chop_and_add(const sample &s, u32 block_size, u32 overlap, u32 env, bool ditchpcm) {
|
||||
void brain::chop_and_add(const sample &s, bool ditchpcm) {
|
||||
u32 pos=0;
|
||||
if (overlap>=block_size) overlap=0;
|
||||
while (pos+block_size-1<s.get_length()) {
|
||||
if (m_overlap>=m_block_size) m_overlap=0;
|
||||
while (pos+m_block_size-1<s.get_length()) {
|
||||
cerr<<'\r';
|
||||
cerr<<"adding: "<<pos/(float)s.get_length()*100;
|
||||
sample region;
|
||||
s.get_region(region,pos,pos+block_size-1);
|
||||
m_blocks.push_back(block("",region,44100,env,ditchpcm));
|
||||
pos += (block_size-overlap);
|
||||
s.get_region(region,pos,pos+m_block_size-1);
|
||||
m_blocks.push_back(block("",region,44100,m_window,ditchpcm));
|
||||
pos += (m_block_size-m_overlap);
|
||||
}
|
||||
}
|
||||
|
||||
@ -110,13 +98,13 @@ void brain::resynth(const string &filename, const brain &other, const search_par
|
||||
out.mul_mix(other.get_block_pcm(index),pos,0.2);
|
||||
|
||||
if (count%1000==0) {
|
||||
save_sample(filename,out);
|
||||
audio_device::save_sample(filename,out);
|
||||
}
|
||||
|
||||
++count;
|
||||
pos += (m_block_size-m_overlap);
|
||||
}
|
||||
save_sample(filename,out);
|
||||
audio_device::save_sample(filename,out);
|
||||
}
|
||||
|
||||
|
||||
@ -128,23 +116,26 @@ bool brain::unit_test() {
|
||||
b.load_sound("test_data/100f32.wav");
|
||||
b.load_sound("test_data/100i16.wav");
|
||||
assert(b.m_samples.size()==2);
|
||||
b.init(10, 0, 0);
|
||||
cerr<<"hjelele"<<endl;
|
||||
|
||||
b.init(10, 0, window::RECTANGLE);
|
||||
assert(b.m_blocks.size()==20);
|
||||
b.init(10, 5, 0);
|
||||
b.init(10, 5, window::RECTANGLE);
|
||||
assert(b.m_samples.size()==2);
|
||||
assert(b.m_blocks.size()==38);
|
||||
b.init(20, 5, 0);
|
||||
b.init(20, 5, window::RECTANGLE);
|
||||
assert(b.m_samples.size()==2);
|
||||
assert(b.m_blocks.size()==12);
|
||||
|
||||
|
||||
// replicate brains
|
||||
brain b2;
|
||||
b2.load_sound("test_data/up.wav");
|
||||
brain b3;
|
||||
b3.load_sound("test_data/up.wav");
|
||||
|
||||
b2.init(512, 0, 20);
|
||||
b3.init(512, 0, 20);
|
||||
b2.init(512, 0, window::BLACKMAN);
|
||||
b3.init(512, 0, window::BLACKMAN);
|
||||
|
||||
search_params p(1,0,100,0,100);
|
||||
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include "jellyfish/fluxa/sample.h"
|
||||
#include "block.h"
|
||||
#include "search_params.h"
|
||||
#include "window.h"
|
||||
|
||||
#ifndef BRAIN
|
||||
#define BRAIN
|
||||
@ -16,7 +17,7 @@ public:
|
||||
brain();
|
||||
|
||||
// rewrites whole brain
|
||||
void init(u32 block_size, u32 overlap, u32 env, bool ditchpcm=false);
|
||||
void init(u32 block_size, u32 overlap, window::type t, bool ditchpcm=false);
|
||||
|
||||
class sound {
|
||||
public:
|
||||
@ -48,7 +49,7 @@ public:
|
||||
|
||||
private:
|
||||
|
||||
void chop_and_add(const sample &s, u32 block_size, u32 overlap, u32 env, bool ditchpcm=false);
|
||||
void chop_and_add(const sample &s, bool ditchpcm=false);
|
||||
|
||||
vector<block> m_blocks;
|
||||
std::list<sound> m_samples;
|
||||
@ -56,6 +57,8 @@ private:
|
||||
u32 m_block_size;
|
||||
u32 m_overlap;
|
||||
|
||||
window m_window;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -58,30 +58,35 @@ int main(int argc, char *argv[])
|
||||
cerr<<"starting"<<endl;
|
||||
brain source, target;
|
||||
// source.load_sound("../sound/source/shostakovich6.wav");
|
||||
source.load_sound("../sound/source/808.wav");
|
||||
source.load_sound("../sound/source/joey.wav");
|
||||
source.load_sound("../sound/source/pw2.wav");
|
||||
source.load_sound("../sound/source/pw3.wav");
|
||||
source.load_sound("../sound/source/claps.wav");
|
||||
source.load_sound("../sound/source/eagle.wav");
|
||||
|
||||
// source.load_sound("../sound/source/808.wav");
|
||||
// source.load_sound("../sound/source/joey.wav");
|
||||
// source.load_sound("../sound/source/pw2.wav");
|
||||
// source.load_sound("../sound/source/pw3.wav");
|
||||
// source.load_sound("../sound/source/claps.wav");
|
||||
// source.load_sound("../sound/source/eagle.wav");
|
||||
|
||||
// source.load_sound("../sound/source/sailingbybit.wav");
|
||||
source.load_sound("../sound/source/rise.wav");
|
||||
|
||||
|
||||
//target.load_sound("../sound/source/sb-left.wav");
|
||||
target.load_sound("../sound/source/apache.wav");
|
||||
target.load_sound("../sound/source/rise.wav");
|
||||
cerr<<"loaded sounds"<<endl;
|
||||
cerr<<endl;
|
||||
u32 len=3000;
|
||||
source.init(len,len-len,50);
|
||||
target.init(len,len-len/8,50);
|
||||
source.init(len,len-len,window::DODGY);
|
||||
target.init(len,len-len/4,window::DODGY);
|
||||
cerr<<"ready..."<<endl;
|
||||
cerr<<"we have "<<source.get_num_blocks()<<" brain blocks ("<<source.get_num_blocks()*len/44100.0<<" secs)"<<endl<<endl;
|
||||
|
||||
a = new audio_device("samplebrain",44100,2048);
|
||||
a = new audio_device("samplebrain",44100,4096);
|
||||
|
||||
//target.resynth_listen("shosta-dream-0.5.wav",source,0.5,a);
|
||||
|
||||
renderer rr(source,target);
|
||||
rr.set_playing(true);
|
||||
rr.get_params()->m_ratio=0;
|
||||
|
||||
a->m_client.set_callback(run_audio, &rr);
|
||||
|
||||
|
@ -91,26 +91,29 @@ void renderer::process(u32 nframes, float *buf) {
|
||||
bool renderer::unit_test() {
|
||||
brain source;
|
||||
source.load_sound("test_data/up.wav");
|
||||
source.init(10,0,0);
|
||||
source.init(10,0,window::RECTANGLE);
|
||||
|
||||
brain target;
|
||||
target.load_sound("test_data/up.wav");
|
||||
target.init(10,0,0);
|
||||
target.init(10,0,window::RECTANGLE);
|
||||
|
||||
renderer rr(source,target);
|
||||
rr.set_playing(true);
|
||||
float *buf=new float[10];
|
||||
rr.process(10,buf);
|
||||
assert(rr.m_render_blocks.size()==2);
|
||||
rr.process(10,buf);
|
||||
assert(rr.m_render_blocks.size()==3);
|
||||
delete[] buf;
|
||||
buf=new float[20];
|
||||
rr.process(20,buf);
|
||||
assert(rr.m_render_blocks.size()==4);
|
||||
rr.process(5,buf);
|
||||
assert(rr.m_render_blocks.size()==2);
|
||||
|
||||
target.init(10,5,0);
|
||||
target.init(10,5,window::RECTANGLE);
|
||||
rr.process(10,buf);
|
||||
assert(rr.m_render_blocks.size()==5);
|
||||
|
||||
delete[] buf;
|
||||
|
||||
}
|
||||
|
94
samplebrain/src/window.cpp
Normal file
94
samplebrain/src/window.cpp
Normal file
@ -0,0 +1,94 @@
|
||||
#include "window.h"
|
||||
#include <cmath>
|
||||
#include <iostream>
|
||||
|
||||
using namespace std;
|
||||
using namespace spiralcore;
|
||||
|
||||
window::window() :
|
||||
m_current_type(RECTANGLE)
|
||||
{
|
||||
}
|
||||
|
||||
void window::clear() {
|
||||
for (vector<sample*>::iterator i=m_windows.begin(); i!=m_windows.end(); ++i) {
|
||||
delete *i;
|
||||
}
|
||||
m_windows.clear();
|
||||
}
|
||||
|
||||
void window::init(u32 size) {
|
||||
clear();
|
||||
for (u32 i=0; i<MAX_TYPES; i++) {
|
||||
window::type t = (window::type)i;
|
||||
sample *s = new sample(size);
|
||||
|
||||
switch(t) {
|
||||
case DODGY: {
|
||||
u32 start=size/6;
|
||||
u32 end=size/6;
|
||||
for (u32 n=0; n<size; ++n) {
|
||||
(*s)[n] = 1;
|
||||
}
|
||||
for(u32 i=0; i<start; ++i) {
|
||||
(*s)[i]=i/(float)start;
|
||||
}
|
||||
for(u32 i=0; i<end; ++i) {
|
||||
(*s)[(size-1)-i]=i/(float)end;
|
||||
}
|
||||
} break;
|
||||
case BARTLETT: {
|
||||
for (u32 n=0; n<size; ++n) {
|
||||
(*s)[n]=1.0 - (2.0 * fabs(n - (size - 1) / 2.0)) / (double(size - 1));
|
||||
}
|
||||
} break;
|
||||
case BLACKMAN: {
|
||||
for (u32 n=0; n<size; ++n) {
|
||||
(*s)[n]= 0.42 - 0.5 * cos(2.0 * M_PI * n / double(size - 1)) +
|
||||
0.08 * cos(4.0 * M_PI * n / double(size - 1));
|
||||
}
|
||||
} break;
|
||||
case FLAT_TOP: {
|
||||
for (u32 n=0; n<size; ++n) {
|
||||
(*s)[n]=
|
||||
1.0 - 1.93 * cos(2.0 * M_PI * n / double(size - 1)) +
|
||||
1.29 * cos(4.0 * M_PI * n / double(size - 1)) -
|
||||
0.388 * cos(6.0 * M_PI * n / double(size - 1)) +
|
||||
0.0322 * cos(8.0 * M_PI * n / double(size - 1));
|
||||
}
|
||||
} break;
|
||||
case GAUSSIAN: {
|
||||
float sigma=0.5;
|
||||
for (u32 n=0; n<size; ++n) {
|
||||
(*s)[n]= exp((-0.5) * pow((n - (size - 1.0) / 2.0)/(sigma * (size - 1.0) / 2.0), 2.0));
|
||||
}
|
||||
} break;
|
||||
case HAMMING : {
|
||||
for (u32 n=0; n<size; ++n) {
|
||||
(*s)[n]= 0.53836 - 0.46164 * cos(2.0 * M_PI * n / double(size - 1));
|
||||
}
|
||||
} break;
|
||||
case HANN : {
|
||||
for (u32 n=0; n<size; ++n) {
|
||||
(*s)[n]= 0.5 * (1.0 - cos(2.0 * M_PI * n / double(size - 1)));
|
||||
}
|
||||
} break;
|
||||
case RECTANGLE : {
|
||||
for (u32 n=0; n<size; ++n) {
|
||||
(*s)[n] = 1;
|
||||
}
|
||||
} break;
|
||||
default: assert(0);
|
||||
}
|
||||
m_windows.push_back(s);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void window::run(const sample &input) const {
|
||||
//assert(input.get_length()==m_windows[0]->get_length());
|
||||
|
||||
for (u32 n=0; n<input.get_length(); ++n) {
|
||||
input[n]*=(*m_windows[m_current_type])[n];
|
||||
}
|
||||
}
|
42
samplebrain/src/window.h
Normal file
42
samplebrain/src/window.h
Normal file
@ -0,0 +1,42 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "jellyfish/fluxa/sample.h"
|
||||
#include "jellyfish/core/types.h"
|
||||
|
||||
#ifndef WINDOW
|
||||
#define WINDOW
|
||||
|
||||
namespace spiralcore {
|
||||
|
||||
class window {
|
||||
public:
|
||||
window();
|
||||
void init(u32 length);
|
||||
|
||||
enum type {
|
||||
DODGY = 0,
|
||||
BARTLETT,
|
||||
BLACKMAN,
|
||||
FLAT_TOP,
|
||||
GAUSSIAN,
|
||||
HAMMING,
|
||||
HANN,
|
||||
RECTANGLE,
|
||||
MAX_TYPES
|
||||
};
|
||||
|
||||
void set_current_type(type t) { m_current_type=t; }
|
||||
void run(const sample &sample) const;
|
||||
|
||||
private:
|
||||
void clear();
|
||||
|
||||
type m_current_type;
|
||||
|
||||
std::vector<sample*> m_windows;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
Loading…
x
Reference in New Issue
Block a user