freq/dynamics stuff

This commit is contained in:
Dave Griffiths
2015-07-21 18:13:39 +01:00
parent 8302566719
commit 1148166537
20 changed files with 708 additions and 618 deletions

View File

@ -49,8 +49,6 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_16">
<item> <item>
<widget class="QLabel" name="label_6"> <widget class="QLabel" name="label_6">
<property name="font"> <property name="font">
@ -66,8 +64,8 @@
</property> </property>
</widget> </widget>
</item> </item>
</layout> <item>
</item> <layout class="QHBoxLayout" name="horizontalLayout_16">
<item> <item>
<widget class="QSlider" name="sliderRatio"> <widget class="QSlider" name="sliderRatio">
<property name="sizePolicy"> <property name="sizePolicy">
@ -86,6 +84,12 @@
</item> </item>
<item> <item>
<widget class="QDoubleSpinBox" name="doubleSpinBoxRatio"> <widget class="QDoubleSpinBox" name="doubleSpinBoxRatio">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximum"> <property name="maximum">
<double>1.000000000000000</double> <double>1.000000000000000</double>
</property> </property>
@ -97,8 +101,62 @@
</property> </property>
</widget> </widget>
</item> </item>
</layout>
</item>
<item> <item>
<layout class="QVBoxLayout" name="verticalLayout_4"> <widget class="QLabel" name="label_20">
<property name="font">
<font>
<family>Comic Sans MS</family>
<pointsize>14</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>freq &amp; dynamics &lt;-&gt; freq ratio</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QSlider" name="sliderNRatio">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="value">
<number>50</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QDoubleSpinBox" name="doubleSpinBoxNRatio">
<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.500000000000000</double>
</property>
</widget>
</item>
</layout>
</item>
<item> <item>
<widget class="QLabel" name="label_7"> <widget class="QLabel" name="label_7">
<property name="font"> <property name="font">
@ -110,7 +168,7 @@
</font> </font>
</property> </property>
<property name="text"> <property name="text">
<string>fft subsection 1</string> <string>fft subsection</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -133,10 +191,6 @@
<item> <item>
<widget class="QSpinBox" name="spinBoxFFT1Start"/> <widget class="QSpinBox" name="spinBoxFFT1Start"/>
</item> </item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_9">
<item> <item>
<widget class="QLabel" name="label_10"> <widget class="QLabel" name="label_10">
<property name="font"> <property name="font">
@ -160,71 +214,6 @@
</item> </item>
</layout> </layout>
</item> </item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_5">
<item>
<widget class="QLabel" name="label_8">
<property name="font">
<font>
<family>Comic Sans MS</family>
<pointsize>14</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>fft subsection 2</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_10">
<item>
<widget class="QLabel" name="label_11">
<property name="font">
<font>
<family>Comic Sans MS</family>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Start</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="spinBoxFFT2Start"/>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_11">
<item>
<widget class="QLabel" name="label_12">
<property name="font">
<font>
<family>Comic Sans MS</family>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>End</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="spinBoxFFT2End">
<property name="value">
<number>99</number>
</property>
</widget>
</item>
</layout>
</item>
<item> <item>
<spacer name="verticalSpacer_3"> <spacer name="verticalSpacer_3">
<property name="orientation"> <property name="orientation">
@ -240,8 +229,6 @@
</item> </item>
</layout> </layout>
</item> </item>
</layout>
</item>
<item> <item>
<layout class="QVBoxLayout" name="verticalLayout_6"> <layout class="QVBoxLayout" name="verticalLayout_6">
<item> <item>
@ -259,20 +246,6 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QLabel" name="label_15">
<property name="font">
<font>
<family>Comic Sans MS</family>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>no sound yet...</string>
</property>
</widget>
</item>
<item> <item>
<widget class="QPushButton" name="pushButtonLoadTarget"> <widget class="QPushButton" name="pushButtonLoadTarget">
<property name="font"> <property name="font">
@ -908,6 +881,118 @@
</hint> </hint>
</hints> </hints>
</connection> </connection>
<connection>
<sender>dialVolume</sender>
<signal>sliderMoved(int)</signal>
<receiver>MainWindow</receiver>
<slot>volume_slot(int)</slot>
<hints>
<hint type="sourcelabel">
<x>189</x>
<y>480</y>
</hint>
<hint type="destinationlabel">
<x>361</x>
<y>301</y>
</hint>
</hints>
</connection>
<connection>
<sender>pushButtonStopRecord</sender>
<signal>released()</signal>
<receiver>MainWindow</receiver>
<slot>stop_record()</slot>
<hints>
<hint type="sourcelabel">
<x>328</x>
<y>543</y>
</hint>
<hint type="destinationlabel">
<x>361</x>
<y>306</y>
</hint>
</hints>
</connection>
<connection>
<sender>pushButtonRecord</sender>
<signal>released()</signal>
<receiver>MainWindow</receiver>
<slot>record()</slot>
<hints>
<hint type="sourcelabel">
<x>236</x>
<y>543</y>
</hint>
<hint type="destinationlabel">
<x>361</x>
<y>306</y>
</hint>
</hints>
</connection>
<connection>
<sender>spinBoxBlockSize</sender>
<signal>valueChanged(int)</signal>
<receiver>MainWindow</receiver>
<slot>block_size(int)</slot>
<hints>
<hint type="sourcelabel">
<x>188</x>
<y>105</y>
</hint>
<hint type="destinationlabel">
<x>399</x>
<y>301</y>
</hint>
</hints>
</connection>
<connection>
<sender>pushButtonLoadTarget</sender>
<signal>released()</signal>
<receiver>MainWindow</receiver>
<slot>load_target()</slot>
<hints>
<hint type="sourcelabel">
<x>277</x>
<y>103</y>
</hint>
<hint type="destinationlabel">
<x>399</x>
<y>301</y>
</hint>
</hints>
</connection>
<connection>
<sender>pushButtonGenerateTarget</sender>
<signal>released()</signal>
<receiver>MainWindow</receiver>
<slot>generate_target_blocks()</slot>
<hints>
<hint type="sourcelabel">
<x>277</x>
<y>202</y>
</hint>
<hint type="destinationlabel">
<x>399</x>
<y>301</y>
</hint>
</hints>
</connection>
<connection>
<sender>spinBoxBlockSizeTarget</sender>
<signal>valueChanged(int)</signal>
<receiver>MainWindow</receiver>
<slot>target_block_size(int)</slot>
<hints>
<hint type="sourcelabel">
<x>313</x>
<y>136</y>
</hint>
<hint type="destinationlabel">
<x>399</x>
<y>301</y>
</hint>
</hints>
</connection>
<connection> <connection>
<sender>doubleSpinBoxRatio</sender> <sender>doubleSpinBoxRatio</sender>
<signal>valueChanged(double)</signal> <signal>valueChanged(double)</signal>
@ -956,102 +1041,6 @@
</hint> </hint>
</hints> </hints>
</connection> </connection>
<connection>
<sender>spinBoxFFT2Start</sender>
<signal>valueChanged(int)</signal>
<receiver>MainWindow</receiver>
<slot>fft2_start_slot(int)</slot>
<hints>
<hint type="sourcelabel">
<x>154</x>
<y>366</y>
</hint>
<hint type="destinationlabel">
<x>399</x>
<y>301</y>
</hint>
</hints>
</connection>
<connection>
<sender>spinBoxFFT2End</sender>
<signal>valueChanged(int)</signal>
<receiver>MainWindow</receiver>
<slot>fft2_end_slot(int)</slot>
<hints>
<hint type="sourcelabel">
<x>154</x>
<y>399</y>
</hint>
<hint type="destinationlabel">
<x>399</x>
<y>301</y>
</hint>
</hints>
</connection>
<connection>
<sender>pushButtonLoadTarget</sender>
<signal>released()</signal>
<receiver>MainWindow</receiver>
<slot>load_target()</slot>
<hints>
<hint type="sourcelabel">
<x>277</x>
<y>103</y>
</hint>
<hint type="destinationlabel">
<x>399</x>
<y>301</y>
</hint>
</hints>
</connection>
<connection>
<sender>spinBoxBlockSizeTarget</sender>
<signal>valueChanged(int)</signal>
<receiver>MainWindow</receiver>
<slot>target_block_size(int)</slot>
<hints>
<hint type="sourcelabel">
<x>313</x>
<y>136</y>
</hint>
<hint type="destinationlabel">
<x>399</x>
<y>301</y>
</hint>
</hints>
</connection>
<connection>
<sender>pushButtonGenerateTarget</sender>
<signal>released()</signal>
<receiver>MainWindow</receiver>
<slot>generate_target_blocks()</slot>
<hints>
<hint type="sourcelabel">
<x>277</x>
<y>202</y>
</hint>
<hint type="destinationlabel">
<x>399</x>
<y>301</y>
</hint>
</hints>
</connection>
<connection>
<sender>spinBoxBlockSize</sender>
<signal>valueChanged(int)</signal>
<receiver>MainWindow</receiver>
<slot>block_size(int)</slot>
<hints>
<hint type="sourcelabel">
<x>188</x>
<y>105</y>
</hint>
<hint type="destinationlabel">
<x>399</x>
<y>301</y>
</hint>
</hints>
</connection>
<connection> <connection>
<sender>pushButtonGenerate</sender> <sender>pushButtonGenerate</sender>
<signal>released()</signal> <signal>released()</signal>
@ -1084,22 +1073,6 @@
</hint> </hint>
</hints> </hints>
</connection> </connection>
<connection>
<sender>dialVolume</sender>
<signal>sliderMoved(int)</signal>
<receiver>MainWindow</receiver>
<slot>volume_slot(int)</slot>
<hints>
<hint type="sourcelabel">
<x>189</x>
<y>480</y>
</hint>
<hint type="destinationlabel">
<x>361</x>
<y>301</y>
</hint>
</hints>
</connection>
<connection> <connection>
<sender>doubleSpinBoxBlockOverlap</sender> <sender>doubleSpinBoxBlockOverlap</sender>
<signal>valueChanged(double)</signal> <signal>valueChanged(double)</signal>
@ -1116,6 +1089,38 @@
</hint> </hint>
</hints> </hints>
</connection> </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>pushButtonDeleteSound</sender>
<signal>released()</signal>
<receiver>MainWindow</receiver>
<slot>delete_sound()</slot>
<hints>
<hint type="sourcelabel">
<x>476</x>
<y>544</y>
</hint>
<hint type="destinationlabel">
<x>361</x>
<y>301</y>
</hint>
</hints>
</connection>
<connection> <connection>
<sender>doubleSpinBoxBlockOverlapTarget</sender> <sender>doubleSpinBoxBlockOverlapTarget</sender>
<signal>valueChanged(double)</signal> <signal>valueChanged(double)</signal>
@ -1133,14 +1138,14 @@
</hints> </hints>
</connection> </connection>
<connection> <connection>
<sender>pushButtonClearBrain</sender> <sender>radioButton_dodgy</sender>
<signal>released()</signal> <signal>toggled(bool)</signal>
<receiver>MainWindow</receiver> <receiver>MainWindow</receiver>
<slot>clear_brain()</slot> <slot>window_dodgy(bool)</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>590</x> <x>75</x>
<y>544</y> <y>203</y>
</hint> </hint>
<hint type="destinationlabel"> <hint type="destinationlabel">
<x>361</x> <x>361</x>
@ -1149,13 +1154,77 @@
</hints> </hints>
</connection> </connection>
<connection> <connection>
<sender>pushButtonDeleteSound</sender> <sender>radioButton_blackman</sender>
<signal>released()</signal> <signal>toggled(bool)</signal>
<receiver>MainWindow</receiver> <receiver>MainWindow</receiver>
<slot>delete_sound()</slot> <slot>window_blackman(bool)</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>476</x> <x>75</x>
<y>261</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_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_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>pushButtonClearBrain</sender>
<signal>released()</signal>
<receiver>MainWindow</receiver>
<slot>clear_brain()</slot>
<hints>
<hint type="sourcelabel">
<x>590</x>
<y>544</y> <y>544</y>
</hint> </hint>
<hint type="destinationlabel"> <hint type="destinationlabel">
@ -1180,38 +1249,6 @@
</hint> </hint>
</hints> </hints>
</connection> </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> <connection>
<sender>radioButton_flattop</sender> <sender>radioButton_flattop</sender>
<signal>toggled(bool)</signal> <signal>toggled(bool)</signal>
@ -1228,54 +1265,6 @@
</hint> </hint>
</hints> </hints>
</connection> </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> <connection>
<sender>radioButton_rectagle</sender> <sender>radioButton_rectagle</sender>
<signal>toggled(bool)</signal> <signal>toggled(bool)</signal>
@ -1293,46 +1282,14 @@
</hints> </hints>
</connection> </connection>
<connection> <connection>
<sender>radioButton_bartlettTarget</sender> <sender>radioButton_rectangleTarget</sender>
<signal>toggled(bool)</signal> <signal>toggled(bool)</signal>
<receiver>MainWindow</receiver> <receiver>MainWindow</receiver>
<slot>window_target_bartlett(bool)</slot> <slot>window_target_rectangle(bool)</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>449</x> <x>619</x>
<y>290</y> <y>348</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>
<hint type="destinationlabel"> <hint type="destinationlabel">
<x>361</x> <x>361</x>
@ -1357,14 +1314,14 @@
</hints> </hints>
</connection> </connection>
<connection> <connection>
<sender>radioButton_gaussianTarget</sender> <sender>radioButton_blackmanTarget</sender>
<signal>toggled(bool)</signal> <signal>toggled(bool)</signal>
<receiver>MainWindow</receiver> <receiver>MainWindow</receiver>
<slot>window_target_gaussian(bool)</slot> <slot>window_target_blackman(bool)</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>619</x> <x>449</x>
<y>261</y> <y>319</y>
</hint> </hint>
<hint type="destinationlabel"> <hint type="destinationlabel">
<x>361</x> <x>361</x>
@ -1373,13 +1330,13 @@
</hints> </hints>
</connection> </connection>
<connection> <connection>
<sender>radioButton_hammingTarget</sender> <sender>radioButton_bartlettTarget</sender>
<signal>toggled(bool)</signal> <signal>toggled(bool)</signal>
<receiver>MainWindow</receiver> <receiver>MainWindow</receiver>
<slot>window_target_hamming(bool)</slot> <slot>window_target_bartlett(bool)</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>619</x> <x>449</x>
<y>290</y> <y>290</y>
</hint> </hint>
<hint type="destinationlabel"> <hint type="destinationlabel">
@ -1388,6 +1345,22 @@
</hint> </hint>
</hints> </hints>
</connection> </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> <connection>
<sender>radioButton_hannTarget</sender> <sender>radioButton_hannTarget</sender>
<signal>toggled(bool)</signal> <signal>toggled(bool)</signal>
@ -1405,14 +1378,14 @@
</hints> </hints>
</connection> </connection>
<connection> <connection>
<sender>radioButton_rectangleTarget</sender> <sender>radioButton_gaussianTarget</sender>
<signal>toggled(bool)</signal> <signal>toggled(bool)</signal>
<receiver>MainWindow</receiver> <receiver>MainWindow</receiver>
<slot>window_target_rectangle(bool)</slot> <slot>window_target_gaussian(bool)</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>619</x> <x>619</x>
<y>348</y> <y>261</y>
</hint> </hint>
<hint type="destinationlabel"> <hint type="destinationlabel">
<x>361</x> <x>361</x>
@ -1437,14 +1410,14 @@
</hints> </hints>
</connection> </connection>
<connection> <connection>
<sender>pushButtonStopRecord</sender> <sender>sliderNRatio</sender>
<signal>released()</signal> <signal>valueChanged(int)</signal>
<receiver>MainWindow</receiver> <receiver>MainWindow</receiver>
<slot>stop_record()</slot> <slot>n_ratio_slot(int)</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>328</x> <x>159</x>
<y>543</y> <y>211</y>
</hint> </hint>
<hint type="destinationlabel"> <hint type="destinationlabel">
<x>361</x> <x>361</x>
@ -1453,14 +1426,14 @@
</hints> </hints>
</connection> </connection>
<connection> <connection>
<sender>pushButtonRecord</sender> <sender>doubleSpinBoxNRatio</sender>
<signal>released()</signal> <signal>valueChanged(double)</signal>
<receiver>MainWindow</receiver> <receiver>MainWindow</receiver>
<slot>record()</slot> <slot>n_ratio_slot(double)</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>236</x> <x>330</x>
<y>543</y> <y>211</y>
</hint> </hint>
<hint type="destinationlabel"> <hint type="destinationlabel">
<x>361</x> <x>361</x>
@ -1511,5 +1484,7 @@
<slot>window_target_rectangle(bool)</slot> <slot>window_target_rectangle(bool)</slot>
<slot>record()</slot> <slot>record()</slot>
<slot>stop_record()</slot> <slot>stop_record()</slot>
<slot>n_ratio_slot(int)</slot>
<slot>n_ratio_slot(double)</slot>
</slots> </slots>
</ui> </ui>

