Author Topic: BASSMIDI, SFZ and WAV files  (Read 115 times)

aquinch

  • Posts: 13
BASSMIDI, SFZ and WAV files
« on: 7 Mar '19 - 23:00 »
Hi,

I have a SFZ file that references sample WAV files. After I initialize the SFZ file with:
Code: [Select]
BASS_MIDI_FontInit("SFZ/myDrum.sfz", 0);

How do I link the received MIDI message to one of the mapped group/region on the SFZ? Which function is used for that?

And how do I play one of the WAV files mapped by the SFZ? Do I use this function?
Code: [Select]
HSTREAM BASS_MIDI_StreamCreateFile(
    BOOL mem,
    void *file,
    QWORD offset,
    QWORD length,
    DWORD flags,
    DWORD freq
);

Lot's of questions. Sorry.

Ian @ un4seen

  • Administrator
  • Posts: 21593
Re: BASSMIDI, SFZ and WAV files
« Reply #1 on: 8 Mar '19 - 13:39 »
After getting a soundfont handle from BASS_MIDI_FontInit, you need to use it in a BASS_MIDI_StreamSetFonts call to activate it. For example, you could set the default soundfont config like this:

Code: [Select]
font = BASS_MIDI_FontInit("SFZ/myDrum.sfz", 0);
BASS_MIDI_FONT config[1];
config[0].font = font;
config[0].preset = -1; // use all presets
config[0].bank = 0; // use default bank(s)
BASS_MIDI_StreamSetFonts(0, &config, 1); // set default soundfont config

SFZ files are nominally assigned to preset 0 in bank 0. If you want to use yours on a different preset/bank number then you can do this instead:

Code: [Select]
font = BASS_MIDI_FontInit("SFZ/myDrum.sfz", 0);
BASS_MIDI_FONTEX config[1];
config[0].font = font;
config[0].spreset = 0; // soundfont preset 0
config[0].sbank = 0; // soundfont bank 0
config[0].dpreset = preset; // destination preset
config[0].dbank = bank; // destination bank
config[0].dbanklsb = 0; // destination bank LSB 0
BASS_MIDI_StreamSetFonts(0, &config, 1 | BASS_MIDI_FONT_EX); // set default soundfont config

That config will then be used by default on any MIDI streams subsequently created. In your case, it sounds like you want to play custom events rather than a MIDI file? If so, you would use BASS_MIDI_StreamCreate to create your MIDI stream and BASS_MIDI_StreamEvent to send events to it.

If you want to use a single soundfont on its default preset/bank numbers (0/0 in the case of an SFZ file) then another/simpler option is to use the BASS_CONFIG_MIDI_DEFFONT config option via BASS_SetConfigPtr:

Code: [Select]
BASS_SetConfigPtr(BASS_CONFIG_MIDI_DEFFONT, "SFZ/myDrum.sfz");

Please see the documentation for details on the mentioned functions. Note that if your SFZ file contains relative paths to the samples then you should give the SFZ file's full path to BASSMIDI, to make sure it can find the samples.

aquinch

  • Posts: 13
Re: BASSMIDI, SFZ and WAV files
« Reply #2 on: 8 Mar '19 - 23:13 »
Hi mate,

Thanks for the answer.

This is my code now:
Code: [Select]
#include <iostream>
#include <chrono>
#include <sstream>
#include "bass.h"
#include "bassmidi.h"

using namespace std;

HSTREAM stream1;


void CALLBACK MidiInProc(DWORD device, double time, const BYTE *buffer, DWORD length, void *user) {
    std::stringstream ss;
    ss << &buffer;
    cout << "MIDI Received: " << ss.str() << "\n";
}


