Giter Club home page Giter Club logo

Comments (4)

danigb avatar danigb commented on August 15, 2024 1

Hi!,

The solution is harder than I thought:

const Tonal = require('tonal');

const notes = ['a', 'b', 'e', 'g'];
const intervals = PcSet.intervals(PcSet.chroma(notes)));
const scale = intervals.map(Tonal.transpose('A4'))

One problem is that PcSet.intervals doesn't accept the note array directly (but the documentation says it can). I'll keep the issue open while deciding what to do.

I hope it helps.
Suggestions and PR welcomed.

from tonal.

kubawolanin avatar kubawolanin commented on August 15, 2024

Hey @danigb!

Thank you for the quick response.

Pasting the following code

var tonal = require("tonal")

const notes = ['a', 'b', 'e', 'g'];
const intervals = tonal.PcSet.intervals(tonal.PcSet.chroma(notes));
const scale = intervals.map(tonal.transpose(`${notes[0]}4`)); // same with 'A4'

to RunKit gives me this result:

Array (4 items)
0: "C#5"
1: "E5"
2: "F#5"
3: "G#5"

from tonal.

danigb avatar danigb commented on August 15, 2024

True! It works with ["a", "c", "e", "g"] but not with ['a', 'b', 'e', 'g']. I'll investigate the issue...

from tonal.

danigb avatar danigb commented on August 15, 2024

This works and it's a better alternative:

var tonal = require("tonal")

const notes = ['a', 'b', 'e', 'g'];
const intervals = notes.map(tonal.interval(notes[0]))
intervals.map(tonal.transpose(`${notes[0]}4`))

EDIT: in fact the function (notes) => notes.map(tonal.interval(notes[0]))) used to be in tonal (was called Distance.harmonics). Maybe it's time to reintrorduce it?.

Ideas?

from tonal.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.