[squeak-dev] Bad loop parameters in AIFF [Repost without large attachment]

David T. Lewis lewis at mail.msen.com
Sat Feb 5 16:31:41 UTC 2022


Thanks David and Karl. This sounds like something we should put into trunk.

David, 

If you are comfortable using Monticello tools, could you please put
this update into the inbox? That way, when we put it into trunk the
update will have your initials on it.

All you need to do is highlight the Sound package in a Monticello
browser, then click the "+Repository" button and open a new repository
of type "HTTP". Fill in the repository information with this:

MCHttpRepository
	location: 'http://source.squeak.org/inbox'
	user: ''
	password: ''

Then you will be able to select the inbox repository along with the
Sound package, and click the Save button to save it to the inbox.

It also will be helpful, but not necessary, to register a 'dto'
account for yourself on http://source.squeak.org to identify yourself
for this and future updates. But the inbox does not require a user
or password so registering yourself is optional.

Note that you can also open local file based repositories by opening
a repository of type 'directory' and point it at an empty directory
on your computer. If you have not worked with Monticello repositories
before, you can practice on a local repository, and if you save to
a local repository you can later open that repository and copy a
package to the inbox.

Thank you!

Dave


On Sat, Feb 05, 2022 at 10:13:02AM -0500, David O'Toole wrote:
> With the MIDI note added to the AIFF file markers, plus my changeset,
> everything works correctly; the [ScorePlayerMorph extraExample openInHand]
> example plays properly (and pleasingly) when all the instruments are set to
> the new SampledInstrument 'cello f'.
> 
> On Sat, Feb 5, 2022 at 9:41 AM David O'Toole <deeteeoh1138 at gmail.com> wrote:
> 
> > Thank you so much for your help Karl!
> >
> >
> > On Sat, Feb 5, 2022 at 9:37 AM karl ramberg <karlramberg at gmail.com> wrote:
> >
> >> Cool
> >>
> >> Best,
> >> Karl
> >>
> >> On Sat, Feb 5, 2022 at 3:32 PM David O'Toole <deeteeoh1138 at gmail.com>
> >> wrote:
> >>
> >>> "markers last last" <---- this isn't correct, it should be "markers
> >>> second last" as it is definitely legitimate for AIFF files to contain more
> >>> than two markers. Indeed with the following changeset, I get a working (if
> >>> somewhat wonky and still needing to be debugged) instrument.
> >>>
> >>> vCello := SampledInstrument readSimpleInstrument: 'cello' fromDirectory:
> >>> '/home/dto/sessions/orch.mosaic'.
> >>> vCello playChromaticRunFrom: 10 to: 40.
> >>> (vCello soundForMidiKey: 20 dur: 8.0 loudness: 0.5) play.
> >>>
> >>> On Sat, Feb 5, 2022 at 9:03 AM karl ramberg <karlramberg at gmail.com>
> >>> wrote:
> >>>
> >>>>
> >>>> I think there is something wrong with the logic for AIFFFileReader
> >>>> instance variable isLooped.
> >>>> I don't see the error if I hard code isLooped to false in method below.
> >>>>
> >>>> AIFFFileReader>>readInstrumentChunk: chunkSize
> >>>> ...
> >>>> isLooped := sustainMode = 1.
> >>>> (isLooped and: [markers notNil]) ifTrue: [
> >>>> ((markers first last > frameCount) or:
> >>>> [markers last last > frameCount]) ifTrue: [
> >>>> "bad loop data; some sample CD files claim to be looped but aren't"
> >>>> isLooped := false]].
> >>>>
> >>>> The logic for determining if a sound is looped seems a little
> >>>> error-prone.
> >>>>
> >>>> Loop length in AIFFFileReader is calculated from markers
> >>>> Markers in 36.aif is #(#(1 '' 44100) #(2 '' 88200) #(3 '' 0) #(4 ''
> >>>> 0)).
> >>>>
> >>>> markers := #(#(1 '' 44100) #(2 '' 88200) #(3 '' 0) #(4 '' 0)).
> >>>> markers last last - markers first last  "How AIFFFileReader calculates
> >>>> loop length"
> >>>> -44100
> >>>>
> >>>> Best,
> >>>> Karl
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>> On Sat, Feb 5, 2022 at 1:36 PM David O'Toole <deeteeoh1138 at gmail.com>
> >>>> wrote:
> >>>>
> >>>>> Try placing the unzipped "cello f" folder into directory "path_to_foo"
> >>>>> then:
> >>>>>
> >>>>> SampledInstrument readSimpleInstrument: 'cello' fromDirectory:
> >>>>> 'path_to_foo'
> >>>>>
> >>>>> I see your comment about the negative loop length, however this
> >>>>> appears to be the bug itself---I verified in Snd that the loop points are
> >>>>> 44100 and 88200.
> >>>>>
> >>>>> On Sat, Feb 5, 2022 at 7:08 AM karl ramberg <karlramberg at gmail.com>
> >>>>> wrote:
> >>>>>
> >>>>>> Do you have a short doIt to load these samples ?
> >>>>>> I'm not sure how you set it up.
> >>>>>> A quick look at aiffloop.txt I see this:
> >>>>>> LoopedSampledSound>>samples:loopEnd:loopLength:pitch:samplingRate:
> >>>>>> 	Receiver: a LoopedSampledSound
> >>>>>> 	Arguments and temporary variables:
> >>>>>> 		aSoundBuffer: 	a SoundBuffer(0 0 0 1 1 1 2 2 2 2 2 3 3 3 3 3 3 3 3 2 2 2 2 1 1 0...etc...
> >>>>>> 		loopEndIndex: 	0
> >>>>>> 		loopSampleCount: 	-44100
> >>>>>>
> >>>>>> So there will probably be issues with negative number of samples in the loop
> >>>>>>
> >>>>>> Best,
> >>>>>> Karl
> >>>>>>
> >>>>>>
> >>>>>> On Sat, Feb 5, 2022 at 2:46 AM David O'Toole <deeteeoh1138 at gmail.com>
> >>>>>> wrote:
> >>>>>>
> >>>>>>> (Apologies if this is a double post, I think the other will be
> >>>>>>> rejected on account of the 2+MB AIFF file I attached. Instead I've put up a
> >>>>>>> Zip file of the AIFFs I'm trying to import, on GDrive:
> >>>>>>> https://drive.google.com/file/d/16BvtxS9tkIPJRcx-cri1gPGM5p0E7uV_/view?usp=sharing
> >>>>>>>
> >>>>>>> Original message:
> >>>>>>>
> >>>>>>> I have AIFF files with loop points all set the same, beginning at
> >>>>>>> sample 44100 and ending at 88200. I am trying to use
> >>>>>>> SampledInstrument(class)>>#readSimpleInstrument:fromDirectory: to create a
> >>>>>>> sampled instrument.
> >>>>>>>
> >>>>>>> In Snd i can verify the loop points are correct:
> >>>>>>>
> >>>>>>> > >(sound-loop-info (open-sound "~/sessions/orch.mosaic/cello
> >>>>>>> f/36.aif"))
> >>>>>>> (44100 88200 0 0 0 0 1 1)
> >>>>>>>
> >>>>>>> But as you can see in the bug report/screenshot, the end point
> >>>>>>> becomes 0 somehow when it reaches note 36.aif, resulting in an error. I've
> >>>>>>> also included the offending .aif file, which might be malformed in some way
> >>>>>>> I haven't discovered.
> >>>>>>>
> >>>>>>> How might I go about debugging this further?
> >>>>>>>
> >>>>>>>
> >>>>>>
> >>>>>
> >>>>
> >>>
> >>

> 



More information about the Squeak-dev mailing list