Compare commits
6 Commits
6db3de1b5c
...
2cb064696d
| Author | SHA1 | Date |
|---|---|---|
|
|
2cb064696d | |
|
|
004d9970c8 | |
|
|
0a309ef8cd | |
|
|
28a8bd31f8 | |
|
|
ad2a70a8d6 | |
|
|
8aa0dee3d1 |
|
|
@ -33,7 +33,7 @@ sound_items::sound_item &sound_items::add(QVBoxLayout *container, const string &
|
||||||
sound_item si;
|
sound_item si;
|
||||||
si.m_filename = name;
|
si.m_filename = name;
|
||||||
si.m_id = m_current_sound_id++;
|
si.m_id = m_current_sound_id++;
|
||||||
QString style("background-color:lightgrey;");
|
QString style("color:black;background-color:lightgrey;");
|
||||||
|
|
||||||
si.m_container = new QHBoxLayout();
|
si.m_container = new QHBoxLayout();
|
||||||
si.m_container->setSpacing(10);
|
si.m_container->setSpacing(10);
|
||||||
|
|
@ -89,8 +89,8 @@ void sound_items::clear() {
|
||||||
void sound_items::recolour() {
|
void sound_items::recolour() {
|
||||||
u32 c=0;
|
u32 c=0;
|
||||||
for (auto &si:m_sound_items) {
|
for (auto &si:m_sound_items) {
|
||||||
QString style("background-color:lightblue;");
|
QString style("color:black;background-color:lightblue;");
|
||||||
if (c%2==0) style="background-color:pink;";
|
if (c%2==0) style="color:black;background-color:pink;";
|
||||||
si.m_enable->setStyleSheet(style);
|
si.m_enable->setStyleSheet(style);
|
||||||
si.m_del->setStyleSheet(style);
|
si.m_del->setStyleSheet(style);
|
||||||
si.m_label->setStyleSheet(style);
|
si.m_label->setStyleSheet(style);
|
||||||
|
|
@ -101,7 +101,7 @@ void sound_items::recolour() {
|
||||||
void sound_items::change_colour(const std::string &name, const std::string &colour) {
|
void sound_items::change_colour(const std::string &name, const std::string &colour) {
|
||||||
for (auto &si:m_sound_items) {
|
for (auto &si:m_sound_items) {
|
||||||
if (si.m_filename==name) {
|
if (si.m_filename==name) {
|
||||||
QString style("background-color:"+QString::fromStdString(colour)+";");
|
QString style("color:black;background-color:"+QString::fromStdString(colour)+";");
|
||||||
si.m_enable->setStyleSheet(style);
|
si.m_enable->setStyleSheet(style);
|
||||||
si.m_del->setStyleSheet(style);
|
si.m_del->setStyleSheet(style);
|
||||||
si.m_label->setStyleSheet(style);
|
si.m_label->setStyleSheet(style);
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <atomic>
|
||||||
#include <sndfile.h>
|
#include <sndfile.h>
|
||||||
#include <float.h>
|
#include <float.h>
|
||||||
#include <spiralcore/audio.h>
|
#include <spiralcore/audio.h>
|
||||||
|
|
@ -242,10 +243,12 @@ void brain::build_synapses_thresh(search_params ¶ms, double thresh) {
|
||||||
m_average_error = calc_average_diff(params)*thresh;
|
m_average_error = calc_average_diff(params)*thresh;
|
||||||
double err = m_average_error*thresh;
|
double err = m_average_error*thresh;
|
||||||
u32 brain_size = m_blocks.size();
|
u32 brain_size = m_blocks.size();
|
||||||
u32 outer_index = 0;
|
std::atomic<u32> progress{0};
|
||||||
for (auto &i : m_blocks) {
|
#pragma omp parallel for
|
||||||
|
for (u32 outer_index = 0; outer_index < brain_size; ++outer_index) {
|
||||||
|
auto &i = m_blocks[outer_index];
|
||||||
u32 index = 0;
|
u32 index = 0;
|
||||||
status::update("building synapses %d%%",(int)(outer_index/(float)brain_size*100));
|
status::update("building synapses %d%%",(int)(progress/(float)brain_size*100));
|
||||||
for (auto &j : m_blocks) {
|
for (auto &j : m_blocks) {
|
||||||
if (index!=outer_index) {
|
if (index!=outer_index) {
|
||||||
// collect connections that are under threshold in closeness
|
// collect connections that are under threshold in closeness
|
||||||
|
|
@ -256,30 +259,32 @@ void brain::build_synapses_thresh(search_params ¶ms, double thresh) {
|
||||||
}
|
}
|
||||||
++index;
|
++index;
|
||||||
}
|
}
|
||||||
++outer_index;
|
++progress;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void brain::build_synapses_fixed(search_params ¶ms) {
|
void brain::build_synapses_fixed(search_params ¶ms) {
|
||||||
//m_average_error = calc_average_diff(params)*thresh;
|
//m_average_error = calc_average_diff(params)*thresh;
|
||||||
u32 brain_size = m_blocks.size();
|
u32 brain_size = m_blocks.size();
|
||||||
u32 outer_index = 0;
|
|
||||||
u32 num_synapses = NUM_FIXED_SYNAPSES;
|
u32 num_synapses = NUM_FIXED_SYNAPSES;
|
||||||
if (num_synapses>=m_blocks.size()) num_synapses=m_blocks.size()-1;
|
if (num_synapses>=m_blocks.size()) num_synapses=m_blocks.size()-1;
|
||||||
|
|
||||||
// need to stop the progress updates flooding osc
|
// need to stop the progress updates flooding osc
|
||||||
u32 update_period = 100;
|
u32 update_period = 100;
|
||||||
u32 update_tick = 0;
|
std::atomic<u32> update_tick{0};
|
||||||
|
std::atomic<u32> progress{0};
|
||||||
for (auto &i:m_blocks) {
|
#pragma omp parallel for
|
||||||
|
for (u32 outer_index = 0; outer_index < brain_size; ++outer_index) {
|
||||||
|
auto &i = m_blocks[outer_index];
|
||||||
if (update_tick>update_period) {
|
if (update_tick>update_period) {
|
||||||
status::update("building synapses %d%%",(int)(outer_index/(float)brain_size*100));
|
status::update("building synapses %d%%",(int)(progress/(float)brain_size*100));
|
||||||
update_tick=0;
|
update_tick=0;
|
||||||
}
|
}
|
||||||
update_tick++;
|
update_tick++;
|
||||||
|
|
||||||
u32 index = 0;
|
u32 index = 0;
|
||||||
vector<pair<u32,double>> collect;
|
vector<pair<u32,double>> collect;
|
||||||
|
collect.reserve(brain_size);
|
||||||
|
|
||||||
// collect comparisons to all other blocks
|
// collect comparisons to all other blocks
|
||||||
for (auto &j:m_blocks) {
|
for (auto &j:m_blocks) {
|
||||||
|
|
@ -304,7 +309,7 @@ void brain::build_synapses_fixed(search_params ¶ms) {
|
||||||
i.get_synapse().push_back(collect[n].first);
|
i.get_synapse().push_back(collect[n].first);
|
||||||
}
|
}
|
||||||
|
|
||||||
++outer_index;
|
++progress;
|
||||||
}
|
}
|
||||||
status::update("Done: %d synapses grown for %d blocks",num_synapses*brain_size,brain_size);
|
status::update("Done: %d synapses grown for %d blocks",num_synapses*brain_size,brain_size);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -96,6 +96,9 @@
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>plain fft match vs mfcc values </string>
|
||||||
|
</property>
|
||||||
<property name="maximum">
|
<property name="maximum">
|
||||||
<double>1.000000000000000</double>
|
<double>1.000000000000000</double>
|
||||||
</property>
|
</property>
|
||||||
|
|
@ -156,6 +159,9 @@
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>match original or normalised blocks</string>
|
||||||
|
</property>
|
||||||
<property name="maximum">
|
<property name="maximum">
|
||||||
<double>1.000000000000000</double>
|
<double>1.000000000000000</double>
|
||||||
</property>
|
</property>
|
||||||
|
|
@ -298,6 +304,9 @@
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>use new blocks rather than similar ones</string>
|
||||||
|
</property>
|
||||||
<property name="maximum">
|
<property name="maximum">
|
||||||
<double>1.000000000000000</double>
|
<double>1.000000000000000</double>
|
||||||
</property>
|
</property>
|
||||||
|
|
@ -361,6 +370,9 @@
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>how long it takes for the novelty to wear off</string>
|
||||||
|
</property>
|
||||||
<property name="maximum">
|
<property name="maximum">
|
||||||
<double>1.000000000000000</double>
|
<double>1.000000000000000</double>
|
||||||
</property>
|
</property>
|
||||||
|
|
@ -424,6 +436,9 @@
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>likelihood of playing the next block rather than the closest</string>
|
||||||
|
</property>
|
||||||
<property name="maximum">
|
<property name="maximum">
|
||||||
<double>1.000000000000000</double>
|
<double>1.000000000000000</double>
|
||||||
</property>
|
</property>
|
||||||
|
|
@ -491,7 +506,7 @@
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>how many connections to search (ordered in closeness)</string>
|
<string>repeat search (set novelty to 0 for dodgy jungle timessssstretch)</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="minimum">
|
<property name="minimum">
|
||||||
<number>1</number>
|
<number>1</number>
|
||||||
|
|
@ -666,7 +681,7 @@
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>how many connections to search (ordered in closeness)</string>
|
<string>block difference higher than this causes a new search, skipping the target</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="maximum">
|
<property name="maximum">
|
||||||
<number>10000</number>
|
<number>10000</number>
|
||||||
|
|
@ -944,6 +959,9 @@
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>amount to match the frequency</string>
|
||||||
|
</property>
|
||||||
<property name="maximum">
|
<property name="maximum">
|
||||||
<double>1.000000000000000</double>
|
<double>1.000000000000000</double>
|
||||||
</property>
|
</property>
|
||||||
|
|
@ -1001,6 +1019,9 @@
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>mix in the normalised blocks</string>
|
||||||
|
</property>
|
||||||
<property name="maximum">
|
<property name="maximum">
|
||||||
<double>1.000000000000000</double>
|
<double>1.000000000000000</double>
|
||||||
</property>
|
</property>
|
||||||
|
|
@ -1061,6 +1082,9 @@
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>mix in the original blocks</string>
|
||||||
|
</property>
|
||||||
<property name="maximum">
|
<property name="maximum">
|
||||||
<double>1.000000000000000</double>
|
<double>1.000000000000000</double>
|
||||||
</property>
|
</property>
|
||||||
|
|
|
||||||
|
|
@ -47,9 +47,9 @@ SOURCES += app/MainWindow.cpp \
|
||||||
INCLUDEPATH += brain/src
|
INCLUDEPATH += brain/src
|
||||||
INCLUDEPATH += /usr/local/include
|
INCLUDEPATH += /usr/local/include
|
||||||
INCLUDEPATH += /opt/homebrew/include
|
INCLUDEPATH += /opt/homebrew/include
|
||||||
LIBS += -L.. -L/usr/local/lib -L/opt/homebrew/lib -lportaudio -lfftw3 -lsndfile -llo -ldl -lpthread -lm
|
LIBS += -L.. -L/usr/local/lib -L/opt/homebrew/lib -lportaudio -lfftw3 -lsndfile -llo -ldl -lpthread -lm -fopenmp
|
||||||
|
|
||||||
QMAKE_CXXFLAGS += -O3 -Wall -Wno-unused -std=c++11
|
QMAKE_CXXFLAGS += -O3 -fopenmp -Wall -Wno-unused -std=c++11
|
||||||
|
|
||||||
# assets
|
# assets
|
||||||
RESOURCES = app/samplebrain.qrc
|
RESOURCES = app/samplebrain.qrc
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue