Marc
Thanks. First success. Able to play carnatic notes in Violin (usingdefault soundfont in SCAMP).
Things to do:
- load my soundfont and play using the instruments in it.
- play multiple instruments - including accompanying percussion
Will post progress.
Please feel free to let me know - of the forum is meant only for questions - not progress updates like this
–Sundar
2 Likes
Would appreciate point me to what functions to call
to load soundfont and use the instruments in it.
Tried looking through examples and source code - I think I was lost in that forest.
Any help appreciated.
–Sundar
2 Likes
Hi Sundar!
You’re going to want to use the default_soundfont_preset
keyword argument when creating the Session
:
s = Session(default_soundfont_preset="path/to/soundfont.sf2")
If you’re using the most recent version of SCAMP, one of the places it should look is in the same folder as the Python script.
You can also add a folder for scamp to search for soundfonts in by running:
playback_settings.soundfont_search_paths.append("path/to/directory")
playback_settings.make_persistent()
You only have to run this code once, because the call to make_persistent()
saves the new search path to a JSON file that stores SCAMP’s playback settings. (When you import scamp, it loads up those settings.) In general, if there’s a way that you always want some setting in SCAMP to be, changing that setting and then running make_persistent()
will make that happen.
Oh, when loading a soundfont, it can be useful to call s.print_default_soundfont_presets()
, which will print a list of what’s available.
2 Likes
In terms of playing multiple parts at the same time, check out this video:
At first it just talks about using functions generally, but then it goes into “forking” functions, which is the way you’re going to get multiple parts working at the same time.
2 Likes
Marc
I tried
s = Session(default_soundfont_preset=“path/to/soundfont.sf2”)
I got the following errors:
Traceback (most recent call last):
File “D:\LaptopBackup\Local\Personal\PythonProjects\carnatic_music\carnatic\cplayer.py”, line 34, in
s = Session(default_soundfont_preset=“Lib/SIWF8.sf2”)
TypeError: init() got an unexpected keyword argument ‘default_soundfont_preset’
Then I tried
s = Session(default_soundfont=“Lib/SIWF8.sf2”)
I got the following errors:
WARNING:root:python-rtmidi was not found; streaming midi input / output will not be available.
WARNING:root:pynput was not found; mouse and keyboard input will not be available.
WARNING:root:Could not find preset matching Violin. Falling back to preset 0 (probably piano).
fluidsynth: error: There is no preset with bank number 0 and preset number 0 in SoundFont 1
fluidsynth: error: There is no preset with bank number 0 and preset number 0 in SoundFont 1
fluidsynth: error: There is no preset with bank number 0 and preset number 0 in SoundFont 1
fluidsynth: error: There is no preset with bank number 0 and preset number 0 in SoundFont 1
fluidsynth: error: There is no preset with bank number 0 and preset number 0 in SoundFont 1
fluidsynth: error: There is no preset with bank number 0 and preset number 0 in SoundFont 1
fluidsynth: error: There is no preset with bank number 0 and preset number 0 in SoundFont 1
fluidsynth: error: There is no preset with bank number 0 and preset number 0 in SoundFont 1
1 Like
Oops! Yes, it should have been default_soundfont
.
As for the second issue you’re having, it sounds like the soundfont is loading correctly, but it’s not finding any presets with names similar to “violin”. So then it falls back to bank 0/preset 0, which it seems like doesn’t exist in your soundfont?
What does it print if you run this?
s = Session(default_soundfont=“Lib/SIWF8.sf2”)
s.print_default_soundfont_presets()
2 Likes
PRESETS FOR Lib/SIWF8.sf2
Preset[000:003] Flute 1 bag(s) from #0
Preset[000:001] Veena 1 bag(s) from #1
Preset[000:005] Mridangam 2 bag(s) from #2
Preset[000:006] EastWestMix 1 bag(s) from #4
Preset[000:002] Veena2 1 bag(s) from #5
Preset[000:004] Sarod 1 bag(s) from #6
Preset EOP
I tried changing instrument to Veena, Veena2… Still same error.
Sorry bothering you.
BTW - my code I have uploaded to GitHub - naturalstupid/PyCarnatic: Carnatic Music Tutor/Player package - Requires Python 3.6+
Let me try out further this week end.
But I am impressed with SCAMP. This is the BEST for carnatic music which has ornamentation of notes such as gliding, volume contours.. I see lot of potential using SCAMP. The sad part is I am not a carnatic musician who can play and listen and say whether ornamentation is correct.
Anyway - my goal is to provide the tool - so people can play with it and decide
– Good day - thanks for the support - so far - I appreciate
1 Like
OOps…It was my mistake. I used “Sitar” and “Violin” - both are not in my soundfont.
Voila - it works with the instruments listed in my soundfont.
THANKS !!!
Now the next qn: Is it possible to use the instruments from the default as well my soundfont?
Now I have lot of things to fix in my notations part and getting equivalent “pitch and duration” - and then to focus on my script notations for (prolonging / shortening duration, gliding, oscilations, contouring etc).
1 Like
Wow… Your teaching of python is also good.
Forking is interesting. Far different from JFugue I used where I send
V0 C# D D#
V1 E F A A#
V2 C C# D D#
each “V” is played as a separate “voice” / “track” / (fork)
But I see SCAMP is far more versatile. Since my package is meant to read “notations” and then generate music - my most programming is parsing and generating “pitch, volume, duration” for each note and group notes with instruments - and play them together - as written in the notation file
Looks like SCAMP will the latter part so easy compared to my experience with JFugue.
But I am not there yet.
Hats off for such a great package SCAMP. Thanks!..
1 Like
Glad to hear it’s working so well for you!
The way you would do this is by using the “soundfont” keyword argument of the new_part
method. Like this:
instrument_from_synth_soundfont = s.new_part("crazy synth", soundfont="mySynths.sf2")
In your case, if you were setting the default soundfont for the session to your custom soundfont, you could also go back and use the violin sound from the default soundfont like this:
violin = s.new_part("violin", soundfont="default")
So basically, the default_soundfont
that you set when creating a new Session
can be overridden by using the soundfont
argument when you create a new part.
2 Likes
In case you are interested - I am trying to re-write my java software “JRaaga”
into a python package
and simulate a concert through notations
example generated from JRaaga are in
I am not there yet.
I think I have understood SCAMP to some extent now and I hope not to bother you too often anymore
Thanks again for your support
2 Likes