int main() {

    if (BASS_Init(-1, 44100, 0, 0, NULL)) {
        printf("BASS_Init: %d\n", BASS_ErrorGetCode());
    }

    bool ini = BASS_MIDI_InInit(0, MidiInProc, 0);
    printf("BASS_MIDI_InInit: %d\n", BASS_ErrorGetCode());

    int sfz = BASS_MIDI_FontInit("SFZ/myDrum.sfz", 0);
    printf("BASS_MIDI_FontInit: %d\n", BASS_ErrorGetCode());

    BASS_MIDI_FONT config[1];
    config[0].font = sfz;
    config[0].preset = -1; // use all presets
    config[0].bank = 0; // use default bank(s)

    BASS_MIDI_StreamSetFonts(0, &config, 1); // set default soundfont config
    printf("BASS_MIDI_StreamSetFonts: %d\n", BASS_ErrorGetCode());

    //BASS_SetConfigPtr(BASS_CONFIG_MIDI_DEFFONT, "SFZ/myDrum.sfz");
    //printf("BASS_SetConfigPtr: %d\n", BASS_ErrorGetCode());

    bool ld = BASS_MIDI_FontLoad(sfz, 0, 0);
    printf("BASS_MIDI_FontLoad: %d\n", BASS_ErrorGetCode());

    BASS_MIDI_FONTINFO sfound;
    BASS_MIDI_FontGetInfo(sfz, &sfound);
    printf("BASS_MIDI_FontGetInfo: %s\n", &sfound.name);

    bool in = BASS_MIDI_InStart(0);
    printf("BASS_MIDI_InStart: %d\n", BASS_ErrorGetCode());

    BASS_MIDI_DEVICEINFO di;
    bool dev = BASS_MIDI_InGetDeviceInfo(0, &di);
    printf("BASS_MIDI_FontGetInfo: %s\n", di.name);

    int a;
    BASS_MIDI_FontGetInfo(sfz, &sfound); // get soundfont info for preset count
    DWORD *presets=(DWORD*)malloc(sfound.presets*sizeof(DWORD)); // allocate array for presets
    BASS_MIDI_FontGetPresets(sfz, presets); // get the presets
    for (a=0; a<sfound.presets; a++) {
        DWORD preset=LOWORD(presets[a]), bank=HIWORD(presets[a]); // extract preset and bank number
        const char *name=BASS_MIDI_FontGetPreset(sfz, preset, bank); // get the preset's name
        printf("BASS_MIDI_FontGetPresets: %d.%d: %s\n", bank, preset, name);
    }
    free(presets);


    stream1 = BASS_MIDI_StreamCreate(1, BASS_SAMPLE_FLOAT, 0);
    BASS_MIDI_StreamEvent(stream1, 0, MIDI_EVENT_NOTE, MAKEWORD(71, 125));
    Sleep(3000);
    BASS_MIDI_StreamEvent(stream1, 0, MIDI_EVENT_NOTE, 71);

    //getchar();
   
    // free the stream
    BASS_StreamFree(stream1);
    // free BASS
    BASS_Free();

    printf("Done\n");
    return 0;
}

And this is my SFZ file. The wav files are on the same SFZ folder as the myDrum.sfz file, which looks be loaded correctly.
Code: [Select]
// Title: myDrum
// Author: Christian D'Aquino

// global settings
<global> ampeg_attack=0 ampeg_decay=0 ampeg_sustain=100 ampeg_release=0.6 ampeg_hold=0 ampeg_delay=0
// end of global settings



// tom1: 71
// Velocity Layer 16
<group> volume=0 pan=0 transpose=0 key=71 lovel=120 hivel=127
<region> sample=SFZ/CDW10Tom-DynLH16.wav lorand=0 hirand=0.5
<region> sample=SFZ/CDW10Tom-DynRH16.wav lorand=0.5 hirand=1

// Velocity Layer 15
<group> volume=0 pan=0 transpose=0 key=71 lovel=112 hivel=119
<region> sample=SFZ/CDW10Tom-DynLH15.wav lorand=0 hirand=0.5
<region> sample=SFZ/CDW10Tom-DynRH15.wav lorand=0.5 hirand=1

// Velocity Layer 14
<group> volume=0 pan=0 transpose=0 key=71 lovel=104 hivel=111
<region> sample=SFZ/CDW10Tom-DynLH14.wav lorand=0 hirand=0.5
<region> sample=SFZ/CDW10Tom-DynRH14.wav lorand=0.5 hirand=1

// Velocity Layer 13
<group> volume=0 pan=0 transpose=0 key=71 lovel=96 hivel=103
<region> sample=SFZ/CDW10Tom-DynLH13.wav lorand=0 hirand=0.5
<region> sample=SFZ/CDW10Tom-DynRH13.wav lorand=0.5 hirand=1

// Velocity Layer 12
<group> volume=0 pan=0 transpose=0 key=71 lovel=88 hivel=95
<region> sample=SFZ/CDW10Tom-DynLH12.wav lorand=0 hirand=0.5
<region> sample=SFZ/CDW10Tom-DynRH12.wav lorand=0.5 hirand=1

// Velocity Layer 11
<group> volume=0 pan=0 transpose=0 key=71 lovel=80 hivel=87
<region> sample=SFZ/CDW10Tom-DynLH11.wav lorand=0 hirand=0.5
<region> sample=SFZ/CDW10Tom-DynRH11.wav lorand=0.5 hirand=1

// Velocity Layer 10
<group> volume=0 pan=0 transpose=0 key=71 lovel=72 hivel=79
<region> sample=SFZ/CDW10Tom-DynLH10.wav lorand=0 hirand=0.5
<region> sample=SFZ/CDW10Tom-DynRH10.wav lorand=0.5 hirand=1

// Velocity Layer 09
<group> volume=0 pan=0 transpose=0 key=71 lovel=64 hivel=71
<region> sample=SFZ/CDW10Tom-DynLH09.wav lorand=0 hirand=0.5
<region> sample=SFZ/CDW10Tom-DynRH09.wav lorand=0.5 hirand=1

// Velocity Layer 08
<group> volume=0 pan=0 transpose=0 key=71 lovel=56 hivel=63
<region> sample=SFZ/CDW10Tom-DynLH08.wav lorand=0 hirand=0.5
<region> sample=SFZ/CDW10Tom-DynRH08.wav lorand=0.5 hirand=1

// Velocity Layer 07
<group> volume=0 pan=0 transpose=0 key=71 lovel=48 hivel=55
<region> sample=SFZ/CDW10Tom-DynLH07.wav lorand=0 hirand=0.5
<region> sample=SFZ/CDW10Tom-DynRH07.wav lorand=0.5 hirand=1

// Velocity Layer 06
<group> volume=0 pan=0 transpose=0 key=71 lovel=40 hivel=47
<region> sample=SFZ/CDW10Tom-DynLH06.wav lorand=0 hirand=0.5
<region> sample=SFZ/CDW10Tom-DynRH06.wav lorand=0.5 hirand=1

// Velocity Layer 05
<group> volume=0 pan=0 transpose=0 key=71 lovel=32 hivel=39
<region> sample=SFZ/CDW10Tom-DynLH05.wav lorand=0 hirand=0.5
<region> sample=SFZ/CDW10Tom-DynRH05.wav lorand=0.5 hirand=1

// Velocity Layer 04
<group> volume=0 pan=0 transpose=0 key=71 lovel=24 hivel=31
<region> sample=SFZ/CDW10Tom-DynLH04.wav lorand=0 hirand=0.5
<region> sample=SFZ/CDW10Tom-DynRH04.wav lorand=0.5 hirand=1

// Velocity Layer 03
<group> volume=0 pan=0 transpose=0 key=71 lovel=16 hivel=23
<region> sample=SFZ/CDW10Tom-DynLH03.wav lorand=0 hirand=0.5
<region> sample=SFZ/CDW10Tom-DynRH03.wav lorand=0.5 hirand=1

// Velocity Layer 02
<group> volume=0 pan=0 transpose=0 key=71 lovel=8 hivel=15
<region> sample=SFZ/CDW10Tom-DynLH02.wav lorand=0 hirand=0.5
<region> sample=SFZ/CDW10Tom-DynRH02.wav lorand=0.5 hirand=1

// Velocity Layer 01
<group> volume=0 pan=0 transpose=0 key=71 lovel=1 hivel=7
<region> sample=SFZ/CDW10Tom-DynLH01.wav lorand=0 hirand=0.5
<region> sample=SFZ/CDW10Tom-DynRH01.wav lorand=0.5 hirand=1

Through this:
Code: [Select]
stream1 = BASS_MIDI_StreamCreate(1, BASS_SAMPLE_FLOAT, 0);
BASS_MIDI_StreamEvent(stream1, 0, MIDI_EVENT_NOTE, MAKEWORD(71, 125));

I was expecting to hear either one of these two files being played:
Code: [Select]
<group> volume=0 pan=0 transpose=0 key=71 lovel=120 hivel=127
<region> sample=SFZ/CDW10Tom-DynLH16.wav lorand=0 hirand=0.5
<region> sample=SFZ/CDW10Tom-DynRH16.wav lorand=0.5 hirand=1

But don't get any sound.

My goal is to eventually read a MIDI message that will be sent through USB-MIDI (a Teensy board, from PJRC.com) and play the corresponding wav file.

aquinch

  • Posts: 13
Re: BASSMIDI, SFZ and WAV files
« Reply #3 on: 9 Mar '19 - 22:50 »
Also, I don't understand what I am receiving through this callout:
Code: [Select]
void CALLBACK MidiInProc(DWORD device, double time, const BYTE *buffer, DWORD length, void *user) {
    cout << "MIDI Received: " << &buffer << "\n";
}

I have a Teensy board sending a MIDI note on 71 with velocity 127 every second. I was expecting to be receiving this:
Code: [Select]
MIDI Received: 0x9071127

But this is what I get instead, which means nothing...
Code: [Select]
MIDI Received: 0x34dfc40

Falcosoft

  • Posts: 21
Re: BASSMIDI, SFZ and WAV files
« Reply #4 on: 10 Mar '19 - 08:15 »
By using '&buffer' in your code you print out the address of buffer. So you will get a memory address that is no way ' means nothing' but definitely not the result you wanted.
To print the value in buffer you have to dereference the buffer pointer instead (*buffer). Anyway to send Bassmidi the messages you get through MidiInProc() you do not have to dereference anything you simply have to call:

Code: [Select]
BASS_MIDI_StreamEvents(stream, BASS_MIDI_EVENTS_RAW, buffer, length);
Also you will never get:
Code: [Select]
MIDI Received: 0x9071127You will get '0x90477F' instead :) (71 and 127 are decimal values but you will get the hexadecimal representation of them). And on x86/x64 Windows MIDI message bytes are actually in reversed order so you will really get '0x7F4790' instead.
« Last Edit: 10 Mar '19 - 15:26 by Falcosoft »

aquinch

  • Posts: 13
Re: BASSMIDI, SFZ and WAV files
« Reply #5 on: 10 Mar '19 - 11:59 »
Hi Falcosoft,

Thanks for the clarification. I was just trying to print the MIDI message to check if at least the message was being received correctly, as I am getting no joy from
Code: [Select]
stream1 = BASS_MIDI_StreamCreate(1, BASS_SAMPLE_FLOAT, 0);
BASS_MIDI_StreamEvent(stream1, 0, MIDI_EVENT_NOTE, MAKEWORD(71, 125));
as per my previous post.

Falcosoft

  • Posts: 21
Re: BASSMIDI, SFZ and WAV files
« Reply #6 on: 10 Mar '19 - 12:26 »
Hi,
1. For proper testing instead of your custom made SFZ soundfont you should use a known working regular SF2 file. E.g. try this:
http://falcosoft.hu/reality_gmgs_falcomod.zip
This way you can avoid possible problems caused by a not proper soundfont/or soundfont configuration. You should simply initialize the SF2 soundfont by Bassmidi to use all banks/presets ( SF2 soundfonts contrary to SFZ can contain a full GM/GS instrument set). This way the synth can use all 16 channels /128 programs and you should hear your notes regardless what channels/instruments are used.
2. In Bassmidi's package you can find the Synth example (synth.c). Essentially it implements properly just what you want. Take a look at it.
« Last Edit: 10 Mar '19 - 12:33 by Falcosoft »

aquinch

  • Posts: 13
Re: BASSMIDI, SFZ and WAV files
« Reply #7 on: 10 Mar '19 - 23:48 »
Hi,

I've tried your file and I still didn't get any sound.
Here is the code I've used:
Code: [Select]
#include <iostream>
#include <chrono>
#include <sstream>
#include "bass.h"
#include "bassmidi.h"

using namespace std;

HSTREAM stream1;


void CALLBACK MidiInProc(DWORD device, double time, const BYTE *buffer, DWORD length, void *user) {
    std::stringstream ss;
    ss << &buffer;
    cout << "MIDI Received: " << &buffer << "\n";
    BASS_MIDI_StreamEvents(stream1, BASS_MIDI_EVENTS_RAW, buffer, length);
}


int main() {

    //int error = 0;

    if (BASS_Init(-1, 44100, 0, 0, NULL)) {
        printf("BASS_Init: %d\n", BASS_ErrorGetCode());
    }

    bool ini = BASS_MIDI_InInit(0, MidiInProc, 0);
    printf("BASS_MIDI_InInit: %d\n", BASS_ErrorGetCode());

    int sfz = BASS_MIDI_FontInit("Reality_GMGS_falcomod.sf2", 0);
    printf("BASS_MIDI_FontInit: %d\n", BASS_ErrorGetCode());

    //BASS_SetConfigPtr(BASS_CONFIG_MIDI_DEFFONT, "SFZ/myDrum.sfz");
    //printf("BASS_SetConfigPtr: %d\n", BASS_ErrorGetCode());

    bool ld = BASS_MIDI_FontLoad(sfz, 0, 0);
    printf("BASS_MIDI_FontLoad: %d\n", BASS_ErrorGetCode());

    //BASS_MIDI_FONTINFO sfound;
    //BASS_MIDI_FontGetInfo(sfz, &sfound);
    //printf("BASS_MIDI_FontGetInfo: %s\n", sfound.name);

    bool in = BASS_MIDI_InStart(0);
    printf("BASS_MIDI_InStart: %d\n", BASS_ErrorGetCode());

    BASS_MIDI_DEVICEINFO di;
    bool dev = BASS_MIDI_InGetDeviceInfo(0, &di);
    printf("BASS_MIDI_InGetDeviceInfo: %s\n", di.name);

    stream1 = BASS_MIDI_StreamCreate(1, BASS_SAMPLE_FLOAT, 0);

    BASS_MIDI_FONT config[1];
    config[0].font = sfz;
    config[0].preset = -1; // use all presets
    config[0].bank = 0; // use default bank(s)
    BASS_MIDI_StreamSetFonts(stream1, config, 1); // set default soundfont config
    printf("BASS_MIDI_StreamSetFonts: %d\n", BASS_ErrorGetCode());

    int a;
    BASS_MIDI_FONTINFO sfound;
    BASS_MIDI_FontGetInfo(sfz, &sfound); // get soundfont info for preset count
    printf("BASS_MIDI_FontGetInfo: %s\n", &sfound.name);
    DWORD *presets=(DWORD*)malloc(sfound.presets*sizeof(DWORD)); // allocate array for presets
    BASS_MIDI_FontGetPresets(sfz, presets); // get the presets
    for (a=0; a<sfound.presets; a++) {
        DWORD preset=LOWORD(presets[a]), bank=HIWORD(presets[a]); // extract preset and bank number
        const char *name=BASS_MIDI_FontGetPreset(sfz, preset, bank); // get the preset's name
        printf("BASS_MIDI_FontGetPresets: %d.%d: %s\n", bank, preset, name);
    }
    free(presets);
   

    BASS_MIDI_EVENT events[1];
    memset(events, 0, sizeof(events));
    //events[0].event = MIDI_EVENT_NOTE;
    //events[0].param = 1;
    events[0].event = MIDI_EVENT_NOTE;
    events[0].param = MAKEWORD(71, 125);

    //bool sls = BASS_MIDI_StreamLoadSamples(stream1);
    //printf("BASS_MIDI_StreamLoadSamples: %d\n", sls);
    //printf("BASS_MIDI_StreamLoadSamples: %d\n", BASS_ErrorGetCode());

    BASS_MIDI_StreamEvents(stream1, BASS_MIDI_EVENTS_STRUCT, events, 1);
    Sleep(2000);

    //getchar();
   
    // free the stream
    BASS_StreamFree(stream1);
    // free BASS
    BASS_Free();

    printf("Done\n");
    return 0;
}

