Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

There are currently issues with "npm i qambi" #3

Open
Standfuss opened this issue Oct 18, 2019 · 3 comments
Open

There are currently issues with "npm i qambi" #3

Standfuss opened this issue Oct 18, 2019 · 3 comments

Comments

@Standfuss
Copy link

@abudaan
Hi abudann,

there are currently issues with installing via npm
[me@t470] 05:27 $ npm i qambi npm ERR! code ETARGET npm ERR! notarget No matching version found for filesaverjs@^1.2.1. npm ERR! notarget In most cases you or one of your dependencies are requesting npm ERR! notarget a package version that doesn't exist. npm ERR! notarget npm ERR! notarget It was specified as a dependency of 'qambi' npm ERR! notarget
I also created a pull request. However I do not really know how this Git Hub stuff works and if you actually get notified (I also cannot assign the pull request, maybe due to permissions or me being stupid ;)). Feel free to have a look at your leisure.

Best Regards,

Bernd

@abudaan
Copy link
Owner

abudaan commented Oct 18, 2019

@Standfuss
Hi Bernd!
Thanks for your PR and you are right: the code needs an update very badly :) This will take a while; would it be possible for you to use heartbeat instead of qambi? It has the same functionality (and even more) as qambi and I have recently updated the code to make it installable via npm. See the code examples in the README. Let me know if that works for you!

@Standfuss
Copy link
Author

@abudaan
Hi Abudaan,
thanks for your fast reply. I just came from the pub got some mid day drinkin in so I am a little boozed up....

  • First: NO WORK REQUIRED ON YOUR SIDE. I just felt like making a pull request appreciating your work.

  • Second: If you got a little time can you quickly answer my questions at the end of the post.

Here a few lines form my side if you care to read:

Thanks for your great work. I actually had a look at the heartbeat & and qambi stuff before i started including it (docs, commit history, code). So I basically new what i was getting into considering stability, features, and project activity...

So, I think you got really good taste writing code (concerning both projects). Its all well structured, readable and works (what really made my day, considering other stuff i dealt with the last few weeks fulfilling hardly one of those 3 criteria...).

I chose qambi over heartbeat based on my current project setup. Which is pretty much me wanting to write some decent React frontend. Since everything in there is pretty much "ECMAScript 2018" and does everything though modules using qambi was the "easier" thing for me to do also realizing its in an early beta port of heartbeat not being that actively maintained.

  • To your question could i use heartbeat instead?
    Hmm... maybe

..Yeah i don't really know. I am pretty much new to the whole javascript fontend stack. I mainly did Java backend development the last few years also having some exp in forntend (mainly JSP, JSF Vaadin, did some Adobe Flex, MS Silverlight Java Swing and JavaFX as well)

So basically the last three weeks i am trying to make some sense out of JS, NODE, NPM, Packaging (currently using Parcel instead of Webpack), went to Typescipt since i did not want to bother with linting....

For my current prototyping qambi just seem to be the better solution. I suppose wrapping heartbeat up in some sort of module way would surely be better in a more long term way. But sadly i currently do not really know how to do that proper...

For now i am fine with my git clone linking things in my current sandbox project for prototyping. For later i will see what fits.

Stuff works currently fine for me with those lines:
`import {Song} from "../../../../temp/qambi/src/song"
import {Sampler} from "../../../../temp/qambi/src/sampler"
import {initAudio} from "../../../../temp/qambi/src/init_audio"
import {initMIDI} from "../../../../temp/qambi/src/init_midi"
import {songFromMIDIFile} from "../../../../temp/qambi/src/song_from_midifile"
import {Track} from "../../../../temp/qambi/src/track"
import MidiInput = WebMidi.MIDIInput;

class Qambi {

song?: Song;
dataAudio?: any;
dataMidi?: any;
sampler?: Sampler
midiInputSong?: Song

constructor() {

}

async init() {
    this.dataAudio = await initAudio();
    this.dataAudio.masterGain.gain.value = 1;
    let initMIDIPromise = initMIDI();
    let grand = new Sampler("Grand");
    let parseSampleData = grand.parseSampleData({
        baseUrl: "http://gleitz.github.io/midi-js-soundfonts/FluidR3_GM/acoustic_grand_piano-mp3/",
        url: "/instruments/fluidsynth/acoustic_grand_piano.json"
    });
    this.dataMidi = await initMIDIPromise;
    this.sampler = await parseSampleData;
    this.midiInputSong = new Song({volume:1});
    await this.initMidiInputsDevs();

    return this;
}

async initMidiInputsDevs() {
    for (let inputDev of this.dataMidi.inputs) {
        let midiInput = (inputDev as MidiInput);
        let midiPort = await midiInput.open();
        let track = new Track({volume:1});
        track.setInstrument(this.sampler);
        track.connectMIDIInputs(inputDev);
        track.monitor = true;
        if (this.midiInputSong) {
            this.midiInputSong.addTracks(track);
        }
    }
}

playSong = (file: string) => {
    return this.playInternal(file)
};

async playInternal(file: string) {
    this.song = await songFromMIDIFile(file);
    if (this.song) {
        for (let track of this.song.getTracks()) {
            track.setInstrument(this.sampler)
        }

...`

  • QUESTIONS:

  • Instruments: Any suggestion what to use for decent results?

-- Issues i had: I used the "/FluidR3_GM/acoustic_grand_piano" I think you actually removed the FluidR3 instruments from heartbeat. I got actually some issues with that concerning Note Release till found the JSON was not that proper ... "release": [ 4, "equal power" ]...
here something like 0.4 makes more sense. No issues in code actually in config ;)
Changing to 0.4 solved the note release /noteOff issue

  • Volume: Thing are not loud enough also i set the master gain / song /track to 1. Is that also an issue with the Fluid Synth instrument? Or do i have to fiddle with some other stuff like the compressor?

Any thought on that?

Thank you very much.

Best Regards,

Bernd

@abudaan
Copy link
Owner

abudaan commented Oct 18, 2019

Thanks for your kind words :)

I see what you are doing, I am working on implementing the same async wrappers in heartbeat, see here.

About React: have you seen this prototype I made earlier this year? Here you see an attempt to wrap a heartbeat song in a React component, still work in progress though.

Indeed I do remember that the Fluid samples were a bit faint; you could generate the instruments yourself using higher volumes but that could be quite a daunting task. As you can see here the generator is using -g 0.5 which sets the gain to 0.5. The Fluidsynth manual says that the gain value has to be between 0 and 10 and that the default is 0.2.

If you only need a piano sound you could use one of the heartbeat instruments.

I have been using Parcel for quite some time but I am currently switching back to Webpack.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants