Project 2 – 18-090 https://courses.ideate.cmu.edu/18-090/f2017 Twisted Signals Thu, 07 Dec 2017 05:03:31 +0000 en-US hourly 1 https://wordpress.org/?v=4.8.24 https://i1.wp.com/courses.ideate.cmu.edu/18-090/f2017/wp-content/uploads/2016/08/cropped-Screen-Shot-2016-03-29-at-3.48.29-PM-1.png?fit=32%2C32&ssl=1 Project 2 – 18-090 https://courses.ideate.cmu.edu/18-090/f2017 32 32 115419400 Project 2 – Kevin Darr https://courses.ideate.cmu.edu/18-090/f2017/2017/12/03/project-2-kevin-darr/ Mon, 04 Dec 2017 04:53:25 +0000 https://courses.ideate.cmu.edu/18-090/f2017/?p=1508 For this project, I used spectral analysis along with machine learning to create a system for chord recognition. The system works by writing FFT frequency bin amplitudes into a matrix, then taking “snapshots” of the matrix and outputting the snapshot as a list, then sending these lists to the ml.svm object for categorization. While the system could easily work with any audio source, for this demonstration I made a simple polyphonic synth using sawtooth oscillators and a MIDI controller to play chords for the system to analyze. The challenge with this project was devising a system for processing the data from the FFT matrix and molding it into a form that is usable by the SVM but still contains enough data to identify specific chord spectra. The algorithm is powerful enough to recognize, for example, the difference between a C major chord and a C minor chord, if given enough training data.

In this demonstration I show how to train the SVM and how to map new chords. At the end I show that the system is not aware that a chord played an octave higher is not recognized. This can be fixed easily by simply mapping one chord played in several octaves (for example play C major chords with roots C3, C4, and C5 as state 1, D3 D4 D5 state 2, etc.)

main patch

<pre><code> ———-begin_max5_patcher———- 4889.3oc6cs0iiiak94p+UHXrOjfTsg3McIOMK17ZP.RxKKlJnfrMKWZZYIG I45xDj929RxCkrjsjLkLkqZmzC5wk0UdNe7bijmC8+5K2sXU1a7hEN+Qme14 t69We4t6TmRdh6zGe2hcQusNIpPcaKVmsaGOsbw8v0J4uUpN+NdYdlSY11sI 7GRqtbQ46Ib00qNS5gcwoI7R0aCoO49nx0OGmt8wb95RfZ78CV5duiWn7SDy U9Gr3Sm+Q0yjyKDDRTYbVZy2U7FU6ks5W9pePiVM6PYUy51wqn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tBkGsN4uZcDwS Il36hUyKqWyAUzdEzmWtoc9XLH23AJV58U11GgCfinmej9Gms.DoiifDGOf. aeWd3tPA2qCELADrfrCKzfFhEXiVxDUbFwFsjIZdDOa0RHSZIz01RraF5Yh9 Gx0FsDxjVxFMjqAMjG0BsDMzTSwV2toQMMF2cSecFqnlnZehi2SLY64oVsB8 LL3gfU2u0QHc8vB+7xgZ8Cqtsvv.S69PVGC8uUJ3zaloDpQAlXC2XTrAsjM7 hQQFXwm4MKZYlzzsyqcqoWXhCUKftDiFF.saVDeCZ5YAcMpoQj4PlhXRblDa 3ruJJngwWeazRFMBOaXLffM0uGxngpfzCtBlVoVGU47C12fmEmeFwMdzYQLz j.zv1HTPxH780cOVPidLpOTGwAvri29HXG6vCFjn5nqj1w9lhR8JtgBNNIlX XcbPdr1m5ZoRua0DrfYWcmIx0Ec5BGV2a5Ou8llntgrwfRvFMNKqziXh2DaD uGxjA6PrgMdjIhyLa.dHirMMGAfXbKa8Q8fLwvuMzALI1YeK0NWTt7bFBl+7 S1.4jswIabbmrowc9FFW+aVbmtQwopIgSJhGfWqqgfcuCqXhhaNoncz.Pqh0 wjxJ4BUISWUHSUUQzakwLsphoUEwXbgB0phXP5Dm43GGuuNK+k9K8kdJ6k5J GYjksh945obUZWpJMkyq66g0b8+kKKAgpkxraQftJ5JLCoJTK+.TfpdgbYgv ND+IRBM1B+vxax0MvRLf5QPFK6JHQAEBDqHp.BHAI9FNTU7Y9GqJiy4Wg3NU WCTUh8z1EHVe8ecIAYE1+UoU.mcYoYxj4hOBbvvBta5Ea20TnceRMeXTA0Mw hoy1VRlPgycys9bVop8CI2eH494SxU7L+6u7+AT4vgfD ———–end_max5_patcher———– </code></pre>