Falcosoft

  • Posts: 21
Re: BASSMIDI, SFZ and WAV files
« Reply #8 on: 11 Mar '19 - 01:05 »
You simply forgot to start playing the stream :)

I have also found an 'address of' error in printing the soundfont's name but apart from this your code is working on my side. Here's the corrected one:

Code: [Select]
#include "stdafx.h"
#include <iostream>
#include <sstream>
#include "bass.h"
#include "bassmidi.h"

using namespace std;


HSTREAM stream1;

void CALLBACK MidiInProc(DWORD device, double time, const BYTE *buffer, DWORD length, void *user) {
    std::stringstream ss;
    ss << &buffer;
    cout << "MIDI Received: " <<  (DWORD*)((buffer[0]) | (buffer[1] << 8) | (buffer[2] << 16)) << "\n";
    BASS_MIDI_StreamEvents(stream1, BASS_MIDI_EVENTS_RAW, buffer, length);
}


int main() {

    //int error = 0;

    if (BASS_Init(-1, 44100, 0, 0, NULL)) {
        printf("BASS_Init: %d\n", BASS_ErrorGetCode());
    }

    bool ini = BASS_MIDI_InInit(0, MidiInProc, 0);
    printf("BASS_MIDI_InInit: %d\n", BASS_ErrorGetCode());

    HSOUNDFONT sfz = BASS_MIDI_FontInit("Reality_GMGS_falcomod.sf2", 0);
    printf("BASS_MIDI_FontInit: %d\n", BASS_ErrorGetCode());

    //BASS_SetConfigPtr(BASS_CONFIG_MIDI_DEFFONT, "SFZ/myDrum.sfz");
    //printf("BASS_SetConfigPtr: %d\n", BASS_ErrorGetCode());

    bool ld = BASS_MIDI_FontLoad(sfz, 0, 0);
    printf("BASS_MIDI_FontLoad: %d\n", BASS_ErrorGetCode());

    //BASS_MIDI_FONTINFO sfound;
    //BASS_MIDI_FontGetInfo(sfz, &sfound);
    //printf("BASS_MIDI_FontGetInfo: %s\n", sfound.name);

    bool in = BASS_MIDI_InStart(0);
    printf("BASS_MIDI_InStart: %d\n", BASS_ErrorGetCode());

    BASS_MIDI_DEVICEINFO di;
    bool dev = BASS_MIDI_InGetDeviceInfo(0, &di);
    printf("BASS_MIDI_InGetDeviceInfo: %s\n", di.name);

    stream1 = BASS_MIDI_StreamCreate(1, BASS_SAMPLE_FLOAT, 0);
    printf("BASS_MIDI_StreamCreate: %d\n", BASS_ErrorGetCode());

BASS_ChannelPlay(stream1, 0);
printf("BASS_ChannelPlay: %d\n", BASS_ErrorGetCode());

    BASS_MIDI_FONT config[1];
    config[0].font = sfz;
    config[0].preset = -1; // use all presets
    config[0].bank = 0; // use default bank(s)
    BASS_MIDI_StreamSetFonts(stream1, config, 1); // set default soundfont config
    printf("BASS_MIDI_StreamSetFonts: %d\n", BASS_ErrorGetCode());

    int a;
    BASS_MIDI_FONTINFO sfound;
    BASS_MIDI_FontGetInfo(sfz, &sfound); // get soundfont info for preset count
    printf("BASS_MIDI_FontGetInfo: %s\n", sfound.name);
    DWORD *presets=(DWORD*)malloc(sfound.presets*sizeof(DWORD)); // allocate array for presets
    BASS_MIDI_FontGetPresets(sfz, presets); // get the presets
/*   
for (a=0; a<sfound.presets; a++) {
        DWORD preset=LOWORD(presets[a]), bank=HIWORD(presets[a]); // extract preset and bank number
        const char *name=BASS_MIDI_FontGetPreset(sfz, preset, bank); // get the preset's name
        printf("BASS_MIDI_FontGetPresets: %d.%d: %s\n", bank, preset, name);
    }
*/
    free(presets);
   

    BASS_MIDI_EVENT events[1];
    memset(events, 0, sizeof(events));
    //events[0].event = MIDI_EVENT_NOTE;
    //events[0].param = 1;
    events[0].event = MIDI_EVENT_NOTE;
    events[0].param = MAKEWORD(71, 125);

    //bool sls = BASS_MIDI_StreamLoadSamples(stream1);
    //printf("BASS_MIDI_StreamLoadSamples: %d\n", sls);
    //printf("BASS_MIDI_StreamLoadSamples: %d\n", BASS_ErrorGetCode());

    BASS_MIDI_StreamEvents(stream1, BASS_MIDI_EVENTS_STRUCT, events, 1);
    Sleep(2000);

    //getchar();
   
    // free the stream
    BASS_StreamFree(stream1);
    // free BASS
    BASS_Free();

    printf("Done\n");
    return 0;
}