View File

@ -42,6 +42,8 @@ private slots:
void stop_slot() { lo_send(m_audio_address,"/pause",""); } void stop_slot() { lo_send(m_audio_address,"/pause",""); }
void ratio_slot(int s) { lo_send(m_audio_address,"/ratio","f",s/100.0f); } void ratio_slot(int s) { lo_send(m_audio_address,"/ratio","f",s/100.0f); }
void ratio_slot(double s) { lo_send(m_audio_address,"/ratio","f",s); } void ratio_slot(double s) { lo_send(m_audio_address,"/ratio","f",s); }
void n_ratio_slot(int s) { lo_send(m_audio_address,"/n_ratio","f",s/100.0f); }
void n_ratio_slot(double s) { lo_send(m_audio_address,"/n_ratio","f",s); }
void fft1_start_slot(int s) { lo_send(m_audio_address,"/fft1_start","i",s); } void fft1_start_slot(int s) { lo_send(m_audio_address,"/fft1_start","i",s); }
void fft1_end_slot(int s) { lo_send(m_audio_address,"/fft1_end","i",s); } void fft1_end_slot(int s) { lo_send(m_audio_address,"/fft1_end","i",s); }
void fft2_start_slot(int s){} // { m_renderer->get_params()->m_fft2_start=s; } void fft2_start_slot(int s){} // { m_renderer->get_params()->m_fft2_start=s; }

