mirror of
https://gitlab.com/then-try-this/samplebrain.git
synced 2025-05-12 18:47:21 +00:00
added stickyness and started being anal about compiler warnings
This commit is contained in:
parent
d4b937f0f0
commit
ad64e64984
@ -6,12 +6,12 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>1134</width>
|
<width>1220</width>
|
||||||
<height>707</height>
|
<height>755</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>samplebrain 0.8</string>
|
<string>samplebrain 0.10</string>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="centralwidget">
|
<widget class="QWidget" name="centralwidget">
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||||
@ -374,6 +374,69 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_21">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_30">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<family>Comic Sans MS</family>
|
||||||
|
<pointsize>9</pointsize>
|
||||||
|
<weight>75</weight>
|
||||||
|
<bold>true</bold>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>stickyness</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QSlider" name="sliderStickyness">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>how long it takes for the novelty to wear off</string>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>100</number>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QDoubleSpinBox" name="doubleSpinBoxStickyness">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<double>1.000000000000000</double>
|
||||||
|
</property>
|
||||||
|
<property name="singleStep">
|
||||||
|
<double>0.010000000000000</double>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<double>0.000000000000000</double>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_19">
|
<layout class="QHBoxLayout" name="horizontalLayout_19">
|
||||||
<item>
|
<item>
|
||||||
@ -671,6 +734,19 @@
|
|||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="verticalSpacer_3">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>240</width>
|
||||||
|
<height>574</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_23">
|
<widget class="QLabel" name="label_23">
|
||||||
<property name="font">
|
<property name="font">
|
||||||
@ -803,19 +879,6 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<spacer name="verticalSpacer_3">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>40</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
@ -2456,6 +2519,38 @@
|
|||||||
</hint>
|
</hint>
|
||||||
</hints>
|
</hints>
|
||||||
</connection>
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>doubleSpinBoxStickyness</sender>
|
||||||
|
<signal>valueChanged(double)</signal>
|
||||||
|
<receiver>MainWindow</receiver>
|
||||||
|
<slot>stickyness_slot(double)</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>385</x>
|
||||||
|
<y>296</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>609</x>
|
||||||
|
<y>377</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>sliderStickyness</sender>
|
||||||
|
<signal>valueChanged(int)</signal>
|
||||||
|
<receiver>MainWindow</receiver>
|
||||||
|
<slot>stickyness_slot(int)</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>266</x>
|
||||||
|
<y>296</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>609</x>
|
||||||
|
<y>377</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
</connections>
|
</connections>
|
||||||
<slots>
|
<slots>
|
||||||
<slot>play_slot()</slot>
|
<slot>play_slot()</slot>
|
||||||
@ -2519,6 +2614,8 @@
|
|||||||
<slot>save_brain()</slot>
|
<slot>save_brain()</slot>
|
||||||
<slot>slide_error(int)</slot>
|
<slot>slide_error(int)</slot>
|
||||||
<slot>search_stretch(int)</slot>
|
<slot>search_stretch(int)</slot>
|
||||||
|
<slot>stickyness_slot(int)</slot>
|
||||||
|
<slot>stickyness_slot(double)</slot>
|
||||||
</slots>
|
</slots>
|
||||||
<buttongroups>
|
<buttongroups>
|
||||||
<buttongroup name="buttonGroup_2"/>
|
<buttongroup name="buttonGroup_2"/>
|
||||||
|
@ -109,6 +109,14 @@ private slots:
|
|||||||
void slide_error(int s) {
|
void slide_error(int s) {
|
||||||
lo_send(m_audio_address,"/slide-error","i",s);
|
lo_send(m_audio_address,"/slide-error","i",s);
|
||||||
}
|
}
|
||||||
|
void stickyness_slot(int s) {
|
||||||
|
lo_send(m_audio_address,"/stickyness","f",s/100.0f);
|
||||||
|
m_Ui.doubleSpinBoxStickyness->setValue(s/100.0f);
|
||||||
|
}
|
||||||
|
void stickyness_slot(double s) {
|
||||||
|
lo_send(m_audio_address,"/stickyness","f",s);
|
||||||
|
m_Ui.sliderStickyness->setValue(s*100);
|
||||||
|
}
|
||||||
|
|
||||||
void volume_slot(int s) { lo_send(m_audio_address,"/volume","f",s/100.0f); }
|
void volume_slot(int s) { lo_send(m_audio_address,"/volume","f",s/100.0f); }
|
||||||
|
|
||||||
|
@ -22,9 +22,9 @@ using namespace std;
|
|||||||
|
|
||||||
audio_thread::audio_thread(process_thread &p) :
|
audio_thread::audio_thread(process_thread &p) :
|
||||||
m_audio_device(NULL),
|
m_audio_device(NULL),
|
||||||
|
m_osc("8888"),
|
||||||
m_process_thread(p),
|
m_process_thread(p),
|
||||||
m_brain_mutex(p.m_brain_mutex),
|
m_brain_mutex(p.m_brain_mutex)
|
||||||
m_osc("8888")
|
|
||||||
{
|
{
|
||||||
start_audio();
|
start_audio();
|
||||||
pthread_mutex_lock(m_brain_mutex);
|
pthread_mutex_lock(m_brain_mutex);
|
||||||
@ -84,6 +84,9 @@ void audio_thread::process(sample &s, sample &s2) {
|
|||||||
if (name=="/novelty") {
|
if (name=="/novelty") {
|
||||||
m_renderer->get_params()->m_usage_importance = cmd.get_float(0);
|
m_renderer->get_params()->m_usage_importance = cmd.get_float(0);
|
||||||
}
|
}
|
||||||
|
if (name=="/stickyness") {
|
||||||
|
m_renderer->get_params()->m_stickyness = cmd.get_float(0);
|
||||||
|
}
|
||||||
if (name=="/restart_audio") {
|
if (name=="/restart_audio") {
|
||||||
start_audio();
|
start_audio();
|
||||||
}
|
}
|
||||||
|
@ -1,14 +1,13 @@
|
|||||||
/********************************************************************************
|
/********************************************************************************
|
||||||
** Form generated from reading UI file 'samplebrainj21537.ui'
|
** Form generated from reading UI file 'samplebrainJ11878.ui'
|
||||||
**
|
**
|
||||||
** Created: Fri Aug 7 09:55:34 2015
|
** Created by: Qt User Interface Compiler version 4.8.6
|
||||||
** by: Qt User Interface Compiler version 4.8.1
|
|
||||||
**
|
**
|
||||||
** WARNING! All changes made in this file will be lost when recompiling UI file!
|
** WARNING! All changes made in this file will be lost when recompiling UI file!
|
||||||
********************************************************************************/
|
********************************************************************************/
|
||||||
|
|
||||||
#ifndef SAMPLEBRAINJ21537_H
|
#ifndef SAMPLEBRAINJ11878_H
|
||||||
#define SAMPLEBRAINJ21537_H
|
#define SAMPLEBRAINJ11878_H
|
||||||
|
|
||||||
#include <QtCore/QVariant>
|
#include <QtCore/QVariant>
|
||||||
#include <QtGui/QAction>
|
#include <QtGui/QAction>
|
||||||
@ -67,6 +66,10 @@ public:
|
|||||||
QLabel *label_25;
|
QLabel *label_25;
|
||||||
QSlider *sliderBoredom;
|
QSlider *sliderBoredom;
|
||||||
QDoubleSpinBox *doubleSpinBoxBoredom;
|
QDoubleSpinBox *doubleSpinBoxBoredom;
|
||||||
|
QHBoxLayout *horizontalLayout_21;
|
||||||
|
QLabel *label_30;
|
||||||
|
QSlider *sliderStickyness;
|
||||||
|
QDoubleSpinBox *doubleSpinBoxStickyness;
|
||||||
QHBoxLayout *horizontalLayout_19;
|
QHBoxLayout *horizontalLayout_19;
|
||||||
QLabel *label_28;
|
QLabel *label_28;
|
||||||
QSlider *sliderSearchStretch;
|
QSlider *sliderSearchStretch;
|
||||||
@ -86,6 +89,7 @@ public:
|
|||||||
QSlider *sliderSlideError;
|
QSlider *sliderSlideError;
|
||||||
QSpinBox *spinBoxSlideError;
|
QSpinBox *spinBoxSlideError;
|
||||||
QSpacerItem *horizontalSpacer_2;
|
QSpacerItem *horizontalSpacer_2;
|
||||||
|
QSpacerItem *verticalSpacer_3;
|
||||||
QLabel *label_23;
|
QLabel *label_23;
|
||||||
QHBoxLayout *horizontalLayout_8;
|
QHBoxLayout *horizontalLayout_8;
|
||||||
QLabel *label_21;
|
QLabel *label_21;
|
||||||
@ -95,7 +99,6 @@ public:
|
|||||||
QLabel *label_22;
|
QLabel *label_22;
|
||||||
QSlider *sliderTargetMix;
|
QSlider *sliderTargetMix;
|
||||||
QDoubleSpinBox *doubleSpinBoxTargetMix;
|
QDoubleSpinBox *doubleSpinBoxTargetMix;
|
||||||
QSpacerItem *verticalSpacer_3;
|
|
||||||
QVBoxLayout *verticalLayout_6;
|
QVBoxLayout *verticalLayout_6;
|
||||||
QLabel *label_16;
|
QLabel *label_16;
|
||||||
QPushButton *pushButtonLoadTarget;
|
QPushButton *pushButtonLoadTarget;
|
||||||
@ -167,7 +170,7 @@ public:
|
|||||||
{
|
{
|
||||||
if (MainWindow->objectName().isEmpty())
|
if (MainWindow->objectName().isEmpty())
|
||||||
MainWindow->setObjectName(QString::fromUtf8("MainWindow"));
|
MainWindow->setObjectName(QString::fromUtf8("MainWindow"));
|
||||||
MainWindow->resize(1134, 707);
|
MainWindow->resize(1220, 755);
|
||||||
centralwidget = new QWidget(MainWindow);
|
centralwidget = new QWidget(MainWindow);
|
||||||
centralwidget->setObjectName(QString::fromUtf8("centralwidget"));
|
centralwidget->setObjectName(QString::fromUtf8("centralwidget"));
|
||||||
verticalLayout_4 = new QVBoxLayout(centralwidget);
|
verticalLayout_4 = new QVBoxLayout(centralwidget);
|
||||||
@ -372,6 +375,37 @@ public:
|
|||||||
|
|
||||||
verticalLayout_3->addLayout(horizontalLayout_11);
|
verticalLayout_3->addLayout(horizontalLayout_11);
|
||||||
|
|
||||||
|
horizontalLayout_21 = new QHBoxLayout();
|
||||||
|
horizontalLayout_21->setObjectName(QString::fromUtf8("horizontalLayout_21"));
|
||||||
|
label_30 = new QLabel(controlTab);
|
||||||
|
label_30->setObjectName(QString::fromUtf8("label_30"));
|
||||||
|
label_30->setFont(font2);
|
||||||
|
|
||||||
|
horizontalLayout_21->addWidget(label_30);
|
||||||
|
|
||||||
|
sliderStickyness = new QSlider(controlTab);
|
||||||
|
sliderStickyness->setObjectName(QString::fromUtf8("sliderStickyness"));
|
||||||
|
sizePolicy.setHeightForWidth(sliderStickyness->sizePolicy().hasHeightForWidth());
|
||||||
|
sliderStickyness->setSizePolicy(sizePolicy);
|
||||||
|
sliderStickyness->setMaximum(100);
|
||||||
|
sliderStickyness->setValue(0);
|
||||||
|
sliderStickyness->setOrientation(Qt::Horizontal);
|
||||||
|
|
||||||
|
horizontalLayout_21->addWidget(sliderStickyness);
|
||||||
|
|
||||||
|
doubleSpinBoxStickyness = new QDoubleSpinBox(controlTab);
|
||||||
|
doubleSpinBoxStickyness->setObjectName(QString::fromUtf8("doubleSpinBoxStickyness"));
|
||||||
|
sizePolicy1.setHeightForWidth(doubleSpinBoxStickyness->sizePolicy().hasHeightForWidth());
|
||||||
|
doubleSpinBoxStickyness->setSizePolicy(sizePolicy1);
|
||||||
|
doubleSpinBoxStickyness->setMaximum(1);
|
||||||
|
doubleSpinBoxStickyness->setSingleStep(0.01);
|
||||||
|
doubleSpinBoxStickyness->setValue(0);
|
||||||
|
|
||||||
|
horizontalLayout_21->addWidget(doubleSpinBoxStickyness);
|
||||||
|
|
||||||
|
|
||||||
|
verticalLayout_3->addLayout(horizontalLayout_21);
|
||||||
|
|
||||||
horizontalLayout_19 = new QHBoxLayout();
|
horizontalLayout_19 = new QHBoxLayout();
|
||||||
horizontalLayout_19->setObjectName(QString::fromUtf8("horizontalLayout_19"));
|
horizontalLayout_19->setObjectName(QString::fromUtf8("horizontalLayout_19"));
|
||||||
label_28 = new QLabel(controlTab);
|
label_28 = new QLabel(controlTab);
|
||||||
@ -516,6 +550,10 @@ public:
|
|||||||
|
|
||||||
verticalLayout_3->addItem(horizontalSpacer_2);
|
verticalLayout_3->addItem(horizontalSpacer_2);
|
||||||
|
|
||||||
|
verticalSpacer_3 = new QSpacerItem(240, 574, QSizePolicy::Minimum, QSizePolicy::Expanding);
|
||||||
|
|
||||||
|
verticalLayout_3->addItem(verticalSpacer_3);
|
||||||
|
|
||||||
label_23 = new QLabel(controlTab);
|
label_23 = new QLabel(controlTab);
|
||||||
label_23->setObjectName(QString::fromUtf8("label_23"));
|
label_23->setObjectName(QString::fromUtf8("label_23"));
|
||||||
label_23->setFont(font1);
|
label_23->setFont(font1);
|
||||||
@ -583,10 +621,6 @@ public:
|
|||||||
|
|
||||||
verticalLayout_3->addLayout(horizontalLayout_9);
|
verticalLayout_3->addLayout(horizontalLayout_9);
|
||||||
|
|
||||||
verticalSpacer_3 = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding);
|
|
||||||
|
|
||||||
verticalLayout_3->addItem(verticalSpacer_3);
|
|
||||||
|
|
||||||
|
|
||||||
horizontalLayout_5->addLayout(verticalLayout_3);
|
horizontalLayout_5->addLayout(verticalLayout_3);
|
||||||
|
|
||||||
@ -1034,6 +1068,8 @@ public:
|
|||||||
QObject::connect(sliderSlideError, SIGNAL(valueChanged(int)), spinBoxSlideError, SLOT(setValue(int)));
|
QObject::connect(sliderSlideError, SIGNAL(valueChanged(int)), spinBoxSlideError, SLOT(setValue(int)));
|
||||||
QObject::connect(spinBoxSlideError, SIGNAL(valueChanged(int)), sliderSlideError, SLOT(setValue(int)));
|
QObject::connect(spinBoxSlideError, SIGNAL(valueChanged(int)), sliderSlideError, SLOT(setValue(int)));
|
||||||
QObject::connect(sliderSlideError, SIGNAL(valueChanged(int)), MainWindow, SLOT(slide_error(int)));
|
QObject::connect(sliderSlideError, SIGNAL(valueChanged(int)), MainWindow, SLOT(slide_error(int)));
|
||||||
|
QObject::connect(doubleSpinBoxStickyness, SIGNAL(valueChanged(double)), MainWindow, SLOT(stickyness_slot(double)));
|
||||||
|
QObject::connect(sliderStickyness, SIGNAL(valueChanged(int)), MainWindow, SLOT(stickyness_slot(int)));
|
||||||
|
|
||||||
tabWidget->setCurrentIndex(0);
|
tabWidget->setCurrentIndex(0);
|
||||||
|
|
||||||
@ -1043,7 +1079,7 @@ public:
|
|||||||
|
|
||||||
void retranslateUi(QMainWindow *MainWindow)
|
void retranslateUi(QMainWindow *MainWindow)
|
||||||
{
|
{
|
||||||
MainWindow->setWindowTitle(QApplication::translate("MainWindow", "samplebrain 0.9", 0, QApplication::UnicodeUTF8));
|
MainWindow->setWindowTitle(QApplication::translate("MainWindow", "samplebrain 0.10", 0, QApplication::UnicodeUTF8));
|
||||||
label_19->setText(QApplication::translate("MainWindow", "brain tweaks", 0, QApplication::UnicodeUTF8));
|
label_19->setText(QApplication::translate("MainWindow", "brain tweaks", 0, QApplication::UnicodeUTF8));
|
||||||
label_6->setText(QApplication::translate("MainWindow", "fft / mfcc", 0, QApplication::UnicodeUTF8));
|
label_6->setText(QApplication::translate("MainWindow", "fft / mfcc", 0, QApplication::UnicodeUTF8));
|
||||||
#ifndef QT_NO_TOOLTIP
|
#ifndef QT_NO_TOOLTIP
|
||||||
@ -1079,6 +1115,13 @@ public:
|
|||||||
#ifndef QT_NO_TOOLTIP
|
#ifndef QT_NO_TOOLTIP
|
||||||
sliderBoredom->setToolTip(QApplication::translate("MainWindow", "how long it takes for the novelty to wear off", 0, QApplication::UnicodeUTF8));
|
sliderBoredom->setToolTip(QApplication::translate("MainWindow", "how long it takes for the novelty to wear off", 0, QApplication::UnicodeUTF8));
|
||||||
#endif // QT_NO_TOOLTIP
|
#endif // QT_NO_TOOLTIP
|
||||||
|
#ifndef QT_NO_TOOLTIP
|
||||||
|
label_30->setToolTip(QString());
|
||||||
|
#endif // QT_NO_TOOLTIP
|
||||||
|
label_30->setText(QApplication::translate("MainWindow", "stickyness", 0, QApplication::UnicodeUTF8));
|
||||||
|
#ifndef QT_NO_TOOLTIP
|
||||||
|
sliderStickyness->setToolTip(QApplication::translate("MainWindow", "how long it takes for the novelty to wear off", 0, QApplication::UnicodeUTF8));
|
||||||
|
#endif // QT_NO_TOOLTIP
|
||||||
#ifndef QT_NO_TOOLTIP
|
#ifndef QT_NO_TOOLTIP
|
||||||
label_28->setToolTip(QString());
|
label_28->setToolTip(QString());
|
||||||
#endif // QT_NO_TOOLTIP
|
#endif // QT_NO_TOOLTIP
|
||||||
@ -1185,4 +1228,4 @@ namespace Ui {
|
|||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
#endif // SAMPLEBRAINJ21537_H
|
#endif // SAMPLEBRAINJ11878_H
|
||||||
|
@ -41,7 +41,7 @@ INCLUDEPATH += ../src
|
|||||||
LIBS += -L.. -lportaudio -lfftw3 -lsndfile -llo -ldl -lpthread -lm
|
LIBS += -L.. -lportaudio -lfftw3 -lsndfile -llo -ldl -lpthread -lm
|
||||||
#CONFIG+=debug
|
#CONFIG+=debug
|
||||||
|
|
||||||
QMAKE_CXXFLAGS += -Wunused-parameter -std=c++11 -DDONT_USE_FLUXA_GRAPH
|
QMAKE_CXXFLAGS += -Wall -Wno-unused -std=c++11 -DDONT_USE_FLUXA_GRAPH
|
||||||
|
|
||||||
# assets
|
# assets
|
||||||
RESOURCES = samplebrain.qrc
|
RESOURCES = samplebrain.qrc
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
MelFilter.o: src/aquila/filter/MelFilter.cpp \
|
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 \
|
MelFilterBank.o: src/aquila/filter/MelFilterBank.cpp \
|
||||||
src/aquila/filter/MelFilterBank.h src/aquila/filter/../global.h \
|
src/aquila/filter/MelFilterBank.h src/aquila/filter/../global.h \
|
||||||
src/aquila/filter/MelFilter.h
|
src/aquila/filter/MelFilter.h
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
Dct.o: src/aquila/transform/Dct.cpp src/aquila/transform/Dct.h \
|
Dct.o: src/aquila/transform/Dct.cpp src/aquila/transform/Dct.h \
|
||||||
src/aquila/transform/../global.h
|
src/aquila/transform/../global.h
|
||||||
|
@ -63,7 +63,8 @@ void normalise(sample &in) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
block::block(const string &filename, const sample &pcm, u32 rate, const window &w, bool ditchpcm) :
|
block::block(u64 id, const string &filename, const sample &pcm, u32 rate, const window &w, bool ditchpcm) :
|
||||||
|
m_id(id),
|
||||||
m_pcm(pcm),
|
m_pcm(pcm),
|
||||||
m_fft(pcm.get_length()),
|
m_fft(pcm.get_length()),
|
||||||
m_mfcc(MFCC_FILTERS),
|
m_mfcc(MFCC_FILTERS),
|
||||||
@ -143,8 +144,8 @@ double block::_compare(const sample &fft_a, const sample &mfcc_a,
|
|||||||
double mfcc_acc=0;
|
double mfcc_acc=0;
|
||||||
double fft_acc=0;
|
double fft_acc=0;
|
||||||
|
|
||||||
s32 fft_start = params.m_fft1_start;
|
u32 fft_start = params.m_fft1_start;
|
||||||
s32 fft_end = fmin(params.m_fft1_end,m_fft.get_length());
|
u32 fft_end = fmin(params.m_fft1_end,m_fft.get_length());
|
||||||
|
|
||||||
if (params.m_ratio==0) {
|
if (params.m_ratio==0) {
|
||||||
for (u32 i=fft_start; i<fft_end; ++i) {
|
for (u32 i=fft_start; i<fft_end; ++i) {
|
||||||
@ -182,10 +183,12 @@ double block::compare(const block &other, const search_params ¶ms) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ios &spiralcore::operator||(ios &s, block &b) {
|
ios &spiralcore::operator||(ios &s, block &b) {
|
||||||
u32 version=1;
|
u32 version=2;
|
||||||
string id("block");
|
string id("block");
|
||||||
s||id||version;
|
s||id||version;
|
||||||
|
|
||||||
|
if (version>1) s||b.m_id;
|
||||||
|
|
||||||
s||b.m_pcm||b.m_fft||b.m_mfcc;
|
s||b.m_pcm||b.m_fft||b.m_mfcc;
|
||||||
s||b.m_n_pcm||b.m_n_fft||b.m_n_mfcc;
|
s||b.m_n_pcm||b.m_n_fft||b.m_n_mfcc;
|
||||||
|
|
||||||
@ -236,7 +239,7 @@ bool block::unit_test() {
|
|||||||
w.init(data.get_length());
|
w.init(data.get_length());
|
||||||
w.set_current_type(window::RECTANGLE);
|
w.set_current_type(window::RECTANGLE);
|
||||||
|
|
||||||
block bb("test",data,44100,w);
|
block bb(0,"test",data,44100,w);
|
||||||
|
|
||||||
assert(bb.m_pcm.get_length()==data.get_length());
|
assert(bb.m_pcm.get_length()==data.get_length());
|
||||||
//assert(bb.m_fft.get_length()==data.get_length());
|
//assert(bb.m_fft.get_length()==data.get_length());
|
||||||
@ -265,7 +268,7 @@ bool block::unit_test() {
|
|||||||
|
|
||||||
|
|
||||||
search_params p(0,0,0,100,0);
|
search_params p(0,0,0,100,0);
|
||||||
block bb2("test",data,44100,w);
|
block bb2(0,"test",data,44100,w);
|
||||||
assert(bb.compare(bb2,p)==0);
|
assert(bb.compare(bb2,p)==0);
|
||||||
p.m_ratio=1;
|
p.m_ratio=1;
|
||||||
assert(bb.compare(bb2,p)==0);
|
assert(bb.compare(bb2,p)==0);
|
||||||
@ -277,9 +280,9 @@ bool block::unit_test() {
|
|||||||
data2[i]=i%10;
|
data2[i]=i%10;
|
||||||
}
|
}
|
||||||
|
|
||||||
block cpy("test",data,100,w);
|
block cpy(0,"test",data,100,w);
|
||||||
{
|
{
|
||||||
block bb3("test",data2,44100,w);
|
block bb3(0,"test",data2,44100,w);
|
||||||
p.m_ratio=0.0;
|
p.m_ratio=0.0;
|
||||||
assert(bb.compare(bb3,p)!=0);
|
assert(bb.compare(bb3,p)!=0);
|
||||||
assert(bb.compare(bb3,p)!=0);
|
assert(bb.compare(bb3,p)!=0);
|
||||||
|
@ -32,7 +32,7 @@ namespace spiralcore {
|
|||||||
class block {
|
class block {
|
||||||
public:
|
public:
|
||||||
// runs analysis on pcm
|
// runs analysis on pcm
|
||||||
block(const std::string &filename, const sample &pcm, u32 rate, const window &w, bool ditchpcm=false);
|
block(u64 id, const std::string &filename, const sample &pcm, u32 rate, const window &w, bool ditchpcm=false);
|
||||||
block() {}
|
block() {}
|
||||||
|
|
||||||
// returns distance based on ratio of fft-mfcc values
|
// returns distance based on ratio of fft-mfcc values
|
||||||
@ -56,6 +56,8 @@ private:
|
|||||||
const sample &fft_b, const sample &mfcc_b,
|
const sample &fft_b, const sample &mfcc_b,
|
||||||
const search_params ¶ms) const;
|
const search_params ¶ms) const;
|
||||||
|
|
||||||
|
u64 m_id;
|
||||||
|
|
||||||
sample m_pcm;
|
sample m_pcm;
|
||||||
sample m_fft;
|
sample m_fft;
|
||||||
sample m_mfcc;
|
sample m_mfcc;
|
||||||
|
@ -30,8 +30,8 @@ static const double usage_factor = 1000;
|
|||||||
|
|
||||||
brain::brain() :
|
brain::brain() :
|
||||||
m_current_block_index(0),
|
m_current_block_index(0),
|
||||||
m_average_error(0),
|
|
||||||
m_current_error(0),
|
m_current_error(0),
|
||||||
|
m_average_error(0),
|
||||||
m_usage_falloff(0.9)
|
m_usage_falloff(0.9)
|
||||||
{
|
{
|
||||||
status::update("brain ready...");
|
status::update("brain ready...");
|
||||||
@ -83,7 +83,7 @@ void brain::chop_and_add(const sample &s, u32 count, bool ditchpcm) {
|
|||||||
status::update("processing sample %d: %d%%",count,(int)(pos/(float)s.get_length()*100));
|
status::update("processing sample %d: %d%%",count,(int)(pos/(float)s.get_length()*100));
|
||||||
sample region;
|
sample region;
|
||||||
s.get_region(region,pos,pos+m_block_size-1);
|
s.get_region(region,pos,pos+m_block_size-1);
|
||||||
m_blocks.push_back(block("",region,44100,m_window,ditchpcm));
|
m_blocks.push_back(block(m_blocks.size(),"",region,44100,m_window,ditchpcm));
|
||||||
pos += (m_block_size-m_overlap);
|
pos += (m_block_size-m_overlap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -92,6 +92,26 @@ const block &brain::get_block(u32 index) const {
|
|||||||
return m_blocks[index];
|
return m_blocks[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// helper to do the stickyness comparison and sort out current_block_index
|
||||||
|
u32 brain::stickify(const block &target, u32 closest_index, f32 dist, const search_params ¶ms) {
|
||||||
|
u32 next_index = m_current_block_index+1;
|
||||||
|
|
||||||
|
// if we have stickyness turned on and the next block exists
|
||||||
|
if (params.m_stickyness>0 && next_index<m_blocks.size()) {
|
||||||
|
// get next block
|
||||||
|
f32 dist_to_next = target.compare(m_blocks[next_index],params);
|
||||||
|
if (dist_to_next * (1-params.m_stickyness) <
|
||||||
|
dist * params.m_stickyness) {
|
||||||
|
// use the next block rather than the closest
|
||||||
|
m_current_block_index = next_index;
|
||||||
|
return m_current_block_index;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// use the closest block
|
||||||
|
m_current_block_index = closest_index;
|
||||||
|
return m_current_block_index;
|
||||||
|
}
|
||||||
|
|
||||||
// returns index to block
|
// returns index to block
|
||||||
u32 brain::search(const block &target, const search_params ¶ms) {
|
u32 brain::search(const block &target, const search_params ¶ms) {
|
||||||
double closest = FLT_MAX;
|
double closest = FLT_MAX;
|
||||||
@ -107,7 +127,7 @@ u32 brain::search(const block &target, const search_params ¶ms) {
|
|||||||
}
|
}
|
||||||
deplete_usage();
|
deplete_usage();
|
||||||
m_blocks[closest_index].get_usage()+=usage_factor;
|
m_blocks[closest_index].get_usage()+=usage_factor;
|
||||||
return closest_index;
|
return stickify(target,closest_index,closest,params);
|
||||||
}
|
}
|
||||||
|
|
||||||
// returns index to block
|
// returns index to block
|
||||||
@ -126,6 +146,7 @@ u32 brain::rev_search(const block &target, const search_params ¶ms) {
|
|||||||
|
|
||||||
deplete_usage();
|
deplete_usage();
|
||||||
m_blocks[furthest_index].get_usage()+=usage_factor;
|
m_blocks[furthest_index].get_usage()+=usage_factor;
|
||||||
|
m_current_block_index = furthest_index;
|
||||||
|
|
||||||
return furthest_index;
|
return furthest_index;
|
||||||
}
|
}
|
||||||
@ -174,22 +195,22 @@ void brain::build_synapses_fixed(search_params ¶ms) {
|
|||||||
for (vector<block>::iterator i=m_blocks.begin(); i!=m_blocks.end(); ++i) {
|
for (vector<block>::iterator i=m_blocks.begin(); i!=m_blocks.end(); ++i) {
|
||||||
status::update("building synapses %d%%",(int)(outer_index/(float)brain_size*100));
|
status::update("building synapses %d%%",(int)(outer_index/(float)brain_size*100));
|
||||||
u32 index = 0;
|
u32 index = 0;
|
||||||
vector<pair<int,double>> collect;
|
vector<pair<u32,double>> collect;
|
||||||
|
|
||||||
// collect comparisons to all other blocks
|
// collect comparisons to all other blocks
|
||||||
for (vector<block>::const_iterator j=m_blocks.begin(); j!=m_blocks.end(); ++j) {
|
for (vector<block>::const_iterator j=m_blocks.begin(); j!=m_blocks.end(); ++j) {
|
||||||
assert(index<m_blocks.size());
|
assert(index<m_blocks.size());
|
||||||
if (index!=outer_index) {
|
if (index!=outer_index) {
|
||||||
double diff = i->compare(*j,params);
|
double diff = i->compare(*j,params);
|
||||||
collect.push_back(pair<int,double>(index,diff));
|
collect.push_back(pair<u32,double>(index,diff));
|
||||||
}
|
}
|
||||||
++index;
|
++index;
|
||||||
}
|
}
|
||||||
|
|
||||||
// sort them by closeness
|
// sort them by closeness
|
||||||
sort(collect.begin(),collect.end(),
|
sort(collect.begin(),collect.end(),
|
||||||
[](const pair<int,double> &a,
|
[](const pair<u32,double> &a,
|
||||||
const pair<int,double> &b) -> bool {
|
const pair<u32,double> &b) -> bool {
|
||||||
return a.second<b.second;
|
return a.second<b.second;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -248,9 +269,10 @@ u32 brain::search_synapses(const block &target, search_params ¶ms) {
|
|||||||
m_blocks[m_current_block_index].get_usage()+=usage_factor;
|
m_blocks[m_current_block_index].get_usage()+=usage_factor;
|
||||||
m_current_error = closest;
|
m_current_error = closest;
|
||||||
|
|
||||||
|
// probably impossible to be false?
|
||||||
if (closest_index!=0) {
|
if (closest_index!=0) {
|
||||||
//cerr<<"usage:"<<m_blocks[closest_index].get_usage()<<endl;
|
//cerr<<"usage:"<<m_blocks[closest_index].get_usage()<<endl;
|
||||||
m_current_block_index = closest_index;
|
return stickify(target,closest_index,closest,params);
|
||||||
}
|
}
|
||||||
return m_current_block_index;
|
return m_current_block_index;
|
||||||
}
|
}
|
||||||
@ -294,6 +316,7 @@ ios &spiralcore::operator||(ios &s, brain::sound &b) {
|
|||||||
string id("brain::sound");
|
string id("brain::sound");
|
||||||
s||id||version;
|
s||id||version;
|
||||||
s||b.m_filename||b.m_sample;
|
s||b.m_filename||b.m_sample;
|
||||||
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
ios &spiralcore::operator||(ios &s, brain &b) {
|
ios &spiralcore::operator||(ios &s, brain &b) {
|
||||||
@ -305,6 +328,7 @@ ios &spiralcore::operator||(ios &s, brain &b) {
|
|||||||
s||b.m_block_size||b.m_overlap||b.m_window;
|
s||b.m_block_size||b.m_overlap||b.m_window;
|
||||||
s||b.m_current_block_index||b.m_current_error||
|
s||b.m_current_block_index||b.m_current_error||
|
||||||
b.m_average_error||b.m_usage_falloff;
|
b.m_average_error||b.m_usage_falloff;
|
||||||
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool brain::unit_test() {
|
bool brain::unit_test() {
|
||||||
|
@ -86,6 +86,7 @@ private:
|
|||||||
|
|
||||||
void chop_and_add(const sample &s, u32 count, bool ditchpcm=false);
|
void chop_and_add(const sample &s, u32 count, bool ditchpcm=false);
|
||||||
void deplete_usage();
|
void deplete_usage();
|
||||||
|
u32 stickify(const block &target, u32 closest_index, f32 dist, const search_params ¶ms);
|
||||||
|
|
||||||
vector<block> m_blocks;
|
vector<block> m_blocks;
|
||||||
std::list<sound> m_samples;
|
std::list<sound> m_samples;
|
||||||
|
@ -372,4 +372,5 @@ bool renderer::unit_test() {
|
|||||||
assert(rr.m_render_blocks.size()==4);
|
assert(rr.m_render_blocks.size()==4);
|
||||||
delete[] buf;
|
delete[] buf;
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,8 @@ public:
|
|||||||
m_fft1_start(s1),
|
m_fft1_start(s1),
|
||||||
m_fft1_end(e1),
|
m_fft1_end(e1),
|
||||||
m_usage_importance(usage_importance),
|
m_usage_importance(usage_importance),
|
||||||
m_num_synapses(20)
|
m_num_synapses(20),
|
||||||
|
m_stickyness(0)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
float m_ratio;
|
float m_ratio;
|
||||||
@ -36,6 +37,7 @@ public:
|
|||||||
u32 m_fft1_end;
|
u32 m_fft1_end;
|
||||||
float m_usage_importance;
|
float m_usage_importance;
|
||||||
u32 m_num_synapses;
|
u32 m_num_synapses;
|
||||||
|
f32 m_stickyness;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user