[squeak-dev] The Trunk: Sound-dto.85.mcz

commits at source.squeak.org commits at source.squeak.org
Sat Feb 5 20:49:24 UTC 2022


David T. Lewis uploaded a new version of Sound to project The Trunk:
http://source.squeak.org/trunk/Sound-dto.85.mcz

==================== Summary ====================

Name: Sound-dto.85
Author: dto
Time: 5 February 2022, 1:19:37.313377 pm
UUID: 1f3917a1-5536-4c9f-80b7-6f3613e7d087
Ancestors: Sound-ct.84

Fixes incorrect AIFF loop marker extraction, and removes obsolete path delimiters in SampledInstrument.

=============== Diff against Sound-ct.84 ===============

Item was changed:
  ----- Method: AIFFFileReader>>loopEnd (in category 'accessing') -----
  loopEnd
+ 	^ markers second last!
- 
- 	^ markers last last
- !

Item was changed:
  ----- Method: AIFFFileReader>>loopLength (in category 'accessing') -----
  loopLength
+ 	^ markers second last - markers first last!
- 
- 	^ markers last last - markers first last
- !

Item was changed:
  ----- Method: AIFFFileReader>>readInstrumentChunk: (in category 'private') -----
+ readInstrumentChunk: chunkSize 
+ 	| midiKey detune lowNote highNote lowVelocity highVelocity sustainMode sustainStartID sustainEndID releaseMode releaseStartID releaseEndID |
- readInstrumentChunk: chunkSize
- 
- 	| midiKey detune lowNote highNote lowVelocity highVelocity
- 	  sustainMode sustainStartID sustainEndID
- 	  releaseMode releaseStartID releaseEndID |
- 
  	midiKey := in next.
  	detune := in next.
  	lowNote := in next.
  	highNote := in next.
  	lowVelocity := in next.
  	highVelocity := in next.
  	gain := in nextNumber: 2.
  	sustainMode := in nextNumber: 2.
  	sustainStartID := in nextNumber: 2.
  	sustainEndID := in nextNumber: 2.
  	releaseMode := in nextNumber: 2.
  	releaseStartID := in nextNumber: 2.
  	releaseEndID := in nextNumber: 2.
  	isLooped := sustainMode = 1.
+ 	(isLooped
+ 			and: [markers notNil])
+ 		ifTrue: [(markers first last > frameCount
+ 					or: [markers second last > frameCount])
+ 				ifTrue: ["bad loop data; some sample CD files claim to be
+ 					looped but aren't"
+ 					isLooped := false]].
+ 	pitch := self pitchForKey: midiKey!
- 	(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]].
- 	pitch := self pitchForKey: midiKey.
- !

Item was changed:
  ----- Method: SampledInstrument class>>readLoudAndStaccatoInstrument:fromDirectory: (in category 'instance creation') -----
+ readLoudAndStaccatoInstrument: instName fromDirectory: orchestraDir 
- readLoudAndStaccatoInstrument: instName fromDirectory: orchestraDir
  	"SampledInstrument
+ 	readLoudAndStaccatoInstrument: 'oboe'
+ 	fromDirectory: 'Tosh:Sample Library:Orchestra'"
- 		readLoudAndStaccatoInstrument: 'oboe'
- 		fromDirectory: 'Tosh:Sample Library:Orchestra'"
- 
  	| sampleSetDir memBefore memAfter loud short snd |
+ 	sampleSetDir := orchestraDir , FileDirectory slash , instName.
- 	sampleSetDir := orchestraDir, ':', instName.
  	memBefore := Smalltalk garbageCollect.
+ 	loud := SampledInstrument new readSampleSetFrom: sampleSetDir , ' f'.
+ 	short := SampledInstrument new readSampleSetFrom: sampleSetDir , ' stacc'.
- 	loud := SampledInstrument new readSampleSetFrom: sampleSetDir, ' f'.
- 	short := SampledInstrument new readSampleSetFrom: sampleSetDir, ' stacc'.
  	memAfter := Smalltalk garbageCollect.