View File

@ -67,6 +67,9 @@ void audio_thread::process(sample &s, sample &s2) {
if (name=="/ratio") { if (name=="/ratio") {
m_renderer->get_params()->m_ratio = cmd.get_float(0); m_renderer->get_params()->m_ratio = cmd.get_float(0);
} }
if (name=="/n_ratio") {
m_renderer->get_params()->m_n_ratio = cmd.get_float(0);
}
if (name=="/fft1_start") { if (name=="/fft1_start") {
m_renderer->get_params()->m_fft1_start = cmd.get_int(0); m_renderer->get_params()->m_fft1_start = cmd.get_int(0);
} }

View File

@ -1,7 +1,7 @@
/******************************************************************************** /********************************************************************************
** Form generated from reading UI file 'samplebrainB32443.ui' ** Form generated from reading UI file 'samplebrainB32443.ui'
** **
** Created: Tue Jul 21 14:56:57 2015 ** Created: Tue Jul 21 15:50:16 2015
** by: Qt User Interface Compiler version 4.8.1 ** 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!
@ -45,30 +45,23 @@ public:
QHBoxLayout *horizontalLayout_8; QHBoxLayout *horizontalLayout_8;
QVBoxLayout *verticalLayout_3; QVBoxLayout *verticalLayout_3;
QLabel *label_19; QLabel *label_19;
QHBoxLayout *horizontalLayout_16;
QLabel *label_6; QLabel *label_6;
QHBoxLayout *horizontalLayout_16;
QSlider *sliderRatio; QSlider *sliderRatio;
QDoubleSpinBox *doubleSpinBoxRatio; QDoubleSpinBox *doubleSpinBoxRatio;
QVBoxLayout *verticalLayout_4; QLabel *label_20;
QHBoxLayout *horizontalLayout;
QSlider *sliderNRatio;
QDoubleSpinBox *doubleSpinBoxNRatio;
QLabel *label_7; QLabel *label_7;
QHBoxLayout *horizontalLayout_3; QHBoxLayout *horizontalLayout_3;
QLabel *label_9; QLabel *label_9;
QSpinBox *spinBoxFFT1Start; QSpinBox *spinBoxFFT1Start;
QHBoxLayout *horizontalLayout_9;
QLabel *label_10; QLabel *label_10;
QSpinBox *spinBoxFFT1End; QSpinBox *spinBoxFFT1End;
QVBoxLayout *verticalLayout_5;
QLabel *label_8;
QHBoxLayout *horizontalLayout_10;
QLabel *label_11;
QSpinBox *spinBoxFFT2Start;
QHBoxLayout *horizontalLayout_11;
QLabel *label_12;
QSpinBox *spinBoxFFT2End;
QSpacerItem *verticalSpacer_3; QSpacerItem *verticalSpacer_3;
QVBoxLayout *verticalLayout_6; QVBoxLayout *verticalLayout_6;
QLabel *label_16; QLabel *label_16;
QLabel *label_15;
QPushButton *pushButtonLoadTarget; QPushButton *pushButtonLoadTarget;
QHBoxLayout *horizontalLayout_13; QHBoxLayout *horizontalLayout_13;
QLabel *label_17; QLabel *label_17;
@ -166,8 +159,6 @@ public:
verticalLayout_3->addWidget(label_19); verticalLayout_3->addWidget(label_19);
horizontalLayout_16 = new QHBoxLayout();
horizontalLayout_16->setObjectName(QString::fromUtf8("horizontalLayout_16"));
label_6 = new QLabel(controlTab); label_6 = new QLabel(controlTab);
label_6->setObjectName(QString::fromUtf8("label_6")); label_6->setObjectName(QString::fromUtf8("label_6"));
QFont font2; QFont font2;
@ -177,11 +168,10 @@ public:
font2.setWeight(75); font2.setWeight(75);
label_6->setFont(font2); label_6->setFont(font2);
horizontalLayout_16->addWidget(label_6); verticalLayout_3->addWidget(label_6);
verticalLayout_3->addLayout(horizontalLayout_16);
horizontalLayout_16 = new QHBoxLayout();
horizontalLayout_16->setObjectName(QString::fromUtf8("horizontalLayout_16"));
sliderRatio = new QSlider(controlTab); sliderRatio = new QSlider(controlTab);
sliderRatio->setObjectName(QString::fromUtf8("sliderRatio")); sliderRatio->setObjectName(QString::fromUtf8("sliderRatio"));
QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
@ -192,23 +182,59 @@ public:
sliderRatio->setValue(50); sliderRatio->setValue(50);
sliderRatio->setOrientation(Qt::Horizontal); sliderRatio->setOrientation(Qt::Horizontal);
verticalLayout_3->addWidget(sliderRatio); horizontalLayout_16->addWidget(sliderRatio);
doubleSpinBoxRatio = new QDoubleSpinBox(controlTab); doubleSpinBoxRatio = new QDoubleSpinBox(controlTab);
doubleSpinBoxRatio->setObjectName(QString::fromUtf8("doubleSpinBoxRatio")); doubleSpinBoxRatio->setObjectName(QString::fromUtf8("doubleSpinBoxRatio"));
QSizePolicy sizePolicy1(QSizePolicy::Fixed, QSizePolicy::Fixed);
sizePolicy1.setHorizontalStretch(0);
sizePolicy1.setVerticalStretch(0);
sizePolicy1.setHeightForWidth(doubleSpinBoxRatio->sizePolicy().hasHeightForWidth());
doubleSpinBoxRatio->setSizePolicy(sizePolicy1);
doubleSpinBoxRatio->setMaximum(1); doubleSpinBoxRatio->setMaximum(1);
doubleSpinBoxRatio->setSingleStep(0.01); doubleSpinBoxRatio->setSingleStep(0.01);
doubleSpinBoxRatio->setValue(0.5); doubleSpinBoxRatio->setValue(0.5);
verticalLayout_3->addWidget(doubleSpinBoxRatio); horizontalLayout_16->addWidget(doubleSpinBoxRatio);
verticalLayout_3->addLayout(horizontalLayout_16);
label_20 = new QLabel(controlTab);
label_20->setObjectName(QString::fromUtf8("label_20"));
label_20->setFont(font2);
verticalLayout_3->addWidget(label_20);
horizontalLayout = new QHBoxLayout();
horizontalLayout->setObjectName(QString::fromUtf8("horizontalLayout"));
sliderNRatio = new QSlider(controlTab);
sliderNRatio->setObjectName(QString::fromUtf8("sliderNRatio"));
sizePolicy.setHeightForWidth(sliderNRatio->sizePolicy().hasHeightForWidth());
sliderNRatio->setSizePolicy(sizePolicy);
sliderNRatio->setValue(50);
sliderNRatio->setOrientation(Qt::Horizontal);
horizontalLayout->addWidget(sliderNRatio);
doubleSpinBoxNRatio = new QDoubleSpinBox(controlTab);
doubleSpinBoxNRatio->setObjectName(QString::fromUtf8("doubleSpinBoxNRatio"));
sizePolicy1.setHeightForWidth(doubleSpinBoxNRatio->sizePolicy().hasHeightForWidth());
doubleSpinBoxNRatio->setSizePolicy(sizePolicy1);
doubleSpinBoxNRatio->setMaximum(1);
doubleSpinBoxNRatio->setSingleStep(0.01);
doubleSpinBoxNRatio->setValue(0.5);
horizontalLayout->addWidget(doubleSpinBoxNRatio);
verticalLayout_3->addLayout(horizontalLayout);
verticalLayout_4 = new QVBoxLayout();
verticalLayout_4->setObjectName(QString::fromUtf8("verticalLayout_4"));
label_7 = new QLabel(controlTab); label_7 = new QLabel(controlTab);
label_7->setObjectName(QString::fromUtf8("label_7")); label_7->setObjectName(QString::fromUtf8("label_7"));
label_7->setFont(font2); label_7->setFont(font2);
verticalLayout_4->addWidget(label_7); verticalLayout_3->addWidget(label_7);
horizontalLayout_3 = new QHBoxLayout(); horizontalLayout_3 = new QHBoxLayout();
horizontalLayout_3->setObjectName(QString::fromUtf8("horizontalLayout_3")); horizontalLayout_3->setObjectName(QString::fromUtf8("horizontalLayout_3"));
@ -223,76 +249,24 @@ public:
horizontalLayout_3->addWidget(spinBoxFFT1Start); horizontalLayout_3->addWidget(spinBoxFFT1Start);
verticalLayout_4->addLayout(horizontalLayout_3);
horizontalLayout_9 = new QHBoxLayout();
horizontalLayout_9->setObjectName(QString::fromUtf8("horizontalLayout_9"));
label_10 = new QLabel(controlTab); label_10 = new QLabel(controlTab);
label_10->setObjectName(QString::fromUtf8("label_10")); label_10->setObjectName(QString::fromUtf8("label_10"));
label_10->setFont(font); label_10->setFont(font);
horizontalLayout_9->addWidget(label_10); horizontalLayout_3->addWidget(label_10);
spinBoxFFT1End = new QSpinBox(controlTab); spinBoxFFT1End = new QSpinBox(controlTab);
spinBoxFFT1End->setObjectName(QString::fromUtf8("spinBoxFFT1End")); spinBoxFFT1End->setObjectName(QString::fromUtf8("spinBoxFFT1End"));
spinBoxFFT1End->setValue(99); spinBoxFFT1End->setValue(99);
horizontalLayout_9->addWidget(spinBoxFFT1End); horizontalLayout_3->addWidget(spinBoxFFT1End);
verticalLayout_4->addLayout(horizontalLayout_9); verticalLayout_3->addLayout(horizontalLayout_3);
verticalLayout_3->addLayout(verticalLayout_4);
verticalLayout_5 = new QVBoxLayout();
verticalLayout_5->setObjectName(QString::fromUtf8("verticalLayout_5"));
label_8 = new QLabel(controlTab);
label_8->setObjectName(QString::fromUtf8("label_8"));
label_8->setFont(font2);
verticalLayout_5->addWidget(label_8);
horizontalLayout_10 = new QHBoxLayout();
horizontalLayout_10->setObjectName(QString::fromUtf8("horizontalLayout_10"));
label_11 = new QLabel(controlTab);
label_11->setObjectName(QString::fromUtf8("label_11"));
label_11->setFont(font);
horizontalLayout_10->addWidget(label_11);
spinBoxFFT2Start = new QSpinBox(controlTab);
spinBoxFFT2Start->setObjectName(QString::fromUtf8("spinBoxFFT2Start"));
horizontalLayout_10->addWidget(spinBoxFFT2Start);
verticalLayout_5->addLayout(horizontalLayout_10);
horizontalLayout_11 = new QHBoxLayout();
horizontalLayout_11->setObjectName(QString::fromUtf8("horizontalLayout_11"));
label_12 = new QLabel(controlTab);
label_12->setObjectName(QString::fromUtf8("label_12"));
label_12->setFont(font);
horizontalLayout_11->addWidget(label_12);
spinBoxFFT2End = new QSpinBox(controlTab);
spinBoxFFT2End->setObjectName(QString::fromUtf8("spinBoxFFT2End"));
spinBoxFFT2End->setValue(99);
horizontalLayout_11->addWidget(spinBoxFFT2End);
verticalLayout_5->addLayout(horizontalLayout_11);
verticalSpacer_3 = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding); verticalSpacer_3 = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding);
verticalLayout_5->addItem(verticalSpacer_3); verticalLayout_3->addItem(verticalSpacer_3);
verticalLayout_3->addLayout(verticalLayout_5);
horizontalLayout_8->addLayout(verticalLayout_3); horizontalLayout_8->addLayout(verticalLayout_3);
@ -305,12 +279,6 @@ public:
verticalLayout_6->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_6->addWidget(label_15);
pushButtonLoadTarget = new QPushButton(controlTab); pushButtonLoadTarget = new QPushButton(controlTab);
pushButtonLoadTarget->setObjectName(QString::fromUtf8("pushButtonLoadTarget")); pushButtonLoadTarget->setObjectName(QString::fromUtf8("pushButtonLoadTarget"));
pushButtonLoadTarget->setFont(font); pushButtonLoadTarget->setFont(font);
@ -673,41 +641,41 @@ public:
retranslateUi(MainWindow); retranslateUi(MainWindow);
QObject::connect(pushButtonPlay, SIGNAL(released()), MainWindow, SLOT(play_slot())); QObject::connect(pushButtonPlay, SIGNAL(released()), MainWindow, SLOT(play_slot()));
QObject::connect(pushButtonStop, SIGNAL(released()), MainWindow, SLOT(stop_slot())); QObject::connect(pushButtonStop, SIGNAL(released()), MainWindow, SLOT(stop_slot()));
QObject::connect(dialVolume, SIGNAL(sliderMoved(int)), MainWindow, SLOT(volume_slot(int)));
QObject::connect(pushButtonStopRecord, SIGNAL(released()), MainWindow, SLOT(stop_record()));
QObject::connect(pushButtonRecord, SIGNAL(released()), MainWindow, SLOT(record()));
QObject::connect(spinBoxBlockSize, SIGNAL(valueChanged(int)), MainWindow, SLOT(block_size(int)));
QObject::connect(pushButtonLoadTarget, SIGNAL(released()), MainWindow, SLOT(load_target()));
QObject::connect(pushButtonGenerateTarget, SIGNAL(released()), MainWindow, SLOT(generate_target_blocks()));
QObject::connect(spinBoxBlockSizeTarget, SIGNAL(valueChanged(int)), MainWindow, SLOT(target_block_size(int)));
QObject::connect(doubleSpinBoxRatio, SIGNAL(valueChanged(double)), MainWindow, SLOT(ratio_slot(double))); QObject::connect(doubleSpinBoxRatio, SIGNAL(valueChanged(double)), MainWindow, SLOT(ratio_slot(double)));
QObject::connect(spinBoxFFT1Start, SIGNAL(valueChanged(int)), MainWindow, SLOT(fft1_start_slot(int))); QObject::connect(spinBoxFFT1Start, SIGNAL(valueChanged(int)), MainWindow, SLOT(fft1_start_slot(int)));
QObject::connect(spinBoxFFT1End, SIGNAL(valueChanged(int)), MainWindow, SLOT(fft1_end_slot(int))); QObject::connect(spinBoxFFT1End, SIGNAL(valueChanged(int)), MainWindow, SLOT(fft1_end_slot(int)));
QObject::connect(spinBoxFFT2Start, SIGNAL(valueChanged(int)), MainWindow, SLOT(fft2_start_slot(int)));
QObject::connect(spinBoxFFT2End, SIGNAL(valueChanged(int)), MainWindow, SLOT(fft2_end_slot(int)));
QObject::connect(pushButtonLoadTarget, SIGNAL(released()), MainWindow, SLOT(load_target()));
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(pushButtonGenerate, SIGNAL(released()), MainWindow, SLOT(generate())); QObject::connect(pushButtonGenerate, SIGNAL(released()), MainWindow, SLOT(generate()));
QObject::connect(pushButtonLoadSound, SIGNAL(released()), MainWindow, SLOT(load_sound())); QObject::connect(pushButtonLoadSound, SIGNAL(released()), MainWindow, SLOT(load_sound()));
QObject::connect(dialVolume, SIGNAL(sliderMoved(int)), MainWindow, SLOT(volume_slot(int)));
QObject::connect(doubleSpinBoxBlockOverlap, SIGNAL(valueChanged(double)), MainWindow, SLOT(block_overlap(double))); QObject::connect(doubleSpinBoxBlockOverlap, SIGNAL(valueChanged(double)), MainWindow, SLOT(block_overlap(double)));
QObject::connect(doubleSpinBoxBlockOverlapTarget, SIGNAL(valueChanged(double)), MainWindow, SLOT(target_block_overlap(double)));
QObject::connect(pushButtonClearBrain, SIGNAL(released()), MainWindow, SLOT(clear_brain()));
QObject::connect(pushButtonDeleteSound, SIGNAL(released()), MainWindow, SLOT(delete_sound()));
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_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(pushButtonDeleteSound, SIGNAL(released()), MainWindow, SLOT(delete_sound()));
QObject::connect(doubleSpinBoxBlockOverlapTarget, SIGNAL(valueChanged(double)), MainWindow, SLOT(target_block_overlap(double)));
QObject::connect(radioButton_dodgy, SIGNAL(toggled(bool)), MainWindow, SLOT(window_dodgy(bool)));
QObject::connect(radioButton_blackman, SIGNAL(toggled(bool)), MainWindow, SLOT(window_blackman(bool)));
QObject::connect(radioButton_hann, SIGNAL(toggled(bool)), MainWindow, SLOT(window_hann(bool)));
QObject::connect(radioButton_hamming, SIGNAL(toggled(bool)), MainWindow, SLOT(window_hamming(bool)));
QObject::connect(radioButton_gaussian, SIGNAL(toggled(bool)), MainWindow, SLOT(window_gaussian(bool)));
QObject::connect(pushButtonClearBrain, SIGNAL(released()), MainWindow, SLOT(clear_brain()));
QObject::connect(radioButton_bartlett, SIGNAL(toggled(bool)), MainWindow, SLOT(window_bartlett(bool)));
QObject::connect(radioButton_flattop, SIGNAL(toggled(bool)), MainWindow, SLOT(window_flattop(bool)));
QObject::connect(radioButton_rectagle, SIGNAL(toggled(bool)), MainWindow, SLOT(window_rectangle(bool)));
QObject::connect(radioButton_rectangleTarget, SIGNAL(toggled(bool)), MainWindow, SLOT(window_target_rectangle(bool))); QObject::connect(radioButton_rectangleTarget, SIGNAL(toggled(bool)), MainWindow, SLOT(window_target_rectangle(bool)));
QObject::connect(radioButton_flattopTarget, SIGNAL(toggled(bool)), MainWindow, SLOT(window_target_flattop(bool)));
QObject::connect(radioButton_blackmanTarget, SIGNAL(toggled(bool)), MainWindow, SLOT(window_target_blackman(bool)));
QObject::connect(radioButton_bartlettTarget, SIGNAL(toggled(bool)), MainWindow, SLOT(window_target_bartlett(bool)));
QObject::connect(radioButton_dodgyTarget, SIGNAL(toggled(bool)), MainWindow, SLOT(window_target_dodgy(bool)));
QObject::connect(radioButton_hannTarget, SIGNAL(toggled(bool)), MainWindow, SLOT(window_target_hann(bool)));
QObject::connect(radioButton_gaussianTarget, SIGNAL(toggled(bool)), MainWindow, SLOT(window_target_gaussian(bool)));
QObject::connect(sliderRatio, SIGNAL(valueChanged(int)), MainWindow, SLOT(ratio_slot(int))); QObject::connect(sliderRatio, SIGNAL(valueChanged(int)), MainWindow, SLOT(ratio_slot(int)));
QObject::connect(pushButtonStopRecord, SIGNAL(released()), MainWindow, SLOT(stop_record())); QObject::connect(sliderNRatio, SIGNAL(valueChanged(int)), MainWindow, SLOT(n_ratio_slot(int)));
QObject::connect(pushButtonRecord, SIGNAL(released()), MainWindow, SLOT(record())); QObject::connect(doubleSpinBoxNRatio, SIGNAL(valueChanged(double)), MainWindow, SLOT(n_ratio_slot(double)));
tabWidget->setCurrentIndex(0); tabWidget->setCurrentIndex(0);
@ -720,14 +688,11 @@ public:
MainWindow->setWindowTitle(QApplication::translate("MainWindow", "samplebrain 0.0.4", 0, QApplication::UnicodeUTF8)); MainWindow->setWindowTitle(QApplication::translate("MainWindow", "samplebrain 0.0.4", 0, QApplication::UnicodeUTF8));
label_19->setText(QApplication::translate("MainWindow", "tweakage", 0, QApplication::UnicodeUTF8)); label_19->setText(QApplication::translate("MainWindow", "tweakage", 0, QApplication::UnicodeUTF8));
label_6->setText(QApplication::translate("MainWindow", "fft <-> mfcc ratio", 0, QApplication::UnicodeUTF8)); label_6->setText(QApplication::translate("MainWindow", "fft <-> mfcc ratio", 0, QApplication::UnicodeUTF8));
label_7->setText(QApplication::translate("MainWindow", "fft subsection 1", 0, QApplication::UnicodeUTF8)); label_20->setText(QApplication::translate("MainWindow", "freq & dynamics <-> freq ratio", 0, QApplication::UnicodeUTF8));
label_7->setText(QApplication::translate("MainWindow", "fft subsection", 0, QApplication::UnicodeUTF8));
label_9->setText(QApplication::translate("MainWindow", "Start", 0, QApplication::UnicodeUTF8)); label_9->setText(QApplication::translate("MainWindow", "Start", 0, QApplication::UnicodeUTF8));
label_10->setText(QApplication::translate("MainWindow", "End", 0, QApplication::UnicodeUTF8)); label_10->setText(QApplication::translate("MainWindow", "End", 0, QApplication::UnicodeUTF8));
label_8->setText(QApplication::translate("MainWindow", "fft subsection 2", 0, QApplication::UnicodeUTF8));
label_11->setText(QApplication::translate("MainWindow", "Start", 0, QApplication::UnicodeUTF8));
label_12->setText(QApplication::translate("MainWindow", "End", 0, QApplication::UnicodeUTF8));
label_16->setText(QApplication::translate("MainWindow", "target sound", 0, QApplication::UnicodeUTF8)); label_16->setText(QApplication::translate("MainWindow", "target sound", 0, QApplication::UnicodeUTF8));
label_15->setText(QApplication::translate("MainWindow", "no sound yet...", 0, QApplication::UnicodeUTF8));
pushButtonLoadTarget->setText(QApplication::translate("MainWindow", "load target", 0, QApplication::UnicodeUTF8)); pushButtonLoadTarget->setText(QApplication::translate("MainWindow", "load target", 0, QApplication::UnicodeUTF8));
label_17->setText(QApplication::translate("MainWindow", "block size", 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)); label_18->setText(QApplication::translate("MainWindow", "block overlap", 0, QApplication::UnicodeUTF8));

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

@ -0,0 +1,9 @@
<RCC>
<qresource prefix="images">
<file>images/at.png</file>
<file>images/pause.png</file>
<file>images/play.png</file>
<file>images/record.png</file>
<file>images/stop.png</file>
</qresource>
</RCC>

View File

@ -15,6 +15,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <assert.h> #include <assert.h>
#include <float.h>
#include <iostream> #include <iostream>
#include "block.h" #include "block.h"
@ -26,11 +27,41 @@ Aquila::Mfcc *block::m_mfcc_proc;
static const int MFCC_FILTERS=12; static const int MFCC_FILTERS=12;
void normalise(sample &in) {
// find min/max
float max = 0;
float min = FLT_MAX;
for (u32 i=0; i<in.get_length(); ++i) {
if (in[i]<min) min=in[i];
if (in[i]>max) max=in[i];
}
float mid = min+(max-min)/2.0f;
// remove dc
for (u32 i=0; i<in.get_length(); ++i) {
in[i]-=mid;
}
min-=mid;
max-=mid;
// squash so biggest value is 1 or -1
float div = fabs(min);
if (div<max) div=max;
div=1/div;
for (u32 i=0; i<in.get_length(); ++i) {
in[i]*=div;
}
}
block::block(const string &filename, const sample &pcm, u32 rate, const window &w, bool ditchpcm) : block::block(const string &filename, const sample &pcm, u32 rate, const window &w, bool ditchpcm) :
m_pcm(pcm), m_pcm(pcm),
m_fft(pcm.get_length()), m_fft(pcm.get_length()),
m_mfcc(MFCC_FILTERS), m_mfcc(MFCC_FILTERS),
m_n_pcm(pcm),
m_n_fft(pcm.get_length()),
m_n_mfcc(MFCC_FILTERS),
m_block_size(pcm.get_length()), m_block_size(pcm.get_length()),
m_rate(rate), m_rate(rate),
m_orig_filename(filename) m_orig_filename(filename)
@ -40,30 +71,19 @@ block::block(const string &filename, const sample &pcm, u32 rate, const window &
assert(m_fftw!=NULL); assert(m_fftw!=NULL);
w.run(m_pcm); w.run(m_pcm);
process(m_pcm,m_fft,m_mfcc);
m_fftw->impulse2freq(m_pcm.get_non_const_buffer()); // rerun the normalised version
normalise(m_n_pcm);
process(m_n_pcm,m_n_fft,m_n_mfcc);
std::vector<std::complex<double> > mfspec; if (ditchpcm) {
m_pcm.clear();
for (u32 i=0; i<m_block_size; ++i) { m_n_pcm.clear();
m_fft[i]=m_fftw->m_spectrum[i][0];
mfspec.push_back(std::complex<double>(m_fftw->m_spectrum[i][0],
m_fftw->m_spectrum[i][1]));
} }
if (m_block_size>100) m_fft.crop_to(100);
if (ditchpcm) m_pcm.clear();
// calculate mfcc
std::vector<double> m = m_mfcc_proc->calculate(mfspec,MFCC_FILTERS);
for (u32 i=0; i<MFCC_FILTERS; ++i) {
m_mfcc[i] = m[i];
}
} }
void block::init_fft(u32 block_size) void block::init_fft(u32 block_size)
{ {
if (m_fftw == NULL || m_fftw->m_length!=block_size) { if (m_fftw == NULL || m_fftw->m_length!=block_size) {
@ -74,48 +94,101 @@ void block::init_fft(u32 block_size)
} }
} }
void block::process(const sample &pcm, sample &fft, sample &mfcc) {
m_fftw->impulse2freq(pcm.get_buffer());
// calculate fft
std::vector<std::complex<double> > mfspec;
for (u32 i=0; i<m_block_size; ++i) {
fft[i]=m_fftw->m_spectrum[i][0];
mfspec.push_back(std::complex<double>(m_fftw->m_spectrum[i][0],
m_fftw->m_spectrum[i][1]));
}
if (m_block_size>100) fft.crop_to(100);
// calculate mfcc
std::vector<double> m = m_mfcc_proc->calculate(mfspec,MFCC_FILTERS);
for (u32 i=0; i<MFCC_FILTERS; ++i) {
mfcc[i] = m[i];
}
}
#define FFT_BIAS 200 #define FFT_BIAS 200
double block::compare(const block &other, const search_params &params) const { double block::_compare(const sample &fft_a, const sample &mfcc_a,
const sample &fft_b, const sample &mfcc_b,
const search_params &params) const
{
double mfcc_acc=0; double mfcc_acc=0;
double fft_acc=0; double fft_acc=0;
/* s32 fft_start = fftwack-10;
s32 fft_end = fftwack+10;
if (fft_start<0) fft_start=0;
if (fft_end>m_fft.get_length()) fft_end=m_fft.get_length();
*/
s32 fft_start = params.m_fft1_start; s32 fft_start = params.m_fft1_start;
s32 fft_end = fmin(params.m_fft1_end,m_fft.get_length()); s32 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) {
fft_acc+=(m_fft[i]-other.m_fft[i]) * (m_fft[i]-other.m_fft[i]); fft_acc+=(fft_a[i]-fft_b[i]) * (fft_a[i]-fft_b[i]);
} }
return (fft_acc/(float)m_fft.get_length())*FFT_BIAS; return (fft_acc/(float)fft_a.get_length())*FFT_BIAS;
} }
if (params.m_ratio==1) { if (params.m_ratio==1) {
for (u32 i=0; i<MFCC_FILTERS; ++i) { for (u32 i=0; i<MFCC_FILTERS; ++i) {
mfcc_acc+=(m_mfcc[i]-other.m_mfcc[i]) * (m_mfcc[i]-other.m_mfcc[i]); mfcc_acc+=(mfcc_a[i]-mfcc_b[i]) * (mfcc_a[i]-mfcc_b[i]);
} }
return mfcc_acc/(float)MFCC_FILTERS; return mfcc_acc/(float)MFCC_FILTERS;
} }
// calculate both // calculate both
for (u32 i=fft_start; i<fft_end; ++i) { for (u32 i=fft_start; i<fft_end; ++i) {
fft_acc+=(m_fft[i]-other.m_fft[i]) * (m_fft[i]-other.m_fft[i]); fft_acc+=(fft_a[i]-fft_b[i]) * (fft_a[i]-fft_b[i]);
} }
for (u32 i=0; i<MFCC_FILTERS; ++i) { for (u32 i=0; i<MFCC_FILTERS; ++i) {
mfcc_acc+=(m_mfcc[i]-other.m_mfcc[i]) * (m_mfcc[i]-other.m_mfcc[i]); mfcc_acc+=(mfcc_a[i]-mfcc_b[i]) * (mfcc_a[i]-mfcc_b[i]);
} }
return (fft_acc/(float)m_fft.get_length())*(1-params.m_ratio)*FFT_BIAS + return (fft_acc/(float)fft_a.get_length())*(1-params.m_ratio)*FFT_BIAS +
(mfcc_acc/(float)MFCC_FILTERS)*params.m_ratio; (mfcc_acc/(float)MFCC_FILTERS)*params.m_ratio;
} }
double block::compare(const block &other, const search_params &params) const {
return _compare(m_fft, m_mfcc, other.m_fft, other.m_mfcc, params) * (1-params.m_n_ratio) +
_compare(m_n_fft, m_n_mfcc, other.m_n_fft, other.m_n_mfcc, params) * params.m_n_ratio;
}
bool block::unit_test() { bool block::unit_test() {
sample ntest(3);
u32 idx=0;
ntest[idx++]=-1;
ntest[idx++]=1;
ntest[idx++]=-1;
idx=0;
normalise(ntest);
assert(feq(ntest[idx++],-1));
assert(feq(ntest[idx++],1));
assert(feq(ntest[idx++],-1));
idx=0;
ntest[idx++]=-2;
ntest[idx++]=2;
ntest[idx++]=-2;
normalise(ntest);
idx=0;
assert(feq(ntest[idx++],-1));
assert(feq(ntest[idx++],1));
assert(feq(ntest[idx++],-1));
idx=0;
ntest[idx++]=19;
ntest[idx++]=20;
ntest[idx++]=19;
normalise(ntest);
idx=0;
assert(feq(ntest[idx++],-1));
assert(feq(ntest[idx++],1));
assert(feq(ntest[idx++],-1));
sample data(200); sample data(200);
for (u32 i=0; i<data.get_length(); i++) { for (u32 i=0; i<data.get_length(); i++) {
data[i]=i/(float)data.get_length(); data[i]=i/(float)data.get_length();
@ -133,7 +206,7 @@ bool block::unit_test() {
assert(bb.m_rate==44100); assert(bb.m_rate==44100);
assert(bb.m_block_size==data.get_length()); assert(bb.m_block_size==data.get_length());
search_params p(0,0,100,0,100); search_params p(0,0,0,100,0,100);
block bb2("test",data,44100,w); block bb2("test",data,44100,w);
assert(bb.compare(bb2,p)==0); assert(bb.compare(bb2,p)==0);
p.m_ratio=1; p.m_ratio=1;
@ -159,5 +232,7 @@ bool block::unit_test() {
assert(cpy.m_pcm.get_length()==200); assert(cpy.m_pcm.get_length()==200);
return true; return true;
} }

View File

@ -41,10 +41,21 @@ public:
const sample &get_pcm() const { return m_pcm; } const sample &get_pcm() const { return m_pcm; }
private: private:
void process(const sample &pcm, sample &fft, sample &mfcc);
double _compare(const sample &fft_a, const sample &mfcc_a,
const sample &fft_b, const sample &mfcc_b,
const search_params &params) const;
sample m_pcm; sample m_pcm;
sample m_fft; sample m_fft;
sample m_mfcc; sample m_mfcc;
sample m_n_pcm;
sample m_n_fft;
sample m_n_mfcc;
u32 m_block_size; u32 m_block_size;
u32 m_rate; u32 m_rate;
std::string m_orig_filename; std::string m_orig_filename;

View File

@ -153,7 +153,7 @@ bool brain::unit_test() {
b2.init(512, 0, window::BLACKMAN); b2.init(512, 0, window::BLACKMAN);
b3.init(512, 0, window::BLACKMAN); b3.init(512, 0, window::BLACKMAN);
search_params p(1,0,100,0,100); search_params p(1,0,0,100,0,100);
assert(b3.search(b2.m_blocks[0],p)==0); assert(b3.search(b2.m_blocks[0],p)==0);
assert(b3.search(b2.m_blocks[9],p)==9); assert(b3.search(b2.m_blocks[9],p)==9);

View File

@ -1,3 +1,19 @@
// Copyright (C) 2015 Foam Kernow
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <fft.h> #include <fft.h>
#include <jellyfish/core/types.h> #include <jellyfish/core/types.h>
@ -19,7 +35,7 @@ FFT::~FFT()
fftw_destroy_plan(m_plan); fftw_destroy_plan(m_plan);
} }
void FFT::impulse2freq(float *imp) void FFT::impulse2freq(const float *imp)
{ {
unsigned int i; unsigned int i;

View File

@ -1,3 +1,19 @@
// Copyright (C) 2015 Foam Kernow
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <fftw3.h> #include <fftw3.h>
#ifndef SPIRALCORE_FFT #ifndef SPIRALCORE_FFT
@ -12,7 +28,7 @@ class FFT
public: public:
FFT(int length); FFT(int length);
~FFT(); ~FFT();
void impulse2freq(float *imp); void impulse2freq(const float *imp);
fftw_plan m_plan; fftw_plan m_plan;
unsigned int m_length; unsigned int m_length;

View File

@ -59,19 +59,19 @@ int main(int argc, char *argv[])
brain source, target; brain source, target;
// source.load_sound("../sound/source/shostakovich6.wav"); // source.load_sound("../sound/source/shostakovich6.wav");
// source.load_sound("../sound/source/808.wav"); source.load_sound("../sound/source/808.wav");
// source.load_sound("../sound/source/joey.wav"); source.load_sound("../sound/source/joey.wav");
// source.load_sound("../sound/source/pw2.wav"); source.load_sound("../sound/source/pw2.wav");
// source.load_sound("../sound/source/pw3.wav"); source.load_sound("../sound/source/pw3.wav");
// source.load_sound("../sound/source/claps.wav"); source.load_sound("../sound/source/claps.wav");
// source.load_sound("../sound/source/eagle.wav"); source.load_sound("../sound/source/eagle.wav");
// source.load_sound("../sound/source/sailingbybit.wav"); target.load_sound("../sound/source/apache.wav");
source.load_sound("../sound/source/rise.wav"); // source.load_sound("../sound/source/rise.wav");
//target.load_sound("../sound/source/sb-left.wav"); //target.load_sound("../sound/source/sb-left.wav");
target.load_sound("../sound/source/rise.wav"); // target.load_sound("../sound/source/rise.wav");
cerr<<"loaded sounds"<<endl; cerr<<"loaded sounds"<<endl;
cerr<<endl; cerr<<endl;
u32 len=3000; u32 len=3000;
@ -86,7 +86,7 @@ int main(int argc, char *argv[])
renderer rr(source,target); renderer rr(source,target);
rr.set_playing(true); rr.set_playing(true);
rr.get_params()->m_ratio=0; rr.get_params()->m_ratio=0.5;
a->m_client.set_callback(run_audio, &rr); a->m_client.set_callback(run_audio, &rr);

View File

@ -46,6 +46,7 @@ void renderer::process(u32 nframes, float *buf) {
return; return;
} }
// cerr<<"-----------------"<<endl; // cerr<<"-----------------"<<endl;
// cerr<<"tgt start:"<<tgt_start<<endl; // cerr<<"tgt start:"<<tgt_start<<endl;
// cerr<<"tgt end:"<<tgt_end<<endl; // cerr<<"tgt end:"<<tgt_end<<endl;

View File

@ -25,10 +25,10 @@ namespace spiralcore {
class renderer { class renderer {
public: public:
renderer(brain &source, brain &target) : renderer(brain &source, brain &target) :
m_source(source), m_source(source),
m_target(target), m_target(target),
m_search_params(0,0,100,0,100) m_search_params(0,0,0,100,0,100)
{ init(source,target); } { init(source,target); }
void init(brain &source, brain &target); void init(brain &source, brain &target);

View File

@ -1,3 +1,19 @@
// Copyright (C) 2015 Foam Kernow
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef SEARCH_PARAMS #ifndef SEARCH_PARAMS
#define SEARCH_PARAMS #define SEARCH_PARAMS
@ -5,15 +21,16 @@ namespace spiralcore {
class search_params { class search_params {
public: public:
search_params(float ratio, int s1, int e1, int s2, int e2) : search_params(float ratio, float n_ratio, int s1, int e1, int s2, int e2) :
m_ratio(ratio), m_ratio(ratio),
m_n_ratio(n_ratio),
m_fft1_start(s1), m_fft1_start(s1),
m_fft1_end(e1), m_fft1_end(e1),
m_fft2_start(s2), m_fft2_start(s2),
m_fft2_end(e2) {} m_fft2_end(e2) {}
float m_ratio; float m_ratio;
float m_n_ratio;
int m_fft1_start; int m_fft1_start;
int m_fft1_end; int m_fft1_end;
int m_fft2_start; int m_fft2_start;