comparison src/EM.cpp @ 338:8a2166088b94 livemode

Initialise pitch and shift vectors to 1.0 instead of randomly -- seems to produce at least no worse results, and has the advantage of producing deterministic output
author Chris Cannam
date Mon, 29 Jun 2015 16:22:32 +0100
parents f98ba4f47e49
children 63609ec70811
comparison
equal deleted inserted replaced
336:d25e4aee73d7 338:8a2166088b94
42 m_shiftSparsity(1.1), 42 m_shiftSparsity(1.1),
43 m_sourceSparsity(1.2) 43 m_sourceSparsity(1.2)
44 { 44 {
45 m_pitches = allocate<float>(m_noteCount); 45 m_pitches = allocate<float>(m_noteCount);
46 m_updatePitches = allocate<float>(m_noteCount); 46 m_updatePitches = allocate<float>(m_noteCount);
47 for (int n = 0; n < m_noteCount; ++n) { 47 v_set(m_pitches, 1.f, m_noteCount);
48 m_pitches[n] = float(rand()) / RAND_MAX;
49 }
50 48
51 if (useShifts) { 49 if (useShifts) {
52 m_shifts = allocate_channels<float>(m_shiftCount, m_noteCount); 50 m_shifts = allocate_channels<float>(m_shiftCount, m_noteCount);
53 m_updateShifts = allocate_channels<float>(m_shiftCount, m_noteCount); 51 m_updateShifts = allocate_channels<float>(m_shiftCount, m_noteCount);
54 for (int f = 0; f < m_shiftCount; ++f) { 52 for (int f = 0; f < m_shiftCount; ++f) {
55 for (int n = 0; n < m_noteCount; ++n) { 53 v_set(m_shifts[f], 1.f, m_noteCount);
56 m_shifts[f][n] = float(rand()) / RAND_MAX;
57 }
58 } 54 }
59 } else { 55 } else {
60 m_shifts = 0; 56 m_shifts = 0;
61 m_updateShifts = 0; 57 m_updateShifts = 0;
62 } 58 }
63 59
64 m_sources = allocate_channels<float>(m_sourceCount, m_noteCount); 60 m_sources = allocate_channels<float>(m_sourceCount, m_noteCount);
65 m_updateSources = allocate_channels<float>(m_sourceCount, m_noteCount); 61 m_updateSources = allocate_channels<float>(m_sourceCount, m_noteCount);
66 for (int i = 0; i < m_sourceCount; ++i) { 62 for (int i = 0; i < m_sourceCount; ++i) {
67 for (int n = 0; n < m_noteCount; ++n) { 63 for (int n = 0; n < m_noteCount; ++n) {
68 m_sources[i][n] = (inRange(i, n) ? 1.0 : 0.0); 64 m_sources[i][n] = (inRange(i, n) ? 1.f : 0.f);
69 } 65 }
70 } 66 }
71 67
72 m_estimate = allocate<float>(m_binCount); 68 m_estimate = allocate<float>(m_binCount);
73 m_q = allocate<float>(m_binCount); 69 m_q = allocate<float>(m_binCount);