• R/O
  • SSH
  • HTTPS

cadencii: コミット


コミットメタ情報

リビジョン1987 (tree)
日時2012-02-20 04:01:18
作者haruneko24

ログメッセージ

[StandConverter] DIOの推定ミス修正ツール+WORLDビジュアライズツール(予定)

変更サマリ

差分

--- vConnect/trunk/stand2.0/StandConverter/stand.h (revision 1986)
+++ vConnect/trunk/stand2.0/StandConverter/stand.h (nonexistent)
@@ -1,11 +0,0 @@
1-#ifndef STAND_H
2-#define STAND_H
3-
4-/*
5- * use FFTW or SPTK FFT ?
6- * If you want to use FFTW, define USE_FFTW.
7- * otherwise, undef USE_FFTW.
8- */
9-#define USE_FFTW
10-
11-#endif // STAND_H
--- vConnect/trunk/stand2.0/StandConverter/utility/F0Contour.cpp (nonexistent)
+++ vConnect/trunk/stand2.0/StandConverter/utility/F0Contour.cpp (revision 1987)
@@ -0,0 +1,43 @@
1+#include "F0Contour.h"
2+
3+// for debug
4+#include <qglobal.h>
5+
6+using namespace stand::utility;
7+
8+F0Contour::F0Contour(double *f0, int length, double framePeriod)
9+{
10+ set(f0, length, framePeriod);
11+}
12+
13+void F0Contour::set(double *f0, int length, double framePeriod)
14+{
15+ if(f0)
16+ {
17+ _f0 = f0;
18+ _length = length;
19+ _framePeriod = framePeriod;
20+ if(_framePeriod <= 0.0)
21+ {
22+ _framePeriod = stand::DefaultFramePeriod;
23+ }
24+ }
25+}
26+
27+double F0Contour::at(double ms)
28+{
29+ if(!_f0)
30+ {
31+ return -1.0;
32+ }
33+ int index = ms / _framePeriod;
34+ if(index < 0)
35+ {
36+ index = 0;
37+ }
38+ else if(index >= _length)
39+ {
40+ index = _length - 1;
41+ }
42+ return _f0[index];
43+}
--- vConnect/trunk/stand2.0/StandConverter/utility/F0Contour.h (nonexistent)
+++ vConnect/trunk/stand2.0/StandConverter/utility/F0Contour.h (revision 1987)
@@ -0,0 +1,44 @@
1+#ifndef F0CONTOUR_H
2+#define F0CONTOUR_H
3+
4+#include "../configure.h"
5+
6+namespace stand
7+{
8+namespace utility
9+{
10+
11+class F0Contour
12+{
13+public:
14+ explicit F0Contour(double *f0 = 0, int length = 0, double framePeriod = 0);
15+
16+ const double *f0() const
17+ {
18+ return _f0;
19+ }
20+
21+ int length() const
22+ {
23+ return _length;
24+ }
25+
26+ double framePeriod() const
27+ {
28+ return _framePeriod;
29+ }
30+
31+ double at(double ms);
32+
33+ void set(double *f0, int length, double framePeriod);
34+
35+private:
36+ double *_f0;
37+ int _length;
38+ double _framePeriod;
39+};
40+
41+}
42+}
43+
44+#endif // F0CONTOUR_H
--- vConnect/trunk/stand2.0/StandConverter/gui/SpecgramView.h (nonexistent)
+++ vConnect/trunk/stand2.0/StandConverter/gui/SpecgramView.h (revision 1987)
@@ -0,0 +1,66 @@
1+#ifndef SPECGRAMVIEW_H
2+#define SPECGRAMVIEW_H
3+
4+#include <QWidget>
5+#include <QImage>
6+
7+#include "../configure.h"
8+
9+namespace stand
10+{
11+namespace math
12+{
13+class SpecgramSet;
14+}
15+namespace gui
16+{
17+
18+class SpecgramView : public QWidget
19+{
20+ Q_OBJECT
21+public:
22+ enum ScaleType
23+ {
24+ Unknown = -1,
25+ Linear = 0,
26+ Log
27+ };
28+
29+ struct Setting
30+ {
31+ stand::math::SpecgramSet *specgram;
32+ double frequencyCeil;
33+ double frequencyFloor;
34+ ScaleType scaleType;
35+ };
36+
37+ explicit SpecgramView(stand::math::SpecgramSet *specgram = 0, double frequencyFloor = 0.0, double frequencyCeil = 0.0, ScaleType type = Linear, QWidget *parent = 0);
38+ explicit SpecgramView(const stand::gui::SpecgramView::Setting &setting, QWidget *parent = 0);
39+ explicit SpecgramView(QWidget *parent = 0);
40+ virtual ~SpecgramView();
41+
42+ virtual void paintEvent(QPaintEvent *e);
43+
44+ double frequencyByPosition(int y);
45+ int positionByFrequency(double freq);
46+
47+signals:
48+
49+public slots:
50+ virtual void setSpecgram(stand::math::SpecgramSet *specgram, double frequencyFloor, double frequencyCeil, ScaleType type);
51+ virtual void setSpecgram(const stand::gui::SpecgramView::Setting &setting);
52+
53+protected:
54+ void paint(QPaintEvent *e);
55+ void createImage(const stand::gui::SpecgramView::Setting &setting);
56+ QImage _image;
57+
58+ Setting _setting;
59+ double _maximumValue;
60+};
61+
62+}
63+}
64+
65+
66+#endif // SPECGRAMVIEW_H
--- vConnect/trunk/stand2.0/StandConverter/gui/editor/StandEditor.cpp (nonexistent)
+++ vConnect/trunk/stand2.0/StandConverter/gui/editor/StandEditor.cpp (revision 1987)
@@ -0,0 +1,16 @@
1+#include "StandEditor.h"
2+#include "ui_StandEditor.h"
3+
4+using namespace stand::gui::editor;
5+
6+StandEditor::StandEditor(QWidget *parent) :
7+ QMainWindow(parent),
8+ ui(new Ui::StandEditor)
9+{
10+ ui->setupUi(this);
11+}
12+
13+StandEditor::~StandEditor()
14+{
15+ delete ui;
16+}
--- vConnect/trunk/stand2.0/StandConverter/gui/editor/SpecgramPianoroll.cpp (nonexistent)
+++ vConnect/trunk/stand2.0/StandConverter/gui/editor/SpecgramPianoroll.cpp (revision 1987)
@@ -0,0 +1,139 @@
1+#include "SpecgramPianoroll.h"
2+
3+#include "../VerticalPianoView.h"
4+#include "../../math/SpecgramSet.h"
5+#include "../../utility/F0Contour.h"
6+
7+#include <QPainter>
8+#include <QPaintEvent>
9+
10+#include <math.h>
11+
12+using namespace stand::gui::editor;
13+
14+QColor SpecgramPianoroll::Colors[] =
15+{
16+ Qt::red,
17+ Qt::green,
18+ Qt::blue,
19+ Qt::yellow,
20+ Qt::cyan,
21+ Qt::magenta,
22+ Qt::white
23+};
24+
25+SpecgramPianoroll::SpecgramPianoroll(const Setting &setting, int width, int noteHeight, QWidget *parent)
26+ : SpecgramView(setting, parent)
27+{
28+ _noteHeight = noteHeight;
29+ setSpecgram(_setting);
30+ QWidget *w = new stand::gui::VerticalPianoView(this);
31+ w->setMinimumSize(64, minimumHeight());
32+ w->setMaximumSize(64, minimumHeight());
33+}
34+
35+SpecgramPianoroll::~SpecgramPianoroll()
36+{
37+ for(int i = 0; i < _pitches.size(); i++)
38+ {
39+ if(_pitches[i].autodelete)
40+ {
41+ delete _pitches[i].p;
42+ }
43+ }
44+}
45+
46+void SpecgramPianoroll::paintEvent(QPaintEvent *e)
47+{
48+ paint(e);
49+
50+ QPainter painter(this);
51+
52+ // Draw vertical lines.
53+ int begin = e->rect().top() / _noteHeight - 1;
54+ int end = (e->rect().top() + e->rect().height()) / _noteHeight + 1;
55+ painter.setPen(Qt::gray);
56+ for(int i = begin; i < end; i++)
57+ {
58+ int y = i * _noteHeight;
59+ painter.drawLine(e->rect().left(), y, e->rect().left() + e->rect().width() + 1, y);
60+ }
61+ painter.setPen(Qt::red);
62+
63+ // Draw pitch contours;
64+ _paintPitch(&painter, e);
65+}
66+
67+void SpecgramPianoroll::_paintPitch(QPainter *painter, QPaintEvent *e)
68+{
69+ for(int i = 0; i < _pitches.size(); i++)
70+ {
71+ painter->setPen(Colors[i % (sizeof(Colors) / sizeof(QColor))]);
72+ int prev = positionByFrequency(
73+ _pitches[i].p->at(
74+ e->rect().left() / (double)width() * _setting.specgram->tLen() * _setting.specgram->framePeriod()
75+ )
76+ );
77+ for(int x = e->rect().left() + 1, j = 0; j < e->rect().width(); x++, j++)
78+ {
79+ stand::utility::F0Contour *p = _pitches[i].p;
80+ double ms = (double)x / (double)width() * (double)_setting.specgram->tLen() * _setting.specgram->framePeriod();
81+ int current = positionByFrequency(p->at(ms));
82+ if(current < height() && prev < height())
83+ {
84+ painter->drawLine(x - 1, prev, x, current);
85+ }
86+ prev = current;
87+ }
88+ }
89+}
90+
91+void SpecgramPianoroll::setSpecgram(const stand::gui::SpecgramView::Setting &setting)
92+{
93+ createImage(setting);
94+ _setting.frequencyCeil = stand::A4Frequency * pow(2, (128 - stand::A4NoteNumber + 0.5) / 12.0);
95+ _setting.frequencyFloor = stand::A4Frequency * pow(2, (0 - stand::A4NoteNumber + 0.5) / 12.0);
96+ _setting.scaleType = SpecgramView::Log;
97+ setMinimumSize(_image.width(), _noteHeight * 128);
98+}
99+
100+void SpecgramPianoroll::addF0Contour(stand::utility::F0Contour *f0, bool autodelete)
101+{
102+ if(!f0)
103+ {
104+ return;
105+ }
106+ if(indexOf(f0) != -1)
107+ {
108+ qWarning("SpecgramPianoroll::addF0Contour(); // F0 duplication.");
109+ return;
110+ }
111+ PitchItem p = {f0, autodelete};
112+ _pitches.push_back(p);
113+}
114+
115+void SpecgramPianoroll::removeF0Contour(stand::utility::F0Contour *f0)
116+{
117+ int index = indexOf(f0);
118+ if(index != -1)
119+ {
120+ if(_pitches[index].autodelete)
121+ {
122+ delete _pitches[index].p;
123+ }
124+ _pitches.remove(index);
125+ }
126+}
127+
128+int SpecgramPianoroll::indexOf(stand::utility::F0Contour *f0)
129+{
130+ int retval = -1;
131+ for(int i = 0; i < _pitches.size(); i++)
132+ {
133+ if(_pitches[i].p == f0)
134+ {
135+ retval = i;
136+ }
137+ }
138+ return retval;
139+}
--- vConnect/trunk/stand2.0/StandConverter/gui/editor/StandEditor.h (nonexistent)
+++ vConnect/trunk/stand2.0/StandConverter/gui/editor/StandEditor.h (revision 1987)
@@ -0,0 +1,33 @@
1+#ifndef STANDEDITOR_H
2+#define STANDEDITOR_H
3+
4+#include <QMainWindow>
5+
6+namespace Ui {
7+class StandEditor;
8+}
9+
10+namespace stand
11+{
12+namespace gui
13+{
14+namespace editor
15+{
16+
17+class StandEditor : public QMainWindow
18+{
19+ Q_OBJECT
20+
21+public:
22+ explicit StandEditor(QWidget *parent = 0);
23+ ~StandEditor();
24+
25+private:
26+ Ui::StandEditor *ui;
27+};
28+
29+}
30+}
31+}
32+
33+#endif // STANDEDITOR_H
--- vConnect/trunk/stand2.0/StandConverter/gui/editor/SpecgramPianoroll.h (nonexistent)
+++ vConnect/trunk/stand2.0/StandConverter/gui/editor/SpecgramPianoroll.h (revision 1987)
@@ -0,0 +1,54 @@
1+#ifndef SPECGRAMPIANOROLL_H
2+#define SPECGRAMPIANOROLL_H
3+
4+#include "../SpecgramView.h"
5+
6+#include <QVector>
7+
8+namespace stand
9+{
10+namespace utility
11+{
12+class F0Contour;
13+}
14+namespace gui
15+{
16+namespace editor
17+{
18+
19+class SpecgramPianoroll : public SpecgramView
20+{
21+ Q_OBJECT
22+public:
23+ explicit SpecgramPianoroll(const Setting &setting, int width, int noteHeight, QWidget *parent = 0);
24+ ~SpecgramPianoroll();
25+
26+ void paintEvent(QPaintEvent *e);
27+
28+ void addF0Contour(stand::utility::F0Contour *f0, bool autodelete = false);
29+ void removeF0Contour(stand::utility::F0Contour *f0);
30+ int indexOf(stand::utility::F0Contour *f0);
31+ stand::utility::F0Contour *f0At(int index);
32+
33+public slots:
34+ void setSpecgram(const stand::gui::SpecgramView::Setting &setting);
35+
36+private:
37+ void _paintPitch(QPainter *painter, QPaintEvent *e);
38+ int _noteHeight;
39+ static QColor Colors[];
40+
41+ struct PitchItem
42+ {
43+ stand::utility::F0Contour *p;
44+ bool autodelete;
45+ };
46+
47+ QVector<PitchItem> _pitches;
48+};
49+
50+}
51+}
52+}
53+
54+#endif // SPECGRAMPIANOROLL_H
--- vConnect/trunk/stand2.0/StandConverter/gui/WorldWindow.cpp (revision 1986)
+++ vConnect/trunk/stand2.0/StandConverter/gui/WorldWindow.cpp (revision 1987)
@@ -8,6 +8,9 @@
88 #include "../io/audio/AudioMixer.h"
99 #include "../io/audio/RawWaveTrack.h"
1010
11+#include "editor/SpecgramPianoroll.h"
12+#include "../utility/F0Contour.h"
13+
1114 #include <QFileInfo>
1215 #include <QMessageBox>
1316 #include <QFileDialog>
@@ -23,12 +26,13 @@
2326 _w = NULL;
2427 _wave = NULL;
2528
26- ui->ViewerArea->setWidget(new QLabel(""));
29+ SpecgramView::Setting s = {NULL, 0, 0, SpecgramView::Linear};
30+ ui->ViewerArea->setWidget(new editor::SpecgramPianoroll(s, 1920, 14, this));
2731
2832 _f.setByteOrder(QAudioFormat::LittleEndian);
2933 _f.setChannels(2);
3034 _f.setCodec("audio/pcm");
31- _f.setSampleRate(44100);
35+ _f.setSampleRate(44100 /4);
3236 _f.setSampleSize(16);
3337 _f.setSampleType(QAudioFormat::SignedInt);
3438
@@ -71,10 +75,12 @@
7175 _s->compute(_wave->data(), _wave->length());
7276 _lpc->compute(_wave->data(), _wave->length());
7377 _w->compute(_wave->data(), _wave->length());
74- _imagePowerSpec.set(_s->specgram(), _s->tLen(), _s->fftl() / 2 + 1, _s->samplingFrequency() / 2);
75- _imageLPCSpec.set(_lpc->specgram(), _lpc->tLen(), _lpc->fftl() / 2 + 1, _lpc->samplingFrequency() / 2);
76- _imageStarSpec.set(_w->specgram(), _w->tLen(), _w->fftl() / 2 + 1, _w->samplingFrequency() / 2);
7778 changeSpectrumType(true);
79+ editor::SpecgramPianoroll *w = dynamic_cast<editor::SpecgramPianoroll *>(ui->ViewerArea->widget());
80+ if(w)
81+ {
82+ w->addF0Contour(new stand::utility::F0Contour(_w->f0(), _w->tLen(), _w->framePeriod()), true);
83+ }
7884 }
7985 }
8086
@@ -84,23 +90,24 @@
8490 {
8591 return;
8692 }
87- QImage image;
93+ stand::math::SpecgramSet *s = NULL;
94+ SpecgramView *w = dynamic_cast<SpecgramView *>(ui->ViewerArea->widget());
8895 if(ui->TypeFFT->isChecked())
8996 {
90- image = _imagePowerSpec.image();
97+ s = _s;
9198 }
9299 else if(ui->TypeLPC->isChecked())
93100 {
94- image = _imageLPCSpec.image();
101+ s = _lpc;
95102 }
96103 else if(ui->TypeStar->isChecked())
97104 {
98- image = _imageStarSpec.image();
105+ s = _w;
99106 }
100- QLabel *l = dynamic_cast<QLabel *>(ui->ViewerArea->widget());
101- if(l)
107+ if(w)
102108 {
103- l->setPixmap(QPixmap::fromImage(image));
109+ w->setSpecgram(s, 100, 22050, SpecgramView::Log);
110+ w->update();
104111 }
105112 }
106113
--- vConnect/trunk/stand2.0/StandConverter/gui/VerticalPianoView.cpp (revision 1986)
+++ vConnect/trunk/stand2.0/StandConverter/gui/VerticalPianoView.cpp (revision 1987)
@@ -19,7 +19,7 @@
1919 {
2020 QPainter p(this);
2121 int begin = (double)(e->rect().y() - 1) / height() * 128;
22- int end = (double)(e->rect().y() + e->rect().height() + 1) / height() * 128;
22+ int end = (double)(e->rect().y() + e->rect().height() + 1) / height() * 128 + 1;
2323 p.fillRect(e->rect(), Qt::white);
2424 for(int i = begin; i < end; i++)
2525 {
--- vConnect/trunk/stand2.0/StandConverter/gui/SpecgramView.cpp (nonexistent)
+++ vConnect/trunk/stand2.0/StandConverter/gui/SpecgramView.cpp (revision 1987)
@@ -0,0 +1,176 @@
1+#include "SpecgramView.h"
2+
3+#include <QPainter>
4+#include <QPaintEvent>
5+
6+#include <float.h>
7+#include <math.h>
8+
9+#include "../math/SpecgramSet.h"
10+#include "../io/SpecgramImage.h"
11+
12+using namespace stand::gui;
13+
14+SpecgramView::SpecgramView(const SpecgramView::Setting &setting, QWidget *parent) :
15+ QWidget(parent)
16+{
17+ setSpecgram(setting);
18+}
19+
20+SpecgramView::SpecgramView(stand::math::SpecgramSet *specgram, double frequencyFloor, double frequencyCeil, ScaleType type, QWidget *parent) :
21+ QWidget(parent)
22+{
23+ setSpecgram(specgram, frequencyFloor, frequencyCeil, type);
24+}
25+
26+SpecgramView::SpecgramView(QWidget *parent) :
27+ QWidget(parent)
28+{
29+}
30+
31+SpecgramView::~SpecgramView()
32+{
33+}
34+
35+void SpecgramView::setSpecgram(const SpecgramView::Setting &setting)
36+{
37+ createImage(setting);
38+ setMinimumSize(_image.width(), _image.height());
39+ update();
40+}
41+
42+void SpecgramView::createImage(const SpecgramView::Setting &setting)
43+{
44+ _setting = setting;
45+ if(_setting.specgram)
46+ {
47+ // get the maximum value of specgram.
48+ _maximumValue = -DBL_MAX;
49+ for(int t = 0; t < _setting.specgram->tLen(); t++)
50+ {
51+ double *spectrum = _setting.specgram->spectrumAt(t);
52+ for(int i = 0; i < _setting.specgram->fftl(); i++)
53+ {
54+ if(_maximumValue < spectrum[i])
55+ {
56+ _maximumValue = spectrum[i];
57+ }
58+ }
59+ }
60+ if(_setting.frequencyFloor <= 0)
61+ {
62+ _setting.frequencyFloor = 0.0;
63+ }
64+ if(_setting.frequencyCeil > _setting.specgram->samplingFrequency() / 2)
65+ {
66+ _setting.frequencyCeil = _setting.specgram->samplingFrequency() / 2;
67+ }
68+ if(_setting.frequencyFloor >= _setting.frequencyCeil)
69+ {
70+ _setting.frequencyFloor = _setting.frequencyCeil / 2;
71+ }
72+ _image = stand::io::SpecgramImage::imageFromSpecgram(_setting.specgram->specgram(), _setting.specgram->tLen(), _setting.specgram->fftl() / 2);
73+ }
74+}
75+
76+void SpecgramView::setSpecgram(stand::math::SpecgramSet *specgram, double frequencyFloor, double frequencyCeil, ScaleType type)
77+{
78+ Setting s = {specgram, frequencyCeil, frequencyFloor, type};
79+ setSpecgram(s);
80+}
81+
82+void SpecgramView::paintEvent(QPaintEvent *e)
83+{
84+ paint(e);
85+}
86+
87+void SpecgramView::paint(QPaintEvent *e)
88+{
89+ if(_setting.specgram == NULL)
90+ {
91+ qDebug("SpecgramView::paint(); // Specgram is not set.");
92+ return;
93+ }
94+ if(_setting.scaleType == Unknown)
95+ {
96+ qWarning("SpecgramView::paint(); // Unknown paint type");
97+ }
98+
99+ QPainter painter(this);
100+ int x = e->rect().left() / (double)width() * _image.width();
101+ int w = e->rect().width() / (double)width() * _image.width() + 1;
102+ QImage im;
103+ int prevFr = -1;
104+ for(int j = 0, y = e->rect().top(); j < e->rect().height(); j++, y++)
105+ {
106+ double frequency;
107+ switch(_setting.scaleType)
108+ {
109+ case Linear:
110+ frequency = _setting.frequencyCeil - (_setting.frequencyCeil - _setting.frequencyFloor) * (double)y / height();
111+ break;
112+ case Log:
113+ frequency = frequencyByPosition(y);
114+ break;
115+ }
116+
117+ int fr = frequency / _setting.specgram->samplingFrequency() * _setting.specgram->fftl();
118+ if(fr <= 1)
119+ {
120+ fr = 1;
121+ }
122+ else if(fr > _image.height())
123+ {
124+ fr = _image.height();
125+ }
126+
127+ if(fr != prevFr)
128+ {
129+ im = _image.copy(x, _image.height() - fr, w, 1);
130+ }
131+ painter.drawImage(QRect(e->rect().left(), y, e->rect().width(), 1), im);
132+ prevFr = fr;
133+ }
134+}
135+
136+double SpecgramView::frequencyByPosition(int y)
137+{
138+ double frequency;
139+ switch(_setting.scaleType)
140+ {
141+ case Linear:
142+ frequency = _setting.frequencyCeil - (_setting.frequencyCeil - _setting.frequencyFloor) * (double)y / height();
143+ break;
144+ case Log:
145+ frequency = log(_setting.frequencyCeil) - (log(_setting.frequencyCeil) -log(_setting.frequencyFloor)) * (double)y / height();
146+ frequency = exp(frequency);
147+ break;
148+ }
149+
150+ return frequency;
151+}
152+
153+int SpecgramView::positionByFrequency(double freq)
154+{
155+ if(freq < _setting.frequencyFloor)
156+ {
157+ return height();
158+ }
159+ if(freq > _setting.frequencyCeil)
160+ {
161+ return -1;
162+ }
163+ double dPos;
164+ switch(_setting.scaleType)
165+ {
166+ case Linear:
167+ dPos = (_setting.frequencyCeil - freq) / (_setting.frequencyCeil - _setting.frequencyFloor);
168+ break;
169+ case Log:
170+ dPos = (log(_setting.frequencyCeil) - log(freq)) / (log(_setting.frequencyCeil) - log(_setting.frequencyFloor));
171+ break;
172+ }
173+ int position = height() * dPos;
174+ return position;
175+}
176+
--- vConnect/trunk/stand2.0/StandConverter/io/audio/AudioMixer.cpp (revision 1986)
+++ vConnect/trunk/stand2.0/StandConverter/io/audio/AudioMixer.cpp (revision 1987)
@@ -76,6 +76,14 @@
7676
7777 void AudioMixer::addTrack(AudioTrack *t, int volume, int pan)
7878 {
79+ for(int i = 0; i < _tracks.size(); i++)
80+ {
81+ if(t == _tracks[i].t)
82+ {
83+ qWarning("AudioMixer::addTrack(); // Track duplication.");
84+ return;
85+ }
86+ }
7987 t->setFormat(_format);
8088 Track track = {t, volume, pan};
8189 _tracks.push_back(track);
--- vConnect/trunk/stand2.0/StandConverter/configure.h (nonexistent)
+++ vConnect/trunk/stand2.0/StandConverter/configure.h (revision 1987)
@@ -0,0 +1,18 @@
1+#ifndef CONFIGURE_H
2+#define CONFIGURE_H
3+
4+/*
5+ * use FFTW or SPTK FFT ?
6+ * If you want to use FFTW, define USE_FFTW.
7+ * otherwise, undef USE_FFTW.
8+ */
9+#define USE_FFTW
10+
11+namespace stand
12+{
13+const double A4Frequency = 440.0;
14+const int A4NoteNumber = 69;
15+const double DefaultFramePeriod = 2.0;
16+}
17+
18+#endif // CONFIGURE_H
--- vConnect/trunk/stand2.0/StandConverter/math/FFTSet.h (revision 1986)
+++ vConnect/trunk/stand2.0/StandConverter/math/FFTSet.h (revision 1987)
@@ -16,7 +16,7 @@
1616 #define FFTSET_H
1717
1818 #include <QMutex>
19-#include "../stand.h"
19+#include "../configure.h"
2020
2121 #ifdef USE_FFTW
2222 #include <fftw3.h>
--- vConnect/trunk/stand2.0/StandConverter/math/SpecgramSet.cpp (revision 1986)
+++ vConnect/trunk/stand2.0/StandConverter/math/SpecgramSet.cpp (revision 1987)
@@ -118,8 +118,8 @@
118118 // 窓掛ける
119119 for(int j = 0; j < _fftl; j++)
120120 {
121- double theta = stand::math::PI * (double)j / (double)_fftl;
122- in[j] *= sin(theta);
121+ double x = (double)j / _fftl;
122+ in[j] *= 0.54 - 0.46 * cos(2 * stand::math::PI * x);
123123 }
124124 // FFT する
125125 forward.execute();
旧リポジトリブラウザで表示