Mercurial > hg > silvet
comparison src/EM.cpp @ 174:237d41a0f69d
Introduce shift sparsity
author | Chris Cannam |
---|---|
date | Wed, 21 May 2014 14:41:53 +0100 |
parents | 629c9525b815 |
children | d53d95bee46c |
comparison
equal
deleted
inserted
replaced
173:26d054291412 | 174:237d41a0f69d |
---|---|
37 m_noteCount(pack->templateNoteCount), | 37 m_noteCount(pack->templateNoteCount), |
38 m_shiftCount(useShifts ? pack->templateMaxShift * 2 + 1 : 1), | 38 m_shiftCount(useShifts ? pack->templateMaxShift * 2 + 1 : 1), |
39 m_binCount(pack->templateHeight), | 39 m_binCount(pack->templateHeight), |
40 m_sourceCount(pack->templates.size()), | 40 m_sourceCount(pack->templates.size()), |
41 m_pitchSparsity(1.1), | 41 m_pitchSparsity(1.1), |
42 //!!! note: slightly less source sparsity might help; also | 42 m_shiftSparsity(1.1), |
43 //!!! consider a modest shift sparsity e.g. 1.1 | 43 m_sourceSparsity(1.2), |
44 m_sourceSparsity(1.3), | |
45 m_lowestPitch(pack->lowestNote), | 44 m_lowestPitch(pack->lowestNote), |
46 m_highestPitch(pack->highestNote) | 45 m_highestPitch(pack->highestNote) |
47 { | 46 { |
48 m_pitches = allocate<float>(m_noteCount); | 47 m_pitches = allocate<float>(m_noteCount); |
49 m_updatePitches = allocate<float>(m_noteCount); | 48 m_updatePitches = allocate<float>(m_noteCount); |
253 } | 252 } |
254 | 253 |
255 if (m_pitchSparsity != 1.0) { | 254 if (m_pitchSparsity != 1.0) { |
256 for (int n = 0; n < m_noteCount; ++n) { | 255 for (int n = 0; n < m_noteCount; ++n) { |
257 m_updatePitches[n] = | 256 m_updatePitches[n] = |
258 pow(m_updatePitches[n], m_pitchSparsity); | 257 powf(m_updatePitches[n], m_pitchSparsity); |
258 } | |
259 } | |
260 | |
261 if (m_shifts && m_shiftSparsity != 1.0) { | |
262 for (int i = 0; i < m_shiftCount; ++i) { | |
263 for (int n = 0; n < m_noteCount; ++n) { | |
264 m_updateShifts[i][n] = | |
265 powf(m_updateShifts[i][n], m_shiftSparsity); | |
266 } | |
259 } | 267 } |
260 } | 268 } |
261 | 269 |
262 if (m_sourceSparsity != 1.0) { | 270 if (m_sourceSparsity != 1.0) { |
263 for (int i = 0; i < m_sourceCount; ++i) { | 271 for (int i = 0; i < m_sourceCount; ++i) { |
264 for (int n = 0; n < m_noteCount; ++n) { | 272 for (int n = 0; n < m_noteCount; ++n) { |
265 m_updateSources[i][n] = | 273 m_updateSources[i][n] = |
266 pow(m_updateSources[i][n], m_sourceSparsity); | 274 powf(m_updateSources[i][n], m_sourceSparsity); |
267 } | 275 } |
268 } | 276 } |
269 } | 277 } |
270 | 278 |
271 normaliseColumn(m_updatePitches, m_noteCount); | 279 normaliseColumn(m_updatePitches, m_noteCount); |