question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Consuming a lot of ram

See original GitHub issue

Hi,

Is there another way to load an instrument than :

MIDI.loadResource({
        instrument: instrumentid,
        onprogress: function (state, percent) {
            console.log(state, percent);
        },
        onsuccess: function () {
            console.log("onSuccess : " + instrumentid);
            MIDI.programChange(channel, instrumentid);
        }
    });

Because each time I load an instrument the google tab has an increase of 100Mb of ram. If there is no other way to load them can we unload instruments ?

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:5

github_iconTop GitHub Comments

3reactions
hmoffattcommented, Apr 23, 2019

I modified the converter (soundfont_builder.rb) to run sox before encoding in order to strip off the silence. The extra line is

run_command "#{SOX} #{target}.orig.wav #{target} reverse silence 1 0.1 0 pad 0.0001@0 reverse channels 1"

I haven’t published my whole modified script anywhere as it has other unrelated changes but you get the idea from the above.

2reactions
hmoffattcommented, Feb 3, 2019

On load it decompresses all the samples back to raw PCM audio. The sound fonts (if generated with the included soundfont builder script) have 3 seconds of stereo audio for 80+ notes… that is where your 100Mb+ per instrument comes from.

I reduced it in my application by trimming silence in the sound fonts so that they are not all 3 seconds. That will help for any instrument sound that decays, like a piano, or drums. It helps for drums especially because some of the notes do not even have a sound - with the original script you have 3 seconds of silence loaded!

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Figure Out What Is Taking Up So Much RAM
Click "Check Performance Issues" located under System and Security to identify problematic processes that may be taking up a lot of RAM.
Read more >
Fix High RAM Memory Usage Issue on Windows 11/10 [10 ...
Disabling programs running from Startup will effectively decrease the system load and saving quite a lot of CPU memory space. Step 1. Press...
Read more >
How to Fix High Memory Usage in Windows - Make Tech Easier
All computer memory is connected to the CPU and RAM. ... Likewise, previous Windows installations can consume a lot of extra memory, ...
Read more >
What uses a lot of RAM? - Quora
RAM is used to store information that needs to be used quickly. This means that opening many programs, running various processes or accessing...
Read more >
Why Is Google Chrome Using So Much RAM? Here's How to ...
But Chrome still uses a lot of RAM. At least, in many cases, it appears to be using more RAM than other browsers....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found