Sound Library


I have a plugin that plays sample midi files, but is there a way to have my own library of sounds accessible for the user to change them according to the sound they need?? I only know how to change the sound within the code, which would mean I’d have to create a new plugin everytime I want to play a new sound. Is there anyway to create the library for a user without making a new plugin for each sound?


So how are you doing that at the moment?


Just adding the sound file in the code binary data, and adding the sound file itself to the source files. Hopefully that makes sense lol im super new to coding.


With that approach, you really compile your sound files into your binary - they get part of the binary at compile time. That’s possible but unusual for things like a sampler.
What you probably want to do is loading the sounds from audio files located in a specific folder at runtime. Maybe you want to post some lines of codes that show how you handle playback from your embedded binary data sounds so the community could give you some advice on how to do that with audio files?


void MplugKeyAudioProcessor::initialiseSynth()

const int numVoices = 16;

// Add some voices...
for (int i = numVoices; --i >= 0;)
    synth.addVoice (new SineWaveVoice());
    synth.addVoice(new SamplerVoice());
    synth.addSound(new SineWaveSound());

WavAudioFormat wavFormat;

ScopedPointer<AudioFormatReader> audioReader (wavFormat.createReaderFor (new MemoryInputStream (BinaryData::cello_wav,

BigInteger allNotes;
allNotes.setRange (0, 128, true);

synth.addSound (new SamplerSound ("demo sound",
                                  74,   // root midi note
                                  0.1,  // attack time
                                  0.1,  // release time
                                  10.0  // maximum sample length


hopefully this can help, and thanks guys for responding!!