+ 	Transcript show: instName , ': ' , (memBefore - memAfter) printString , ' bytes; ' , memAfter printString , ' bytes left';
+ 		 cr.
+ 	AbstractSound soundNamed: instName , '-f&stacc' put: (snd := SampledInstrument new allSampleSets: loud;
+ 					 staccatoLoudAndSoftSampleSet: short).
- 	Transcript show:
- 		instName, ': ', (memBefore - memAfter) printString,
- 		' bytes; ', memAfter printString, ' bytes left'; cr.
- 	AbstractSound soundNamed: instName, '-f&stacc' put:
- 		(snd := SampledInstrument new
- 			allSampleSets: loud;
- 			staccatoLoudAndSoftSampleSet: short).
  	"fix slow attacks"
+ 	snd allNotes
+ 		do: [:n | n
+ 				firstSample: (n findStartPointForThreshold: 500)].
+ 	AbstractSound soundNamed: instName , '-f' put: (snd := SampledInstrument new allSampleSets: loud).
- 	snd allNotes do: [:n | n firstSample: (n findStartPointForThreshold: 500)].
- 
- 	AbstractSound soundNamed: instName, '-f' put:
- 		(snd := SampledInstrument new
- 			allSampleSets: loud).
  	"fix slow attacks"
+ 	snd allNotes
+ 		do: [:n | n
+ 				firstSample: (n findStartPointForThreshold: 1000)]!
- 	snd allNotes do: [:n | n firstSample: (n findStartPointForThreshold: 1000)].
- !

Item was changed:
  ----- Method: SampledInstrument class>>readPizzInstrument:fromDirectory: (in category 'instance creation') -----
+ readPizzInstrument: instName fromDirectory: orchestraDir 
- readPizzInstrument: instName fromDirectory: orchestraDir
  	"SampledInstrument
+ 	readPizzInstrument: 'violin'
+ 	fromDirectory: 'Tosh:Sample Library:Orchestra'"
- 		readPizzInstrument: 'violin'
- 		fromDirectory: 'Tosh:Sample Library:Orchestra'"
- 
  	| sampleSetDir memBefore memAfter sampleSet snd |
+ 	sampleSetDir := orchestraDir , FileDirectory slash , instName , ' pizz'.
- 	sampleSetDir := orchestraDir, ':', instName, ' pizz'.
  	memBefore := Smalltalk garbageCollect.
  	sampleSet := SampledInstrument new readSampleSetFrom: sampleSetDir.
  	memAfter := Smalltalk garbageCollect.
+ 	Transcript show: instName , ': ' , (memBefore - memAfter) printString , ' bytes; ' , memAfter printString , ' bytes left';
+ 		 cr.
+ 	AbstractSound soundNamed: instName , '-pizz' put: (snd := SampledInstrument new allSampleSets: sampleSet).
- 	Transcript show:
- 		instName, ': ', (memBefore - memAfter) printString,
- 		' bytes; ', memAfter printString, ' bytes left'; cr.
- 	AbstractSound soundNamed: instName, '-pizz' put:
- 		(snd := SampledInstrument new allSampleSets: sampleSet).
- 
  	"fix slow attacks"
+ 	snd allNotes
+ 		do: [:n | n
+ 				firstSample: (n findStartPointForThreshold: 1000)].
+ 	^ snd!
- 	snd allNotes do: [:n |
- 		n firstSample: (n findStartPointForThreshold: 1000)].
- 
- 	^ snd
- !

Item was changed:
  ----- Method: SampledInstrument class>>readSimpleInstrument:fromDirectory: (in category 'instance creation') -----
  readSimpleInstrument: instName fromDirectory: orchestraDir
  	"SampledInstrument
  		readSimpleInstrument: 'oboe'
  		fromDirectory: 'Tosh:Sample Library:Orchestra'"
  
  	| sampleSetDir memBefore memAfter sampleSet snd |
+ 	sampleSetDir := orchestraDir, FileDirectory slash, instName, ' f'.
- 	sampleSetDir := orchestraDir, ':', instName, ' f'.
  	memBefore := Smalltalk garbageCollect.
  	sampleSet := SampledInstrument new readSampleSetFrom: sampleSetDir.
  	memAfter := Smalltalk garbageCollect.
  	Transcript show:
  		instName, ': ', (memBefore - memAfter) printString,
  		' bytes; ', memAfter printString, ' bytes left'; cr.
  	AbstractSound soundNamed: instName, '-f' put:
  		(snd := SampledInstrument new allSampleSets: sampleSet).
  
  	"fix slow attacks"
  	snd allNotes do: [:n |
  		n firstSample: (n findStartPointForThreshold: 1000)].
  
  	^ snd
  !



More information about the Squeak-dev mailing list