poly-saw

<pre><code> ———-begin_max5_patcher———- 623.3ocuVE1iiBBD8y1eEF93EOOPwV89qb4RCUY2k8TvnX21rY6u8CGz1au0 Zqo11Dkxvfu48XXf2W3f1n1wqQt+z8WtNNuuvwAL0ZvoquCpfsKMmUCtgj72 TadE4YGRy2oAy5WD0kp78G5GoVuOmCC0aQ0ny4Z89RtEOjPpQd1F2e24jroP HMtAfQ5LVxzouHjOuthmpsSllP7CM+HgdtgAQ9XO2n312AA93ieMQFDAl.96 j.zIHrgBfQPqwOVrn8k2soArr5pCtDLFdv9qbCvSPNpEOKY4sJxo+AOCKNQi HNXqTPgFR.cTggLrvPmOg4GlXXk+DjhmxUrykTDbQdSRV01PIiQ63gYMY9X8 2NXxAl95+jYMIJokngwAPyxwXM8ty5Bs5oIP5ouyuitcKxgilaGd2oairjk9 GWy18GTgud5GBzOYzb76eIOgzk7PVsw.QCwiVI6Lq18wGaKOaswQyGeMSqqD aZz1C+bNxZGT6HqSUEEbokiHX.PulIUyDbGFS2ln3Pi.YgN5VgkCKN34iU0r 2N73J2EjXK2kLFoit79eXZnbg7+uFD.cq8OqD0plpzdNzcPh6Ivy30ZgjoEJ 4+3S6YrsNMnXes.EcE.QmAbnWANKmAbBuBbhlAbLUAcIW.m3YBmKwmvY.m9j oKlHbhzEhrRk43ltTbJYkeT6UErWWJN5XuiyPUkwqN+YkyZrR9rxMbvFj.k2 hvX+3t68Cl9ZDiu8HN3Ji3aCoqPZ9JN15Urxxs7p5NmAHL0neUABvJOnqPZ6 FBcq3aE89SAKrJSoUsotZSksT8tk1qGhJTFoT1H5V+MH+wh+BTMjzLF ———–end_max5_patcher———– </code></pre>

writetomatrix3

<pre><code> ———-begin_max5_patcher———- 1098.3oc2XkriiaCD8r8WgfNNvwgE2UNNyg4z7ADDDLfsLsi5HKZHI2KYv3u 8vEIaK2dQtsbCj3CRTjrXUuGqM3eLdT7ClWzUwQ+VzeDMZzOFOZjeJ2DiZ9d T7R0Ko4pJ+1hKzOad3w3Igkp0uT6md975rh4lMsKTU+Zt1uxL8b05751ELqq y000utRGzZbVgcsi8J5OaDoX8xrBqPdC.ZlbkpN8uxJV78RcZc3nv.dJZRD. tmhD2SrclsmS1LuAYM+egPi2c3ASxe5T2j+b7X2iI2Fi7oMQ32xFmjFp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nDvWLPhPXHj21l01c49ej5SWnf9apTADABBw9BNIfcPZY+6akpNn0pO oOUIVJgFvx.B4ir9jUleN9eQEnrJf ———–end_max5_patcher———– </code></pre>

.data and .model example files.

 

chordsCmajor.data

chordsCmajor.model

]]>
1508