« Last Edit: 11 Mar '19 - 01:37 by Falcosoft »

aquinch

  • Posts: 13
Re: BASSMIDI, SFZ and WAV files
« Reply #9 on: 11 Mar '19 - 01:42 »
Hi Falcosoft,

I was reading through the synth.c as per your recommendation when I learned that I had to call:
Code: [Select]
BASS_ChannelPlay(stream1, 0);
I thought that just calling BASS_MIDI_StreamSetFonts was enought to trigger the channel. Apparently not.
Code: [Select]
BASS_MIDI_StreamSetFonts(stream1, &config, 1);
Also, the wav files address are relative to the SFZ file and not the BASS library. So the correct link is:
Code: [Select]
<group> volume=0 pan=0 transpose=0 key=71 lovel=120 hivel=127
<region> sample=CDW10Tom-DynLH16.wav lorand=0 hirand=0.5
<region> sample=CDW10Tom-DynRH16.wav lorand=0.5 hirand=1

instead of
Code: [Select]
<group> volume=0 pan=0 transpose=0 key=71 lovel=120 hivel=127
<region> sample=SFZ/CDW10Tom-DynLH16.wav lorand=0 hirand=0.5
<region> sample=SFZ/CDW10Tom-DynRH16.wav lorand=0.5 hirand=1

I got some progress now. Thank you for the help!

aquinch

  • Posts: 13
Re: BASSMIDI, SFZ and WAV files
« Reply #10 on: 11 Mar '19 - 04:35 »
Thanks
« Last Edit: 11 Mar '19 - 06:25 by aquinch »