diff --git a/packages/core/test/util.test.mjs b/packages/core/test/util.test.mjs index aad7a37ce..e2ab36f0c 100644 --- a/packages/core/test/util.test.mjs +++ b/packages/core/test/util.test.mjs @@ -114,6 +114,9 @@ describe('dirtify', () => { assert.deepStrictEqual(dirtify({ n: 7 }), { n: 7 }); assert.deepStrictEqual(dirtify({ n: 7, room: 0.5 }), { n: 7, room: 0.5 }); }); + it('should parse notes inside object', () => { + assert.deepStrictEqual(dirtify({ n: 'c3', s: 'supersaw' }), { n: -12, s: 'supersaw' }); + }); it('should dirtify .value', () => { assert.deepStrictEqual(dirtify({ value: 61 }), { n: 1 }); assert.deepStrictEqual(dirtify({ value: 'c5' }), { n: 12 }); diff --git a/packages/core/util.mjs b/packages/core/util.mjs index 2a77b284f..9ab2d5f22 100644 --- a/packages/core/util.mjs +++ b/packages/core/util.mjs @@ -96,8 +96,9 @@ export function objectify(value) { // turns value into object that is the right format superdirt osc export function dirtify(val) { const obj = objectify(val); + if (obj.n && typeof obj.n === 'string') { - return { ...obj, ...objectify(obj.n) }; + return { ...obj, ...dirtify(obj.n) }; } const { value, ...rest } = obj; if (typeof value === 'undefined') {