[squeak-dev] AbstractSound 2 MIDI?

Squeak List squeaklist at yahoo.com
Sat Mar 6 14:08:14 UTC 2010


Karl,

Thanks for your reply.

not sure where the Knowledge Base went - or if this is accurate:

+++

MIDIFileWriter 1.01
converts a MIDIScore into a midifile...YAY!
To load in, modify, and save out a midi file, do this:

(scorePlayerMorph _ ScorePlayerMorph onMIDIFileNamed:'inputMidiFile.mid') openInWorld.
"play with the midi file...move notes around, etc."
"when done, do this:"
mfw _ MIDIFileWriter saveFileNamed: 'outputMidiFile.mid' fromScore: ((scorePlayerMorph scorePlayer) score).
mfw writeMidi.

+++

To simply test out how squeak converts your midifile, try this out:

midiScore _ MIDIFileReader scoreFromFileNamed: 'inputMidiFile.mid'
mfw _ MIDIFileWriter saveFileNamed: 'outputMidiFile.mid' fromScore: midiScore.
mfw writeMidi.

questions? comments? bugs? feature requests? code updates? check out the Knowledge Base
http://guzdial.cc.gatech.edu:8080/squeakers.179
gte356h at prism.gatech.edu

+++

http://guzdial.cc.gatech.edu:8080/squeakers.179

leads to the same dead end :(

this is a main point - at this point :)

btw, i have not tried sending any email to: gte356h at prism.gatech.edu - but from the mentioned dead end, i am not particularly motivated to try :(

what lead to that dead end is a further waste of time - it seems - THAT is why i inquire HERE.

+++


i have spent time with:

mfw _ MIDIFileWriter saveFileNamed: 'outputMidiFile.mid' fromScore: ((scorePlayerMorph scorePlayer) score).
mfw writeMidi. - part...)

possibly: some, most, or all of the ingredients are there, but not for the recipe i am seeking... 

the recipe is kinda the opposite of what i want.

and even that it doesn't actually work as described - or at least as i would hope....

i can open and play a MIDI file in Squeak - no problem...

i can change the instruments in the Score (IN SQUEAK)

and
save the MIDI file...

and,

well,
the saved file plays back with the exact same instrument it was in the first place :(

the changes i made in Squeak do NOT make any difference in the saved MIDI file...meaning that NOTHING was changed in the MIDI file that Squeak produced - it sounds exactly the same.... 

and this is something i do not even particularly care about - as far as the "instrument" goes... but it does seem to be a possible "bug"... just try it: open a midi file - change the instrument(s) - save it VIA MIDIFileWriter - and see if it sounds different from the original....

Point is that everything i have found in the system (as far as what i would expect only from saving a MIDI file that was altered from within squeak merely changing the instrument) does not work...

BUT - as confusing as THAT is - IT is not what i want to do:

translate the fairly simple material from my original post to MIDI...

Thanks for your reply :)

ken









----- Original Message ----
From: Karl Ramberg <karlramberg at gmail.com>
To: squeak-dev at lists.squeakfoundation.org
Sent: Sat, March 6, 2010 4:14:02 AM
Subject: Re: [squeak-dev] AbstractSound 2 MIDI?

Squeak List skrev 2010-03-06 10:47:
> Hello all,
>
> Wondering if there is something i have overlooked that would enable me to turn this sort of stuff:
>
> #(#('c5' 0.1 300) #('c#5' 0.1 300) #('c5' 0.1 300) #('a5' 0.1 300) #('c5' 0.1 300) #('e5' 0.1 300) #('c5' 0.1 300) #('f5' 0.1 300) #('c5' 0.1 300) #('g#5' 0.1 300) #('g#5' 0.1 300) #('f5' 0.1 300) #('g#5' 0.1 300) #('e5' 0.1 300) #('g#5' 0.1 300) #('a5' 0.1 300) #('g#5' 0.1 300) #('c#5' 0.1 300) #('g#5' 0.1 300) #('c5' 0.1 300))
>
> into a standard MIDI file...?
>
> ---
>
> delightful workspace code:
>
> s_PluckedSound new "FMSound clarinet2"  .
> m_MixedSound new.
>
> notes_#(0 1 9 4 5 8)  .
> pedal_#(1 2 1 3 1 4 1 5 1 6 6 5 6 4 6 3 6 2 6 1).
>
> st_ReadStream  on:pedal.
>
> oc_OrderedCollection new.
>
> octave_'5'.
> dur_0.1. "0625."
> vol_300.
>
> d_Dictionary new.
> d at:0 put:'c';
> at:1 put:'c#';
> at:2 put:'d';
> at:3 put:'d#';
> at:4 put:'e';
> at:5 put:'f';
> at:6 put:'f#';
> at:7 put:'g';
> at:8 put:'g#';
> at:9 put:'a';
> at:10 put:'a#';
> at:11 put:'b'.
>
> [st atEnd]whileFalse:
> [oc add:(Array with:((d at:((notes at:st next))),octave)with:dur with:vol)].
> anArray_oc asArray.
>
>
> m    add: (AbstractSound noteSequenceOn: s
>          from: anArray ).
>
> m play
>
> ---
>
> i just want to turn THAT into a standard MIDI file... but if there were more "voices" added to the MixedSound, they should also work/show up :)
>
> At this point, all i really care about is that the MIDI file produced would just convey the note, octave, duration, and volume information - nothing fancy (no extra/spiffy controllers)... i don't even care what "instrument" the midi file uses (except DRUMS) - as long as it just contains the correct note info :)
>
> The goal? To see the notation in a program like Finale, MuseScore, or anything (that runs on Windows) that will show the notes as a music score.
>
> I have looked into Siren and Musical Objects for Squeak, but did not find this feature - or at least no way for me to make sense of how to do it...  it probably is in there somewhere, but it seems that Siren at least has moved on to VW for the most part... also, MIDIFileReader is kinda the opposite of what i am looking for:
>
> (MIDIFileReader(intent))reversed
> does not work :)
>
> i am kinda interested in seeing "standard" musical notation in Squeak, but that is entirely beyond my time and ability right now...
>
> ---
>
> and finally: i am in the Seattle area and remembering the meetings i went to of:
>
> http://www.halcyon.com/podenski/stug/
> Puget Sound Smalltalk and Object-Oriented Database User Group
>
> yeah, that looks grim :(
>
> yet how great it was to discuss this squeak thing with brilliant folks in person...
>
> ---
>
> thanks,
>
> ken
>
>
>
>
>
>
>    
This  ?:
http://guzdial.cc.gatech.edu/squeakers/MIDIFileWriter101.st

Karl


      




More information about the Squeak-dev mailing list